01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: package mx4j.tools.config;
10:
11: import java.io.PrintStream;
12: import java.io.PrintWriter;
13:
14: /**
15: * @version $Revision: 1.3 $
16: */
17: public class ConfigurationException extends Exception {
18: private Throwable cause;
19:
20: public ConfigurationException() {
21: this (null, null);
22: }
23:
24: public ConfigurationException(String message) {
25: this (message, null);
26: }
27:
28: public ConfigurationException(Throwable cause) {
29: this (null, cause);
30: }
31:
32: public ConfigurationException(String message, Throwable cause) {
33: super (message);
34: this .cause = cause;
35: }
36:
37: public Throwable getCause() {
38: return cause;
39: }
40:
41: public void printStackTrace() {
42: if (cause == null) {
43: super .printStackTrace();
44: } else {
45: synchronized (System.err) {
46: System.err.println(this );
47: cause.printStackTrace();
48: }
49: }
50: }
51:
52: public void printStackTrace(PrintStream stream) {
53: if (cause == null) {
54: super .printStackTrace(stream);
55: } else {
56: synchronized (stream) {
57: stream.println(this );
58: cause.printStackTrace(stream);
59: }
60: }
61: }
62:
63: public void printStackTrace(PrintWriter writer) {
64: if (cause == null) {
65: super.printStackTrace(writer);
66: } else {
67: synchronized (writer) {
68: writer.println(this);
69: cause.printStackTrace(writer);
70: }
71: }
72: }
73: }
|