1 20 package org.apache.cactus.util; 21 22 import java.io.PrintStream ; 23 import java.io.PrintWriter ; 24 25 32 public class ChainedRuntimeException extends RuntimeException 33 { 34 37 protected Throwable originalException; 38 39 45 public ChainedRuntimeException(String theMessage) 46 { 47 this(theMessage, null); 48 } 49 50 57 public ChainedRuntimeException(String theMessage, Throwable theException) 58 { 59 super(theMessage); 60 this.originalException = theException; 61 } 62 63 70 public ChainedRuntimeException(Throwable theException) 71 { 72 super(theException.getMessage()); 73 this.originalException = theException; 74 } 75 76 79 public void printStackTrace() 80 { 81 printStackTrace(System.err); 82 } 83 84 89 public void printStackTrace(PrintStream thePs) 90 { 91 super.printStackTrace(thePs); 92 93 if (this.originalException != null) 94 { 95 this.originalException.printStackTrace(thePs); 96 } 97 } 98 99 104 public void printStackTrace(PrintWriter thePw) 105 { 106 super.printStackTrace(thePw); 107 108 if (this.originalException != null) 109 { 110 this.originalException.printStackTrace(thePw); 111 } 112 } 113 } 114 | Popular Tags |