01: package freemarker.template.utility;
02:
03: import java.io.PrintStream;
04: import java.io.PrintWriter;
05:
06: /**
07: * The equivalent of JDK 1.3 UndeclaredThrowableException.
08: * @author Attila Szegedi
09: * @version $Id: UndeclaredThrowableException.java,v 1.2 2003/09/17 13:30:05 szegedia Exp $
10: */
11: public class UndeclaredThrowableException extends RuntimeException {
12: private final Throwable t;
13:
14: public UndeclaredThrowableException(Throwable t) {
15: this .t = t;
16: }
17:
18: public void printStackTrace() {
19: printStackTrace(System.err);
20: }
21:
22: public void printStackTrace(PrintStream ps) {
23: synchronized (ps) {
24: ps.print("Undeclared throwable:");
25: t.printStackTrace(ps);
26: }
27: }
28:
29: public void printStackTrace(PrintWriter pw) {
30: synchronized (pw) {
31: pw.print("Undeclared throwable:");
32: t.printStackTrace(pw);
33: }
34: }
35:
36: public Throwable getUndeclaredThrowable() {
37: return t;
38: }
39: }
|