01: package com.ibm.webdav;
02:
03: /*
04: * (C) Copyright IBM Corp. 2000 All rights reserved.
05: *
06: * The program is provided "AS IS" without any warranty express or
07: * implied, including the warranty of non-infringement and the implied
08: * warranties of merchantibility and fitness for a particular purpose.
09: * IBM will not be liable for any damages suffered by you as a result
10: * of using the Program. In no event will IBM be liable for any
11: * special, indirect or consequential damages or lost profits even if
12: * IBM has been advised of the possibility of their occurrence. IBM
13: * will not be liable for any third party claims against you.
14: */
15:
16: /** This is the superclass of all WebDAV exceptions. It contains a status
17: * code that provides information, and a descriptive message.
18: * @author Jim Amsden <jamsden@us.ibm.com>
19: */
20: public class WebDAVException extends java.rmi.RemoteException {
21: private int statusCode = 0;
22:
23: /** Construct a WebDAVException
24: * @param statusCode the HTTP/1.1 or WebDAV status code
25: * @param statusMessage a message describing the exception of status code
26: */
27: public WebDAVException(int statusCode, String statusMessage) {
28: super (statusMessage);
29: this .statusCode = statusCode;
30: }
31:
32: /** Get the status code that provides additional information about the
33: * exception. These status codes are defined by the HTTP/1.1 and WebDAV
34: * specifications.
35: * @return the HTTP/1.1 or WebDAV status code
36: * @see com.ibm.webdav.WebDAVStatus
37: */
38: public int getStatusCode() {
39: return statusCode;
40: }
41:
42: /** Render this WebDAVException as a string including its status code.
43: * @return the string includes the status code and message
44: */
45: public String toString() {
46: return (new Integer(statusCode)).toString() + ": "
47: + getMessage();
48: }
49: }
|