1 21 22 package nu.xom.xslt; 23 24 33 public class XSLException extends Exception { 34 35 36 private Throwable cause; 37 38 39 48 public XSLException(String message, Throwable cause) { 49 super(message); 50 this.initCause(cause); 51 } 52 53 54 62 public XSLException(String message) { 63 super(message); 64 } 65 66 67 private boolean causeSet = false; 70 71 92 public Throwable initCause(Throwable cause) { 93 94 if (causeSet) { 95 throw new IllegalStateException ("Can't overwrite cause"); 96 } 97 else if (cause == this) { 98 throw new IllegalArgumentException ( 99 "Self-causation not permitted"); 100 } 101 else this.cause = cause; 102 causeSet = true; 103 return this; 104 105 } 106 107 108 116 public Throwable getCause() { 117 return this.cause; 118 } 119 120 121 } 122 | Popular Tags |