KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xmlrpc > XmlRpcException


1 /*
2  * Copyright 1999,2005 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
17
18 package org.apache.xmlrpc;
19
20 /**
21  * This is thrown by the XmlRpcClient if the remote server reported an error.
22  * If something went wrong at a lower level (e.g. no http connection) an
23  * IOException will be thrown instead.
24  *
25  * @author <a HREF="mailto:hannes@apache.org">Hannes Wallnoefer</a>
26  * @version $Id: XmlRpcException.java,v 1.4 2005/05/02 04:22:21 dlr Exp $
27  */

28 public class XmlRpcException extends Exception JavaDoc
29 {
30     /**
31      * The fault code of the exception. For servers based on this library, this
32      * will always be 0. (If there are predefined error codes, they should be in
33      * the XML-RPC spec.)
34      */

35     public final int code;
36
37     /**
38      * The underlying cause of this exception.
39      */

40     private Throwable JavaDoc cause;
41
42     /**
43      * @see #XmlRpcException(int, String, Throwable)
44      */

45     public XmlRpcException(int code, String JavaDoc message)
46     {
47         this(code, message, null);
48     }
49
50     /**
51      * Creates an instance with the specified message and root cause
52      * exception.
53      *
54      * @param int The fault code for this problem.
55      * @param message The message describing this exception.
56      * @param cause The root cause of this exception.
57      */

58     public XmlRpcException(int code, String JavaDoc message, Throwable JavaDoc cause)
59     {
60         super(message);
61         this.code = code;
62         this.cause = cause;
63     }
64
65     /**
66      * Returns the cause of this throwable or null if the cause is nonexistent
67      * or unknown. (The cause is the throwable that caused this throwable to
68      * get thrown.)
69      *
70      * This implementation returns the cause that was supplied via the constructor,
71      * according to the rules specified for a "legacy chained throwable" that
72      * predates the addition of chained exceptions to Throwable.
73      *
74      * See the <a
75      * HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Throwable.html">JDK
76      * 1.4 Throwable documentation</a> for more information.
77      */

78     public Throwable JavaDoc getCause()
79     {
80         return cause;
81     }
82 }
83
Popular Tags