01: /*
02: * Copyright 2005 Paul Hinds
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.tp23.antinstaller;
17:
18: import java.io.PrintStream;
19: import java.io.PrintWriter;
20:
21: /**
22: *
23: * <p>Custom Installation Exception, Hopefully compatible with JDK1.3 and 1.4</p>
24: * @author Paul Hinds
25: * @version $Id: InstallException.java,v 1.1.1.1 2005/10/18 18:20:51 teknopaul Exp $
26: */
27: public class InstallException extends Exception {
28:
29: private Throwable cause;
30:
31: public InstallException() {
32: }
33:
34: public InstallException(String message) {
35: super (message);
36: }
37:
38: public InstallException(String message, Throwable cause) {
39: super (message);
40: this .cause = cause;
41: }
42:
43: public Throwable getException() {
44: return cause;
45: }
46:
47: public Throwable getCause() {
48: return getException();
49: }
50:
51: public void printStackTrace() {
52: printStackTrace(System.err);
53: }
54:
55: public void printStackTrace(PrintStream ps) {
56: synchronized (ps) {
57: super .printStackTrace(ps);
58: if (cause != null) {
59: ps.println("--- Nested Exception ---");
60: cause.printStackTrace(ps);
61: }
62: }
63: }
64:
65: public void printStackTrace(PrintWriter pw) {
66: synchronized (pw) {
67: super .printStackTrace(pw);
68: if (cause != null) {
69: pw.println("--- Nested Exception ---");
70: cause.printStackTrace(pw);
71: }
72: }
73: }
74: }
|