1 6 7 28 package javax.xml.soap; 29 30 45 public class SOAPException extends Exception { 46 private Throwable cause; 47 48 52 public SOAPException() { 53 super(); 54 this.cause = null; 55 } 56 57 63 public SOAPException(String reason) { 64 super(reason); 65 this.cause = null; 66 } 67 68 78 public SOAPException(String reason, Throwable cause) { 79 super(reason); 80 initCause(cause); 81 } 82 83 87 public SOAPException(Throwable cause) { 88 super(cause.toString()); 89 initCause(cause); 90 } 91 92 106 public String getMessage() { 107 String message = super.getMessage(); 108 if (message == null && cause != null) { 109 return cause.getMessage(); 110 } else { 111 return message; 112 } 113 } 114 115 123 124 public Throwable getCause() { 125 return cause; 126 } 127 128 154 public synchronized Throwable initCause(Throwable cause) { 155 if (this.cause != null) { 156 throw new IllegalStateException ("Can't override cause"); 157 } 158 if (cause == this) { 159 throw new IllegalArgumentException ("Self-causation not permitted"); 160 } 161 this.cause = cause; 162 163 return this; 164 } 165 } 166 | Popular Tags |