01: /*******************************************************************************************
02: * Copyright (c) Jonas Bonér, Alexandre Vasseur. All rights reserved. *
03: * http://backport175.codehaus.org *
04: * --------------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of Apache License Version 2.0 *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: *******************************************************************************************/package com.tc.backport175;
08:
09: import java.io.PrintStream;
10: import java.io.PrintWriter;
11:
12: /**
13: * Thrown when error in compilation of the annotations.
14: *
15: * @author <a href="mailto:jboner@codehaus.org">Jonas Bonér </a>
16: */
17: public class ReaderException extends RuntimeException {
18: /**
19: * Original exception which caused this exception.
20: */
21: private Throwable m_originalException;
22:
23: /**
24: * Sets the message for the exception.
25: *
26: * @param message the message
27: */
28: public ReaderException(final String message) {
29: super (message);
30: }
31:
32: /**
33: * Sets the message for the exception and the original exception being wrapped.
34: *
35: * @param message the detail of the error message
36: * @param throwable the original exception
37: */
38: public ReaderException(String message, Throwable throwable) {
39: super (message);
40: m_originalException = throwable;
41: }
42:
43: /**
44: * Print the full stack trace, including the original exception.
45: */
46: public void printStackTrace() {
47: printStackTrace(System.err);
48: }
49:
50: /**
51: * Print the full stack trace, including the original exception.
52: *
53: * @param ps the byte stream in which to print the stack trace
54: */
55: public void printStackTrace(PrintStream ps) {
56: super .printStackTrace(ps);
57: if (m_originalException != null) {
58: m_originalException.printStackTrace(ps);
59: }
60: }
61:
62: /**
63: * Print the full stack trace, including the original exception.
64: *
65: * @param pw the character stream in which to print the stack trace
66: */
67: public void printStackTrace(PrintWriter pw) {
68: super.printStackTrace(pw);
69: if (m_originalException != null) {
70: m_originalException.printStackTrace(pw);
71: }
72: }
73: }
|