KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > rpc > ServiceException


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.ServiceException</code> is thrown from the
20  * methods in the <code>javax.xml.rpc.Service</code> interface and
21  * <code>ServiceFactory</code> class.
22  *
23  *
24  * @version 1.0
25  */

26 public class ServiceException extends Exception JavaDoc {
27     
28     // fixme: could we refactor this to use the jdk1.4 exception wrapping stuff?
29

30     /** The cause of this exception. */
31     Throwable JavaDoc cause;
32     
33     /**
34      * Constructs a new exception with <code>null</code> as its
35      * detail message. The cause is not initialized.
36      */

37     public ServiceException() {}
38     
39     /**
40      * Constructs a new exception with the specified detail
41      * message. The cause is not initialized.
42      *
43      * @param message The detail message which is later
44      * retrieved using the <code>getMessage</code> method
45      */

46     public ServiceException(String JavaDoc message) {
47         super(message);
48     }
49     
50     /**
51      * Constructs a new exception with the specified detail
52      * message and cause.
53      *
54      * @param message the detail message which is later retrieved
55      * using the <code>getMessage</code> method
56      * @param cause the cause which is saved for the later
57      * retrieval throw by the <code>getCause</code>
58      * method
59      */

60     public ServiceException(String JavaDoc message, Throwable JavaDoc cause) {
61         super(message);
62         this.cause = cause;
63     }
64     
65     /**
66      * Constructs a new exception with the specified cause
67      * and a detail message of <tt>(cause==null ? null :
68      * cause.toString())</tt> (which typically contains the
69      * class and detail message of <tt>cause</tt>).
70      *
71      * @param cause the cause which is saved for the later
72      * retrieval throw by the getCause method.
73      * (A <tt>null</tt> value is permitted, and
74      * indicates that the cause is nonexistent or
75      * unknown.)
76      */

77     public ServiceException(Throwable JavaDoc cause) {
78         super( (cause == null) ? null : cause.toString() );
79         this.cause = cause;
80     }
81     
82     /**
83      * Gets the linked cause.
84      *
85      * @return the cause of this Exception or <code>null</code>
86      * if the cause is noexistent or unknown
87      */

88     public Throwable JavaDoc getLinkedCause() {
89         return cause;
90     }
91     
92 }
93
Popular Tags