KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > crypto > MarshalException


1 /*
2  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
3  */

4 /*
5  * $Id: MarshalException.java,v 1.5 2005/05/10 15:47:42 mullan Exp $
6  */

7 package javax.xml.crypto;
8
9 import java.io.PrintStream JavaDoc;
10 import java.io.PrintWriter JavaDoc;
11 import javax.xml.crypto.dsig.Manifest;
12 import javax.xml.crypto.dsig.XMLSignature;
13 import javax.xml.crypto.dsig.XMLSignatureFactory;
14 import javax.xml.crypto.dsig.keyinfo.KeyInfo;
15 import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
16
17 /**
18  * Indicates an exceptional condition that occured during the XML
19  * marshalling or unmarshalling process.
20  *
21  * <p>A <code>MarshalException</code> can contain a cause: another
22  * throwable that caused this <code>MarshalException</code> to get thrown.
23  *
24  * @author Sean Mullan
25  * @author JSR 105 Expert Group
26  * @since 1.6
27  * @see XMLSignature#sign(XMLSignContext)
28  * @see XMLSignatureFactory#unmarshalXMLSignature(XMLValidateContext)
29  */

30 public class MarshalException extends Exception JavaDoc {
31
32     private static final long serialVersionUID = -863185580332643547L;
33
34     /**
35      * The throwable that caused this exception to get thrown, or null if this
36      * exception was not caused by another throwable or if the causative
37      * throwable is unknown.
38      *
39      * @serial
40      */

41     private Throwable JavaDoc cause;
42
43     /**
44      * Constructs a new <code>MarshalException</code> with
45      * <code>null</code> as its detail message.
46      */

47     public MarshalException() {
48         super();
49     }
50
51     /**
52      * Constructs a new <code>MarshalException</code> with the specified
53      * detail message.
54      *
55      * @param message the detail message
56      */

57     public MarshalException(String JavaDoc message) {
58         super(message);
59     }
60
61     /**
62      * Constructs a new <code>MarshalException</code> with the
63      * specified detail message and cause.
64      * <p>Note that the detail message associated with
65      * <code>cause</code> is <i>not</i> automatically incorporated in
66      * this exception's detail message.
67      *
68      * @param message the detail message
69      * @param cause the cause (A <tt>null</tt> value is permitted, and
70      * indicates that the cause is nonexistent or unknown.)
71      */

72     public MarshalException(String JavaDoc message, Throwable JavaDoc cause) {
73         super(message);
74         this.cause = cause;
75     }
76
77     /**
78      * Constructs a new <code>MarshalException</code> with the specified cause
79      * and a detail message of <code>(cause==null ? null : cause.toString())
80      * </code> (which typically contains the class and detail message of
81      * <code>cause</code>).
82      *
83      * @param cause the cause (A <tt>null</tt> value is permitted, and
84      * indicates that the cause is nonexistent or unknown.)
85      */

86     public MarshalException(Throwable JavaDoc cause) {
87         super(cause==null ? null : cause.toString());
88         this.cause = cause;
89     }
90
91     /**
92      * Returns the cause of this <code>MarshalException</code> or
93      * <code>null</code> if the cause is nonexistent or unknown. (The
94      * cause is the throwable that caused this
95      * <code>MarshalException</code> to get thrown.)
96      *
97      * @return the cause of this <code>MarshalException</code> or
98      * <code>null</code> if the cause is nonexistent or unknown.
99      */

100     public Throwable JavaDoc getCause() {
101         return cause;
102     }
103
104     /**
105      * Prints this <code>MarshalException</code>, its backtrace and
106      * the cause's backtrace to the standard error stream.
107      */

108     public void printStackTrace() {
109     super.printStackTrace();
110     //XXX print backtrace of cause
111
}
112
113     /**
114      * Prints this <code>MarshalException</code>, its backtrace and
115      * the cause's backtrace to the specified print stream.
116      *
117      * @param s <code>PrintStream</code> to use for output
118      */

119     public void printStackTrace(PrintStream JavaDoc s) {
120     super.printStackTrace(s);
121     //XXX print backtrace of cause
122
}
123
124     /**
125      * Prints this <code>MarshalException</code>, its backtrace and
126      * the cause's backtrace to the specified print writer.
127      *
128      * @param s <code>PrintWriter</code> to use for output
129      */

130     public void printStackTrace(PrintWriter JavaDoc s) {
131         super.printStackTrace(s);
132     //XXX print backtrace of cause
133
}
134 }
135
Popular Tags