1 package org.enhydra.shark.api; 2 3 import java.io.PrintStream ; 4 import java.io.PrintWriter ; 5 6 13 public class RootException extends Exception { 14 15 private Throwable cause; 16 17 21 public RootException() { 22 super(); 23 } 24 30 public RootException(String message) { 31 super(message); 32 } 33 34 41 public RootException(Throwable t) { 42 super(t.getMessage()); 43 try { 44 initCause(t); 45 } catch (Throwable e) {} 46 } 47 48 55 public RootException(String message, Throwable t) { 56 super(message); 57 try { 58 initCause(t); 59 } catch (Throwable e) {} 60 } 61 62 72 public Throwable initCause(Throwable t) throws IllegalArgumentException , IllegalStateException { 73 cause = t; 74 return this; 75 } 76 77 78 84 public Throwable getCause() { 85 return cause; 86 } 87 88 93 public void printStackTrace(PrintStream ps) { 94 if (null != cause) { 95 cause.printStackTrace(ps); 96 } 97 super.printStackTrace(ps); 98 } 99 100 105 public void printStackTrace(PrintWriter pw) { 106 if (null != cause) { 107 cause.printStackTrace(pw); 108 } 109 super.printStackTrace(pw); 110 } 111 114 public void printStackTrace() { 115 printStackTrace(System.err); 116 } 117 } 118 | Popular Tags |