1 25 26 27 package org.objectweb.jonathan.apis.kernel; 28 29 import java.io.PrintStream ; 30 import java.io.PrintWriter ; 31 32 36 public class InternalException extends RuntimeException { 37 38 Throwable actual; 39 40 43 public InternalException() {} 44 49 public InternalException(String s) { super(s); } 50 51 56 public InternalException(Throwable throwable) { 57 actual = (throwable instanceof InternalException) ? 58 ((InternalException) throwable).represents() : 59 ((throwable instanceof JonathanException) ? 60 ((JonathanException) throwable).represents() : 61 throwable); 62 } 63 64 74 public String getMessage() { 75 return (actual != null) ? actual.getMessage() : super.getMessage(); 76 } 77 78 86 public String toString() { 87 return (actual != null) ? actual.toString() : super.toString(); 88 } 89 90 97 public void printStackTrace() { 98 if (actual != null) actual.printStackTrace(); else super.printStackTrace(); 99 } 100 101 110 public void printStackTrace(PrintStream s) { 111 if (actual != null) actual.printStackTrace(s); else super.printStackTrace(s); 112 } 113 114 123 public void printStackTrace(PrintWriter s) { 124 if (actual != null) actual.printStackTrace(s); else super.printStackTrace(s); 125 } 126 133 public Throwable represents() { 134 return (actual != null) ? actual : this; 135 } 136 } 137 138 139 | Popular Tags |