1 21 22 package nu.xom.xinclude; 23 24 33 public class XIncludeException extends Exception { 34 35 36 private String uri; 37 38 46 public XIncludeException(String message) { 47 super(message); 48 } 49 50 51 63 public XIncludeException(String message, Throwable cause) { 64 super(message); 65 initCause(cause); 66 } 67 68 69 79 public XIncludeException(String message, String uri) { 80 super(message); 81 this.uri = uri; 82 } 83 84 85 93 public String getURI() { 94 return this.uri; 95 } 96 97 98 private Throwable cause; 99 100 101 116 public Throwable getCause() { 117 return this.cause; 118 } 119 120 121 private boolean causeSet = false; 124 125 126 144 public Throwable initCause(Throwable cause) { 145 if (causeSet) { 146 throw new IllegalStateException ("Can't overwrite cause"); 147 } 148 else if (cause == this) { 149 throw new IllegalArgumentException ("Self-causation not permitted"); 150 } 151 else this.cause = cause; 152 causeSet = true; 153 return this; 154 } 155 156 157 } | Popular Tags |