KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > backport175 > ReaderException


1 /*******************************************************************************************
2  * Copyright (c) Jonas Bonér, Alexandre Vasseur. All rights reserved. *
3  * http://backport175.codehaus.org *
4  * --------------------------------------------------------------------------------------- *
5  * The software in this package is published under the terms of Apache License Version 2.0 *
6  * a copy of which has been included with this distribution in the license.txt file. *
7  *******************************************************************************************/

8 package com.tc.backport175;
9
10 import java.io.PrintStream JavaDoc;
11 import java.io.PrintWriter JavaDoc;
12
13 /**
14  * Thrown when error in compilation of the annotations.
15  *
16  * @author <a HREF="mailto:jboner@codehaus.org">Jonas Bonér </a>
17  */

18 public class ReaderException extends RuntimeException JavaDoc {
19     /**
20      * Original exception which caused this exception.
21      */

22     private Throwable JavaDoc m_originalException;
23
24     /**
25      * Sets the message for the exception.
26      *
27      * @param message the message
28      */

29     public ReaderException(final String JavaDoc message) {
30         super(message);
31     }
32
33     /**
34      * Sets the message for the exception and the original exception being wrapped.
35      *
36      * @param message the detail of the error message
37      * @param throwable the original exception
38      */

39     public ReaderException(String JavaDoc message, Throwable JavaDoc throwable) {
40         super(message);
41         m_originalException = throwable;
42     }
43
44     /**
45      * Print the full stack trace, including the original exception.
46      */

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

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

68     public void printStackTrace(PrintWriter JavaDoc pw) {
69         super.printStackTrace(pw);
70         if (m_originalException != null) {
71             m_originalException.printStackTrace(pw);
72         }
73     }
74 }
Popular Tags