KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > freemarker > template > utility > UndeclaredThrowableException


1 package freemarker.template.utility;
2
3 import java.io.PrintStream JavaDoc;
4 import java.io.PrintWriter JavaDoc;
5
6 /**
7  * The equivalent of JDK 1.3 UndeclaredThrowableException.
8  * @author Attila Szegedi
9  * @version $Id: UndeclaredThrowableException.java,v 1.2 2003/09/17 13:30:05 szegedia Exp $
10  */

11 public class UndeclaredThrowableException extends RuntimeException JavaDoc
12 {
13     private final Throwable JavaDoc t;
14     
15     public UndeclaredThrowableException(Throwable JavaDoc t)
16     {
17         this.t = t;
18     }
19     
20     public void printStackTrace()
21     {
22         printStackTrace(System.err);
23     }
24
25     public void printStackTrace(PrintStream JavaDoc ps)
26     {
27         synchronized (ps)
28         {
29             ps.print("Undeclared throwable:");
30             t.printStackTrace(ps);
31         }
32     }
33
34     public void printStackTrace(PrintWriter JavaDoc pw)
35     {
36         synchronized (pw)
37         {
38             pw.print("Undeclared throwable:");
39             t.printStackTrace(pw);
40         }
41     }
42     
43     public Throwable JavaDoc getUndeclaredThrowable() {
44         return t;
45     }
46 }
47
Popular Tags