01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.aspectwerkz.expression;
05:
06: import java.io.PrintStream;
07: import java.io.PrintWriter;
08:
09: /**
10: * Thrown when error in the expression.
11: *
12: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
13: */
14: public class ExpressionException extends RuntimeException {
15: /**
16: * Original exception which caused this exception.
17: */
18: private Throwable m_originalException;
19:
20: /**
21: * Sets the message for the exception.
22: *
23: * @param message the message
24: */
25: public ExpressionException(final String message) {
26: super (message);
27: }
28:
29: /**
30: * Sets the message for the exception and the original exception being wrapped.
31: *
32: * @param message the detail of the error message
33: * @param throwable the original exception
34: */
35: public ExpressionException(final String message,
36: final Throwable throwable) {
37: super (message);
38: m_originalException = throwable;
39: }
40:
41: /**
42: * Print the full stack trace, including the original exception.
43: */
44: public void printStackTrace() {
45: printStackTrace(System.err);
46: }
47:
48: /**
49: * Print the full stack trace, including the original exception.
50: *
51: * @param ps the byte stream in which to print the stack trace
52: */
53: public void printStackTrace(final PrintStream ps) {
54: super .printStackTrace(ps);
55: if (m_originalException != null) {
56: m_originalException.printStackTrace(ps);
57: }
58: }
59:
60: /**
61: * Print the full stack trace, including the original exception.
62: *
63: * @param pw the character stream in which to print the stack trace
64: */
65: public void printStackTrace(final PrintWriter pw) {
66: super.printStackTrace(pw);
67: if (m_originalException != null) {
68: m_originalException.printStackTrace(pw);
69: }
70: }
71: }
|