1
|
|
/* Generated by AspectJ version 1.0.5 */
|
2
|
|
package org.apache.cactus.util;
|
3
|
|
import java.io.PrintStream;
|
4
|
|
import java.io.PrintWriter;
|
5
|
|
|
6
|
|
/**
|
7
|
|
* A checked chained exception.
|
8
|
|
*
|
9
|
|
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
10
|
|
*
|
11
|
|
* @version $Id: ChainedException.html,v 1.1 2003/04/14 12:27:33 sinisa Exp $
|
12
|
|
*/
|
13
|
|
public class ChainedException extends Exception {
|
14
|
|
/**
|
15
|
|
* Original exception which caused this exception.
|
16
|
|
*/
|
17
|
|
protected Throwable originalException;
|
18
|
|
/**
|
19
|
|
* Create a <code>ChainedException</code> and set the exception error
|
20
|
|
* message.
|
21
|
|
*
|
22
|
|
* @param theMessage the message of the exception
|
23
|
|
*/
|
24
|
0
|
public ChainedException(String theMessage) {
|
25
|
0
|
this(theMessage, null);
|
26
|
|
;
|
27
|
|
}
|
28
|
|
/**
|
29
|
|
* Create a <code>ChainedException</code>, set the exception error
|
30
|
|
* message along with the exception object that caused this exception.
|
31
|
|
*
|
32
|
|
* @param theMessage the detail of the error message
|
33
|
|
* @param theException the original exception
|
34
|
|
*/
|
35
|
0
|
public ChainedException(String theMessage, Throwable theException) {
|
36
|
0
|
super(theMessage);
|
37
|
|
;
|
38
|
0
|
this.originalException = theException;
|
39
|
|
}
|
40
|
|
/**
|
41
|
|
* Create a <code>ChaineException</code>, and set exception object
|
42
|
|
* that caused this exception. The message is set by default to be the one
|
43
|
|
* from the original exception.
|
44
|
|
*
|
45
|
|
* @param theException the original exception
|
46
|
|
*/
|
47
|
0
|
public ChainedException(Throwable theException) {
|
48
|
0
|
super(theException.getMessage());
|
49
|
|
;
|
50
|
0
|
this.originalException = theException;
|
51
|
|
}
|
52
|
|
/**
|
53
|
|
* Print the full stack trace, including the original exception.
|
54
|
|
*/
|
55
|
0
|
public void printStackTrace() {
|
56
|
0
|
this.printStackTrace(System.err);
|
57
|
|
}
|
58
|
|
|
59
|
|
/**
|
60
|
|
* Print the full stack trace, including the original exception.
|
61
|
|
*
|
62
|
|
* @param thePs the byte stream in which to print the stack trace
|
63
|
|
*/
|
64
|
0
|
public void printStackTrace(PrintStream thePs) {
|
65
|
0
|
super.printStackTrace(thePs);
|
66
|
0
|
if (this.originalException != null) {
|
67
|
0
|
this.originalException.printStackTrace(thePs);
|
68
|
|
}
|
69
|
|
}
|
70
|
|
|
71
|
|
/**
|
72
|
|
* Print the full stack trace, including the original exception.
|
73
|
|
*
|
74
|
|
* @param thePw the character stream in which to print the stack trace
|
75
|
|
*/
|
76
|
0
|
public void printStackTrace(PrintWriter thePw) {
|
77
|
0
|
super.printStackTrace(thePw);
|
78
|
0
|
if (this.originalException != null) {
|
79
|
0
|
this.originalException.printStackTrace(thePw);
|
80
|
|
}
|
81
|
|
}
|
82
|
|
|
83
|
|
}
|