1 25 26 27 package org.objectweb.jonathan.apis.kernel; 28 29 import java.io.PrintStream ; 30 import java.io.PrintWriter ; 31 32 38 public class JonathanException extends Exception { 39 40 Exception actual; 41 42 45 public JonathanException() { 46 super(); 47 actual = null; 48 } 49 54 public JonathanException(String s) { 55 super(s); 56 actual = null; 57 } 58 59 64 public JonathanException(Exception exception) { 65 actual = (exception instanceof JonathanException) ? 66 ((JonathanException) exception).represents() : 67 exception; 68 } 69 79 public String getMessage() { 80 return (actual != null) ? actual.getMessage() : super.getMessage(); 81 } 82 83 91 public String toString() { 92 return (actual != null) ? actual.toString() : super.toString(); 93 } 94 95 102 public void printStackTrace() { 103 if (actual != null) actual.printStackTrace(); else super.printStackTrace(); 104 } 105 106 115 public void printStackTrace(PrintStream s) { 116 if (actual != null) actual.printStackTrace(s); else super.printStackTrace(s); 117 } 118 119 128 public void printStackTrace(PrintWriter s) { 129 if (actual != null) actual.printStackTrace(s); else super.printStackTrace(s); 130 } 131 138 public Exception represents() { 139 return (actual != null) ? actual : this; 140 } 141 } 142 143 144 | Popular Tags |