1 18 package org.objectweb.kilim; 19 20 import java.io.PrintStream ; 21 import java.io.PrintWriter ; 22 23 30 public class KilimException extends Exception { 31 private Exception actual; 32 33 36 public KilimException() { 37 super(); 38 actual = null; 39 } 40 44 public KilimException(String s) { 45 super(s); 46 actual = null; 47 } 48 49 53 public KilimException(Exception exception) { 54 actual = (exception instanceof KilimException) ? ((KilimException) exception).represents() : exception; 55 } 56 66 public String getMessage() { 67 return (actual != null) ? actual.getMessage() : super.getMessage(); 68 } 69 70 78 public String toString() { 79 return (actual != null) ? actual.toString() : super.toString(); 80 } 81 82 89 public void printStackTrace() { 90 if (actual != null) { 91 actual.printStackTrace(); 92 } else { 93 super.printStackTrace(); 94 } 95 } 96 97 106 public void printStackTrace(PrintStream s) { 107 if (actual != null) { 108 actual.printStackTrace(s); 109 } else { 110 super.printStackTrace(s); 111 } 112 } 113 114 123 public void printStackTrace(PrintWriter s) { 124 if (actual != null) { 125 actual.printStackTrace(s); 126 } else { 127 super.printStackTrace(s); 128 } 129 } 130 137 public Exception represents() { 138 return (actual != null) ? actual : this; 139 } 140 141 private Exception encapsulated; 142 } 143 | Popular Tags |