1 7 package winstone; 8 9 import java.io.PrintStream ; 10 import java.io.PrintWriter ; 11 12 21 public class WinstoneException extends RuntimeException { 22 private Throwable nestedError = null; 23 24 31 public WinstoneException(String pMsg) { 32 super(pMsg); 33 } 34 35 44 public WinstoneException(String pMsg, Throwable pError) { 45 super(pMsg); 46 this.setNestedError(pError); 47 } 48 49 54 public Throwable getNestedError() { 55 return this.nestedError; 56 } 57 58 64 private void setNestedError(Throwable pError) { 65 this.nestedError = pError; 66 } 67 68 public void printStackTrace(PrintWriter p) { 69 if (this.nestedError != null) 70 this.nestedError.printStackTrace(p); 71 p.write("\n"); 72 super.printStackTrace(p); 73 } 74 75 public void printStackTrace(PrintStream p) { 76 if (this.nestedError != null) 77 this.nestedError.printStackTrace(p); 78 p.println("\n"); 79 super.printStackTrace(p); 80 } 81 82 public void printStackTrace() { 83 if (this.nestedError != null) 84 this.nestedError.printStackTrace(); 85 super.printStackTrace(); 86 } 87 } 88 | Popular Tags |