1 /*
2 * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URIException.java,v 1.8 2003/01/31 00:33:36 jsdever Exp $
3 * $Revision: 1.8 $
4 * $Date: 2003/01/31 00:33:36 $
5 *
6 * ====================================================================
7 *
8 * The Apache Software License, Version 1.1
9 *
10 * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
11 * reserved.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 *
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 *
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in
22 * the documentation and/or other materials provided with the
23 * distribution.
24 *
25 * 3. The end-user documentation included with the redistribution, if
26 * any, must include the following acknowlegement:
27 * "This product includes software developed by the
28 * Apache Software Foundation (http://www.apache.org/)."
29 * Alternately, this acknowlegement may appear in the software itself,
30 * if and wherever such third-party acknowlegements normally appear.
31 *
32 * 4. The names "The Jakarta Project", "Commons", and "Apache Software
33 * Foundation" must not be used to endorse or promote products derived
34 * from this software without prior written permission. For written
35 * permission, please contact apache@apache.org.
36 *
37 * 5. Products derived from this software may not be called "Apache"
38 * nor may "Apache" appear in their names without prior written
39 * permission of the Apache Group.
40 *
41 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
42 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
43 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
44 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
45 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
46 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
47 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
48 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
49 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
51 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52 * SUCH DAMAGE.
53 * ====================================================================
54 *
55 * This software consists of voluntary contributions made by many
56 * individuals on behalf of the Apache Software Foundation. For more
57 * information on the Apache Software Foundation, please see
58 * <http://www.apache.org/>.
59 *
60 * [Additional notices, if required by prior licensing conditions]
61 *
62 */
63
64 package org.apache.commons.httpclient;
65
66 import java.io.IOException;
67
68 /***
69 * The URI parsing and escape encoding exception.
70 * <p>
71 * Why is it from IOException?
72 * To simplify the programming style for the inherited exception instances.
73 * <p>
74 *
75 * @author <a href="mailto:jericho at apache.org">Sung-Gu</a>
76 * @version $Revision: 1.8 $ $Date: 2002/03/14 15:14:01
77 */
78 public class URIException extends IOException {
79
80 // ----------------------------------------------------------- constructors
81
82 /***
83 * Default constructor.
84 */
85 public URIException() {
86 }
87
88
89 /***
90 * The constructor with a reason code argument.
91 *
92 * @param reasonCode the reason code
93 */
94 public URIException(int reasonCode) {
95 setReasonCode(reasonCode);
96 }
97
98
99 /***
100 * The constructor with a reason string and its code arguments.
101 *
102 * @param reasonCode the reason code
103 * @param reason the reason
104 */
105 public URIException(int reasonCode, String reason) {
106 super(reason); // for backward compatibility of Throwable
107 this.reason = reason;
108 setReasonCode(reasonCode);
109 }
110
111
112 /***
113 * The constructor with a reason string argument.
114 *
115 * @param reason the reason
116 */
117 public URIException(String reason) {
118 super(reason); // for backward compatibility of Throwable
119 this.reason = reason;
120 setReasonCode(UNKNOWN);
121 }
122
123 // -------------------------------------------------------------- constants
124
125 /***
126 * No specified reason code.
127 */
128 public static final int UNKNOWN = 0;
129
130
131 /***
132 * The URI parsing error.
133 */
134 public static final int PARSING = 1;
135
136
137 /***
138 * The unsupported character encoding.
139 */
140 public static final int UNSUPPORTED_ENCODING = 2;
141
142
143 /***
144 * The URI escape encoding and decoding error.
145 */
146 public static final int ESCAPING = 3;
147
148
149 /***
150 * The DNS punycode encoding or decoding error.
151 */
152 public static final int PUNYCODE = 4;
153
154 // ------------------------------------------------------------- properties
155
156 /***
157 * The reason code.
158 */
159 protected int reasonCode;
160
161
162 /***
163 * The reason message.
164 */
165 protected String reason;
166
167 // ---------------------------------------------------------------- methods
168
169 /***
170 * Get the reason code.
171 *
172 * @return the reason code
173 */
174 public int getReasonCode() {
175 return reasonCode;
176 }
177
178
179 /***
180 * Set the reason code.
181 *
182 * @param reasonCode the reason code
183 */
184 public void setReasonCode(int reasonCode) {
185 this.reasonCode = reasonCode;
186 }
187
188
189 /***
190 * Get the reason message.
191 *
192 * @return the reason message
193 */
194 public String getReason() {
195 return reason;
196 }
197
198
199 /***
200 * Set the reason message.
201 *
202 * @param reason the reason message
203 */
204 public void setReason(String reason) {
205 this.reason = reason;
206 }
207
208
209 }
210
This page was automatically generated by Maven