1 21 22 package nu.xom.xinclude; 23 24 32 class XPointerException extends Exception { 33 34 private Throwable cause = null; 35 36 44 XPointerException(String message) { 45 super(message); 46 } 47 48 49 59 XPointerException(String message, Throwable cause) { 60 super(message); 61 initCause(cause); 62 } 63 64 65 80 public Throwable getCause() { 81 return this.cause; 82 } 83 84 85 private boolean causeSet = false; 88 89 90 108 public Throwable initCause(Throwable cause) { 109 if (causeSet) { 110 throw new IllegalStateException ("Can't overwrite cause"); 111 } 112 else if (cause == this) { 113 throw new IllegalArgumentException ("Self-causation not permitted"); 114 } 115 else this.cause = cause; 116 causeSet = true; 117 return this; 118 } 119 120 121 } 122 | Popular Tags |