1 /*
2 * Copyright 2001-2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package javax.xml.rpc;
17
18 /**
19 * The <code>javax.xml.rpc.JAXRPCException</code> is thrown from
20 * the core JAX-RPC APIs to indicate an exception related to the
21 * JAX-RPC runtime mechanisms.
22 *
23 * @version 1.0
24 */
25 public class JAXRPCException extends RuntimeException {
26
27 // fixme: Why doesn't this use the jdk1.4 exception wrapping APIs?
28
29 /** The cause of this error. */
30 Throwable cause;
31
32 /**
33 * Constructs a new exception with <code>null</code> as its
34 * detail message. The cause is not initialized.
35 */
36 public JAXRPCException() {}
37
38 /**
39 * Constructs a new exception with the specified detail
40 * message. The cause is not initialized.
41 *
42 * @param message The detail message which is later
43 * retrieved using the getMessage method
44 */
45 public JAXRPCException(String message) {
46 super(message);
47 }
48
49 /**
50 * Constructs a new exception with the specified detail
51 * message and cause.
52 *
53 * @param message The detail message which is later retrieved
54 * using the getMessage method
55 * @param cause The cause which is saved for the later
56 * retrieval throw by the getCause method
57 */
58 public JAXRPCException(String message, Throwable cause) {
59 super(message);
60 this.cause = cause;
61 }
62
63 /**
64 * Constructs a new JAXRPCException with the specified cause
65 * and a detail message of <tt>(cause==null ? null :
66 * cause.toString())</tt> (which typically contains the
67 * class and detail message of <tt>cause</tt>).
68 *
69 * @param cause The cause which is saved for the later
70 * retrieval throw by the getCause method.
71 * (A <tt>null</tt> value is permitted, and
72 * indicates that the cause is nonexistent or
73 * unknown.)
74 */
75 public JAXRPCException(Throwable cause) {
76 super( (cause == null) ? null : cause.toString() );
77 this.cause = cause;
78 }
79
80 /**
81 * Gets the linked cause.
82 *
83 * @return The cause of this Exception or <code>null</code>
84 * if the cause is noexistent or unknown
85 */
86 public Throwable getLinkedCause() {
87 return cause;
88 }
89
90 }