1 package org.sapia.util; 2 3 4 import java.io.PrintStream ; 7 import java.io.PrintWriter ; 8 9 10 22 public class CompositeRuntimeException extends RuntimeException { 23 27 28 private Throwable _theSourceError; 29 30 34 40 public CompositeRuntimeException(String aMessage, Throwable aSourceError) { 41 super(aMessage); 42 _theSourceError = aSourceError; 43 } 44 45 50 public CompositeRuntimeException(String aMessage) { 51 super(aMessage); 52 } 53 54 58 63 public Throwable getSourceError() { 64 return _theSourceError; 65 } 66 67 71 74 public void printStackTrace() { 75 printStackTrace(System.err); 76 } 77 78 81 public void printStackTrace(PrintWriter anOutput) { 82 super.printStackTrace(anOutput); 83 84 if (_theSourceError != null) { 85 anOutput.print("\n---> NESTED EXCEPTION IS: "); 86 _theSourceError.printStackTrace(anOutput); 87 } 88 } 89 90 93 public void printStackTrace(PrintStream anOutput) { 94 super.printStackTrace(anOutput); 95 96 if (_theSourceError != null) { 97 anOutput.print("\n---> NESTED EXCEPTION IS: "); 98 _theSourceError.printStackTrace(anOutput); 99 } 100 } 101 } 102 | Popular Tags |