124 public Throwable getCause() {
125 return cause;
126 }
127
128 /**
129 * Initializes the {@code cause} field of this {@code SOAPException}
130 * object with the given {@code Throwable} object.
131 * <P>
132 * This method can be called at most once. It is generally called from
133 * within the constructor or immediately after the constructor has
134 * returned a new {@code SOAPException} object.
135 * If this {@code SOAPException} object was created with the
136 * constructor {@link #SOAPException(Throwable)} or
137 * {@link #SOAPException(String,Throwable)}, meaning that its
138 * {@code cause} field already has a value, this method cannot be
139 * called even once.
140 *
141 * @param cause the {@code Throwable} object that caused this
142 * {@code SOAPException} object to be thrown. The value of this
143 * parameter is saved for later retrieval by the
144 * {@link #getCause()} method. A <tt>null</tt> value is
145 * permitted and indicates that the cause is nonexistent or
146 * unknown.
147 * @return a reference to this {@code SOAPException} instance
148 * @throws IllegalArgumentException if {@code cause} is this
149 * {@code Throwable} object. (A {@code Throwable} object
150 * cannot be its own cause.)
151 * @throws IllegalStateException if the cause for this {@code SOAPException} object
152 * has already been initialized
153 */
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 }
|
124 public Throwable getCause() {
125 return cause;
126 }
127
128 /**
129 * Initializes the {@code cause} field of this {@code SOAPException}
130 * object with the given {@code Throwable} object.
131 * <P>
132 * This method can be called at most once. It is generally called from
133 * within the constructor or immediately after the constructor has
134 * returned a new {@code SOAPException} object.
135 * If this {@code SOAPException} object was created with the
136 * constructor {@link #SOAPException(Throwable)} or
137 * {@link #SOAPException(String,Throwable)}, meaning that its
138 * {@code cause} field already has a value, this method cannot be
139 * called even once.
140 *
141 * @param cause the {@code Throwable} object that caused this
142 * {@code SOAPException} object to be thrown. The value of this
143 * parameter is saved for later retrieval by the
144 * {@link #getCause()} method. A {@code null} value is
145 * permitted and indicates that the cause is nonexistent or
146 * unknown.
147 * @return a reference to this {@code SOAPException} instance
148 * @throws IllegalArgumentException if {@code cause} is this
149 * {@code Throwable} object. (A {@code Throwable} object
150 * cannot be its own cause.)
151 * @throws IllegalStateException if the cause for this {@code SOAPException} object
152 * has already been initialized
153 */
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 }
|