1 8 9 package mx4j.tools.config; 10 11 import java.io.PrintStream ; 12 import java.io.PrintWriter ; 13 14 17 public class ConfigurationException extends Exception 18 { 19 private Throwable cause; 20 21 public ConfigurationException() 22 { 23 this(null, null); 24 } 25 26 public ConfigurationException(String message) 27 { 28 this(message, null); 29 } 30 31 public ConfigurationException(Throwable cause) 32 { 33 this(null, cause); 34 } 35 36 public ConfigurationException(String message, Throwable cause) 37 { 38 super(message); 39 this.cause = cause; 40 } 41 42 public Throwable getCause() 43 { 44 return cause; 45 } 46 47 public void printStackTrace() 48 { 49 if (cause == null) 50 { 51 super.printStackTrace(); 52 } 53 else 54 { 55 synchronized (System.err) 56 { 57 System.err.println(this); 58 cause.printStackTrace(); 59 } 60 } 61 } 62 63 public void printStackTrace(PrintStream stream) 64 { 65 if (cause == null) 66 { 67 super.printStackTrace(stream); 68 } 69 else 70 { 71 synchronized (stream) 72 { 73 stream.println(this); 74 cause.printStackTrace(stream); 75 } 76 } 77 } 78 79 public void printStackTrace(PrintWriter writer) 80 { 81 if (cause == null) 82 { 83 super.printStackTrace(writer); 84 } 85 else 86 { 87 synchronized (writer) 88 { 89 writer.println(this); 90 cause.printStackTrace(writer); 91 } 92 } 93 } 94 } 95 | Popular Tags |