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
|
|
* Represent an exception that should stop the running test. It is a runtime
|
8
|
|
* exception but it will be caught by JUnit so the application will not stop.
|
9
|
|
* The test will be reported as failed. It implements chaining.
|
10
|
|
*
|
11
|
|
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
12
|
|
*
|
13
|
|
* @version $Id: ChainedRuntimeException.java,v 1.2 2002/05/01 19:52:27 vmassol Exp $
|
14
|
|
*/
|
15
|
|
public class ChainedRuntimeException extends RuntimeException {
|
16
|
|
/**
|
17
|
|
* Original exception which caused this exception.
|
18
|
|
*/
|
19
|
|
protected Throwable originalException;
|
20
|
|
/**
|
21
|
|
* Create a <code>ChainedRuntimeException</code> and set the exception
|
22
|
|
* error message.
|
23
|
|
*
|
24
|
|
* @param theMessage the message of the exception
|
25
|
|
*/
|
26
|
1
|
public ChainedRuntimeException(String theMessage) {
|
27
|
1
|
this(theMessage, null);
|
28
|
|
;
|
29
|
|
}
|
30
|
|
/**
|
31
|
|
* Create a <code>ChainedRuntimeException</code>, set the exception error
|
32
|
|
* message along with the exception object that caused this exception.
|
33
|
|
*
|
34
|
|
* @param theMessage the detail of the error message
|
35
|
|
* @param theException the original exception
|
36
|
|
*/
|
37
|
1
|
public ChainedRuntimeException(String theMessage, Throwable theException) {
|
38
|
1
|
super(theMessage);
|
39
|
|
;
|
40
|
1
|
this.originalException = theException;
|
41
|
|
}
|
42
|
|
/**
|
43
|
|
* Create a <code>ChainedRuntimeException</code>, and set exception object
|
44
|
|
* that caused this exception. The message is set by default to be the one
|
45
|
|
* from the original exception.
|
46
|
|
*
|
47
|
|
* @param theException the original exception
|
48
|
|
*/
|
49
|
0
|
public ChainedRuntimeException(Throwable theException) {
|
50
|
0
|
super(theException.getMessage());
|
51
|
|
;
|
52
|
0
|
this.originalException = theException;
|
53
|
|
}
|
54
|
|
/**
|
55
|
|
* Print the full stack trace, including the original exception.
|
56
|
|
*/
|
57
|
0
|
public void printStackTrace() {
|
58
|
0
|
this.printStackTrace(System.err);
|
59
|
|
}
|
60
|
|
|
61
|
|
/**
|
62
|
|
* Print the full stack trace, including the original exception.
|
63
|
|
*
|
64
|
|
* @param thePs the byte stream in which to print the stack trace
|
65
|
|
*/
|
66
|
0
|
public void printStackTrace(PrintStream thePs) {
|
67
|
0
|
super.printStackTrace(thePs);
|
68
|
0
|
if (this.originalException != null) {
|
69
|
0
|
this.originalException.printStackTrace(thePs);
|
70
|
|
}
|
71
|
|
}
|
72
|
|
|
73
|
|
/**
|
74
|
|
* Print the full stack trace, including the original exception.
|
75
|
|
*
|
76
|
|
* @param thePw the character stream in which to print the stack trace
|
77
|
|
*/
|
78
|
0
|
public void printStackTrace(PrintWriter thePw) {
|
79
|
0
|
super.printStackTrace(thePw);
|
80
|
0
|
if (this.originalException != null) {
|
81
|
0
|
this.originalException.printStackTrace(thePw);
|
82
|
|
}
|
83
|
|
}
|
84
|
|
|
85
|
|
}
|