KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > aspectwerkz > expression > ExpressionException


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.aspectwerkz.expression;
5
6 import java.io.PrintStream JavaDoc;
7 import java.io.PrintWriter JavaDoc;
8
9 /**
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 JavaDoc {
15   /**
16    * Original exception which caused this exception.
17    */

18   private Throwable JavaDoc m_originalException;
19
20   /**
21    * Sets the message for the exception.
22    *
23    * @param message the message
24    */

25   public ExpressionException(final String JavaDoc 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 JavaDoc message, final Throwable JavaDoc throwable) {
36     super(message);
37     m_originalException = throwable;
38   }
39
40   /**
41    * Print the full stack trace, including the original exception.
42    */

43   public void printStackTrace() {
44     printStackTrace(System.err);
45   }
46
47   /**
48    * Print the full stack trace, including the original exception.
49    *
50    * @param ps the byte stream in which to print the stack trace
51    */

52   public void printStackTrace(final PrintStream JavaDoc ps) {
53     super.printStackTrace(ps);
54     if (m_originalException != null) {
55       m_originalException.printStackTrace(ps);
56     }
57   }
58
59   /**
60    * Print the full stack trace, including the original exception.
61    *
62    * @param pw the character stream in which to print the stack trace
63    */

64   public void printStackTrace(final PrintWriter JavaDoc pw) {
65     super.printStackTrace(pw);
66     if (m_originalException != null) {
67       m_originalException.printStackTrace(pw);
68     }
69   }
70 }
Popular Tags