1
16package org.tp23.antinstaller;
17
18import java.io.PrintStream;
19import java.io.PrintWriter;
20
21
27public class InstallException extends Exception{
28
29 private Throwable cause;
30
31 public InstallException() {
32 }
33 public InstallException(String message) {
34 super(message);
35 }
36 public InstallException(String message,Throwable cause) {
37 super(message);
38 this.cause = cause;
39 }
40 public Throwable getException() {
41 return cause;
42 }
43 public Throwable getCause() {
44 return getException();
45 }
46 public void printStackTrace() {
47 printStackTrace(System.err);
48 }
49 public void printStackTrace(PrintStream ps) {
50 synchronized (ps) {
51 super.printStackTrace(ps);
52 if (cause != null) {
53 ps.println("--- Nested Exception ---");
54 cause.printStackTrace(ps);
55 }
56 }
57 }
58 public void printStackTrace(PrintWriter pw) {
59 synchronized (pw) {
60 super.printStackTrace(pw);
61 if (cause != null) {
62 pw.println("--- Nested Exception ---");
63 cause.printStackTrace(pw);
64 }
65 }
66 }
67}
68