1 20 package org.apache.cactus.util; 21 22 import java.io.PrintStream ; 23 import java.io.PrintWriter ; 24 25 30 public class ChainedException extends Exception 31 { 32 35 protected Throwable originalException; 36 37 43 public ChainedException(String theMessage) 44 { 45 this(theMessage, null); 46 } 47 48 55 public ChainedException(String theMessage, Throwable theException) 56 { 57 super(theMessage); 58 this.originalException = theException; 59 } 60 61 68 public ChainedException(Throwable theException) 69 { 70 super(theException.getMessage()); 71 this.originalException = theException; 72 } 73 74 77 public void printStackTrace() 78 { 79 printStackTrace(System.err); 80 } 81 82 87 public void printStackTrace(PrintStream thePs) 88 { 89 super.printStackTrace(thePs); 90 91 if (this.originalException != null) 92 { 93 this.originalException.printStackTrace(thePs); 94 } 95 } 96 97 102 public void printStackTrace(PrintWriter thePw) 103 { 104 super.printStackTrace(thePw); 105 106 if (this.originalException != null) 107 { 108 this.originalException.printStackTrace(thePw); 109 } 110 } 111 } 112 | Popular Tags |