47 |
public class TransformerException |
public class TransformerException |
48 |
extends Exception |
extends Exception |
49 |
{ |
{ |
50 |
|
private static final long serialVersionUID = 975798773772956428L; |
51 |
|
|
52 |
|
// Field names fixed by serialization spec. |
53 |
private SourceLocator locator; |
private SourceLocator locator; |
54 |
private Throwable cause; |
private Throwable containedException; |
55 |
|
|
56 |
/** |
/** |
57 |
* Constructor with a detail message. |
* Constructor with a detail message. |
96 |
if (cause != null) |
if (cause != null) |
97 |
{ |
{ |
98 |
initCause(cause); |
initCause(cause); |
99 |
this.cause = cause; |
this.containedException = cause; |
100 |
} |
} |
101 |
} |
} |
102 |
|
|
121 |
*/ |
*/ |
122 |
public Throwable getException() |
public Throwable getException() |
123 |
{ |
{ |
124 |
return cause; |
return containedException; |
125 |
} |
} |
126 |
|
|
127 |
/** |
/** |
129 |
*/ |
*/ |
130 |
public Throwable getCause() |
public Throwable getCause() |
131 |
{ |
{ |
132 |
return cause; |
return containedException; |
133 |
} |
} |
134 |
|
|
135 |
/** |
/** |
145 |
*/ |
*/ |
146 |
public Throwable initCause(Throwable cause) |
public Throwable initCause(Throwable cause) |
147 |
{ |
{ |
148 |
if (this.cause != null) |
if (this.containedException != null) |
149 |
{ |
{ |
150 |
throw new IllegalStateException(); |
throw new IllegalStateException(); |
151 |
} |
} |
153 |
{ |
{ |
154 |
throw new IllegalArgumentException(); |
throw new IllegalArgumentException(); |
155 |
} |
} |
156 |
this.cause = cause; |
this.containedException = cause; |
157 |
return this; |
return this; |
158 |
} |
} |
159 |
|
|
223 |
public void printStackTrace(PrintStream s) |
public void printStackTrace(PrintStream s) |
224 |
{ |
{ |
225 |
super.printStackTrace(s); |
super.printStackTrace(s); |
226 |
if (cause != null) |
if (containedException != null) |
227 |
{ |
{ |
228 |
s.print("caused by "); |
s.print("caused by "); |
229 |
cause.printStackTrace(s); |
containedException.printStackTrace(s); |
230 |
} |
} |
231 |
} |
} |
232 |
|
|
233 |
public void printStackTrace(PrintWriter s) |
public void printStackTrace(PrintWriter s) |
234 |
{ |
{ |
235 |
super.printStackTrace(s); |
super.printStackTrace(s); |
236 |
if (cause != null) |
if (containedException != null) |
237 |
{ |
{ |
238 |
s.print("caused by "); |
s.print("caused by "); |
239 |
cause.printStackTrace(s); |
containedException.printStackTrace(s); |
240 |
} |
} |
241 |
} |
} |
242 |
|
|