1 25 26 27 package org.objectweb.kilim; 28 29 import java.io.PrintStream ; 30 import java.io.PrintWriter ; 31 32 38 public class InternalException extends RuntimeException { 39 private Throwable actual; 40 41 44 public InternalException() { } 45 46 50 public InternalException(String s) { super(s); } 51 52 56 public InternalException(Throwable throwable) { 57 actual = (throwable instanceof InternalException) ? ((InternalException) throwable).represents() : ((throwable instanceof KilimException) 58 ? ((KilimException) throwable).represents() : throwable); 59 } 60 61 71 public String getMessage() { 72 return (actual != null) ? actual.getMessage() : super.getMessage(); 73 } 74 75 83 public String toString() { 84 return (actual != null) ? actual.toString() : super.toString(); 85 } 86 87 94 public void printStackTrace() { 95 if (actual != null) { 96 actual.printStackTrace(); 97 } else { 98 super.printStackTrace(); 99 } 100 } 101 102 111 public void printStackTrace(PrintStream s) { 112 if (actual != null) { 113 actual.printStackTrace(s); 114 } else { 115 super.printStackTrace(s); 116 } 117 } 118 119 125 public void printStackTrace(PrintWriter s) { 126 if (actual != null) { 127 actual.printStackTrace(s); 128 } else { 129 super.printStackTrace(s); 130 } 131 } 132 137 public Throwable represents() { 138 return (actual != null) ? actual : this; 139 } 140 } 141 142 143 | Popular Tags |