1 4 5 9 10 package org.openlaszlo.utils; 11 12 import java.io.PrintStream ; 13 14 15 public class ChainedException extends RuntimeException 16 { 17 Throwable cause = null; 18 19 23 public ChainedException(String message) { 24 super(message); 25 } 26 27 36 public ChainedException(String message, Throwable cause) { 37 super(cause.getClass().getName() + ": " + message); 38 this.cause = cause; 39 } 40 41 48 public ChainedException(Throwable cause) { 49 super(cause.getClass().getName() + ": " + cause.getMessage()); 50 this.cause = cause; 51 } 52 53 60 public Throwable getCause() { 61 return this.cause; 62 } 63 64 68 public void printStackTrace(PrintStream s) { 69 super.printStackTrace(s); 70 if (cause != null) { 71 s.print("Caused by: "); 72 cause.printStackTrace(s); 73 } 74 } 75 76 80 public void printStackTrace(java.io.PrintWriter pw) { 81 super.printStackTrace(pw); 82 if (cause != null) { 83 pw.println("Caused by:"); 84 cause.printStackTrace(pw); 85 } 86 } 87 } 88 | Popular Tags |