1 18 19 package org.objectweb.jac.util; 20 21 import java.lang.reflect.InvocationTargetException ; 22 23 24 25 31 32 public class WrappedThrowableException extends RuntimeException { 33 34 36 private Throwable wrappedThrowable; 37 38 44 public WrappedThrowableException(Throwable wrappedThrowable) { 45 if (wrappedThrowable instanceof InvocationTargetException ) { 46 this.wrappedThrowable = 47 ((InvocationTargetException )wrappedThrowable).getTargetException(); 48 } else { 49 this.wrappedThrowable = wrappedThrowable; 50 } 51 } 52 53 58 public Throwable getWrappedThrowable() { 59 return wrappedThrowable; 60 } 61 62 68 public String toString() { 69 return "WrappedThrowableException("+wrappedThrowable.toString()+")"; 70 } 71 72 78 public void printStackTrace() { 79 wrappedThrowable.printStackTrace(); 80 } 81 82 88 public void printStackTrace(java.io.PrintStream s) { 89 wrappedThrowable.printStackTrace(s); 90 } 91 92 98 public void printStackTrace(java.io.PrintWriter s) { 99 wrappedThrowable.printStackTrace(s); 100 } 101 102 108 public String getMessage() { 109 return wrappedThrowable.getMessage(); 110 } 111 112 public String getLocalizedMessage() { 113 return wrappedThrowable.getLocalizedMessage(); 114 } 115 116 public Throwable getCause() { 117 return wrappedThrowable; 118 } 119 } 120 | Popular Tags |