KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > crypto > dsig > TransformException


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

4 /*
5  * $Id: TransformException.java,v 1.3 2005/05/10 16:03:48 mullan Exp $
6  */

7 package javax.xml.crypto.dsig;
8
9 import java.io.PrintStream JavaDoc;
10 import java.io.PrintWriter JavaDoc;
11
12 /**
13  * Indicates an exceptional condition that occured while executing a
14  * transform algorithm.
15  *
16  * <p>A <code>TransformException</code> can contain a cause: another
17  * throwable that caused this <code>TransformException</code> to get thrown.
18  *
19  * @see Transform#transform
20  * @author Sean Mullan
21  * @author JSR 105 Expert Group
22  * @since 1.6
23  */

24 public class TransformException extends Exception JavaDoc {
25
26     private static final long serialVersionUID = 5082634801360427800L;
27
28     /**
29      * The throwable that caused this exception to get thrown, or null if this
30      * exception was not caused by another throwable or if the causative
31      * throwable is unknown.
32      *
33      * @serial
34      */

35     private Throwable JavaDoc cause;
36
37     /**
38      * Constructs a new <code>TransformException</code> with
39      * <code>null</code> as its detail message.
40      */

41     public TransformException() {
42         super();
43     }
44
45     /**
46      * Constructs a new <code>TransformException</code> with the specified
47      * detail message.
48      *
49      * @param message the detail message
50      */

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

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

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

95     public Throwable JavaDoc getCause() {
96         return cause;
97     }
98
99     /**
100      * Prints this <code>TransformException</code>, its backtrace and
101      * the cause's backtrace to the standard error stream.
102      */

103     public void printStackTrace() {
104     super.printStackTrace();
105     if (cause != null) {
106         cause.printStackTrace();
107     }
108     }
109
110     /**
111      * Prints this <code>TransformException</code>, its backtrace and
112      * the cause's backtrace to the specified print stream.
113      *
114      * @param s <code>PrintStream</code> to use for output
115      */

116     public void printStackTrace(PrintStream JavaDoc s) {
117     super.printStackTrace(s);
118     if (cause != null) {
119         cause.printStackTrace(s);
120     }
121     }
122
123     /**
124      * Prints this <code>TransformException</code>, its backtrace and
125      * the cause's backtrace to the specified print writer.
126      *
127      * @param s <code>PrintWriter</code> to use for output
128      */

129     public void printStackTrace(PrintWriter JavaDoc s) {
130         super.printStackTrace(s);
131     if (cause != null) {
132         cause.printStackTrace(s);
133     }
134     }
135 }
136
Popular Tags