-x: Internal use
@@ -85,7 +83,7 @@
* @author Unascribed
* @version $Revision: 1.13 $ $Date: 2003/01/28 04:40:20 $
*/
-public class HttpException extends URIException {
+public class HttpException extends IOException {
/**
* Creates a new HttpException.
Index: src/java/org/apache/commons/httpclient/HttpInterruptedException.java
===================================================================
RCS file: src/java/org/apache/commons/httpclient/HttpInterruptedException.java
diff -N src/java/org/apache/commons/httpclient/HttpInterruptedException.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/java/org/apache/commons/httpclient/HttpInterruptedException.java 13 Jul 2003 02:58:27 -0000
@@ -0,0 +1,100 @@
+/*
+ * $Header: $
+ * $Revision: $
+ * $Date: $
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ *
+ */
+package org.apache.commons.httpclient;
+
+/**
+ * An Http method was interrupted by the client.
+ *
+ * TODO: Rename this to HttpAbortedException or TransportInterruptedException?
+ *
+ * @author Laura Werner
+ */
+public class HttpInterruptedException extends HttpTransportException {
+
+ /**
+ * Crates a new HttpInterruptedException with no message or wrapped exception.
+ */
+ public HttpInterruptedException() {
+ super();
+ }
+
+ /**
+ * Creates a new HttpInterruptedException with a specified message.
+ *
+ * @param message The exception message
+ */
+ public HttpInterruptedException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new HttpInterruptedException that wraps another exception
+ * specifying the cause of the interrupt.
+ *
+ * @param cause The exception that caused the interrupt of the HTTP method,
+ * or null if the cause is unknown or unavailable.
+ * @param message The exception message
+ */
+ public HttpInterruptedException(Throwable cause, String message) {
+ super(cause, message);
+ }
+
+}
Index: src/java/org/apache/commons/httpclient/HttpMethodBase.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
retrieving revision 1.164
diff -u -r1.164 HttpMethodBase.java
--- src/java/org/apache/commons/httpclient/HttpMethodBase.java 11 Jul 2003 01:07:29 -0000 1.164
+++ src/java/org/apache/commons/httpclient/HttpMethodBase.java 13 Jul 2003 02:58:33 -0000
@@ -984,10 +984,10 @@
throw new NullPointerException("HttpConnection parameter");
}
if (hasBeenUsed()) {
- throw new HttpException("Already used, but not recycled.");
+ throw new IllegalStateException("Already used, but not recycled.");
}
if (!validate()) {
- throw new HttpException("Not valid");
+ throw new HttpProtocolException("HttpMethodBase object not valid");
}
if (inExecute) {
throw new IllegalStateException("Execute invoked recursively, or exited abnormally.");
@@ -1204,7 +1204,7 @@
String oldProtocol = currentUri.getScheme();
String newProtocol = redirectUri.getScheme();
if (!oldProtocol.equals(newProtocol)) {
- throw new HttpException("Redirect from protocol " + oldProtocol
+ throw new HttpProtocolException("Redirect from protocol " + oldProtocol
+ " to " + newProtocol + " is not supported");
}
@@ -1212,12 +1212,13 @@
String oldHost = currentUri.getHost();
String newHost = redirectUri.getHost();
if (!oldHost.equalsIgnoreCase(newHost)) {
- throw new HttpException("Redirect from host " + oldHost
+ // TODO: Add an HttpNotImplementedException or some such?
+ throw new HttpProtocolException("Redirect from host " + oldHost
+ " to " + newHost + " is not supported");
}
} catch (URIException e) {
LOG.warn("Error getting URI host", e);
- throw new HttpException("Invalid Redirect URI from: "
+ throw new HttpProtocolException("Invalid Redirect URI from: "
+ currentUri.getEscapedURI() + " to: " + redirectUri.getEscapedURI()
);
}
@@ -1231,7 +1232,7 @@
newPort = getDefaultPort(newProtocol);
}
if (oldPort != newPort) {
- throw new HttpException("Redirect from port " + oldPort
+ throw new HttpProtocolException("Redirect from port " + oldPort
+ " to " + newPort + " is not supported");
}
}
@@ -2064,7 +2065,7 @@
result = new ChunkedInputStream(is, this);
} else {
if (isStrictMode()) {
- throw new HttpException("Chunk-encoded body declared but not sent");
+ throw new HttpProtocolException("Chunk-encoded body declared but not sent");
} else {
LOG.warn("Chunk-encoded body missing");
}
@@ -2204,7 +2205,7 @@
// some servers do not specify the version correctly, we will just assume 1.0
http11 = false;
} else {
- throw new HttpException("Unrecognized server protocol: '"
+ throw new HttpProtocolException("Unrecognized server protocol: '"
+ httpVersion + "'");
}
Index: src/java/org/apache/commons/httpclient/HttpParser.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpParser.java,v
retrieving revision 1.7
diff -u -r1.7 HttpParser.java
--- src/java/org/apache/commons/httpclient/HttpParser.java 26 May 2003 21:51:37 -0000 1.7
+++ src/java/org/apache/commons/httpclient/HttpParser.java 13 Jul 2003 02:58:33 -0000
@@ -195,7 +195,7 @@
// Parse the header name and value
int colon = line.indexOf(":");
if (colon < 0) {
- throw new HttpException("Unable to parse header: " + line);
+ throw new HttpProtocolException("Unable to parse header: " + line);
}
name = line.substring(0, colon).trim();
value = new StringBuffer(line.substring(colon + 1).trim());
Index: src/java/org/apache/commons/httpclient/HttpProtocolException.java
===================================================================
RCS file: src/java/org/apache/commons/httpclient/HttpProtocolException.java
diff -N src/java/org/apache/commons/httpclient/HttpProtocolException.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/java/org/apache/commons/httpclient/HttpProtocolException.java 13 Jul 2003 02:58:33 -0000
@@ -0,0 +1,85 @@
+/*
+ * $Header: $
+ * $Revision: $
+ * $Date: $
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ *
+ */
+package org.apache.commons.httpclient;
+
+/**
+ * Signals that an HTTP protocol violation has occurred. For example, HttpClient
+ * detected a malformed status line or headers, a missing message body, etc.
+ *
+ * @author Laura Werner
+ */
+public class HttpProtocolException extends HttpException {
+ /**
+ * Creates a new HttpProtocolException with an empty message string.
+ */
+ public HttpProtocolException() {
+ super();
+ }
+
+ /**
+ * Creates a new HttpProtocolException with the specified message.
+ *
+ * @param message The exception message
+ */
+ public HttpProtocolException(String message) {
+ super(message);
+ }
+}
Index: src/java/org/apache/commons/httpclient/HttpRecoverableException.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpRecoverableException.java,v
retrieving revision 1.7
diff -u -r1.7 HttpRecoverableException.java
--- src/java/org/apache/commons/httpclient/HttpRecoverableException.java 28 Jan 2003 22:25:21 -0000 1.7
+++ src/java/org/apache/commons/httpclient/HttpRecoverableException.java 13 Jul 2003 02:58:34 -0000
@@ -67,12 +67,13 @@
*
* Signals that an HTTP or HttpClient exception has occurred. This
* exception may have been caused by a transient error and the request
- * may be retried.
+ * may be retried. It may be possible to retrieve the underlying transient
+ * error via the inherited {@link HttpTransportException#getCause()} method.
*
* @author Unascribed
* @version $Revision: 1.7 $ $Date: 2003/01/28 22:25:21 $
*/
-public class HttpRecoverableException extends HttpException {
+public class HttpRecoverableException extends HttpTransportException {
/**
* Creates a new HttpRecoverableException.
@@ -82,12 +83,23 @@
}
/**
- * Creates a new HttpRecoverableException with the
- * specified message.
+ * Creates a new HttpRecoverableException with the specified message.
*
* @param message exception message
*/
public HttpRecoverableException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new HttpRecoverableException that wraps the lower-level error
+ * that caused this recoverable error.
+ *
+ * @param cause The transient, lower-level error that caused this exception,
+ * or null if the cause is unavailable or unknown.
+ * @param message exception message
+ */
+ public HttpRecoverableException(Throwable cause, String message) {
super(message);
}
}
Index: src/java/org/apache/commons/httpclient/HttpTimeoutException.java
===================================================================
RCS file: src/java/org/apache/commons/httpclient/HttpTimeoutException.java
diff -N src/java/org/apache/commons/httpclient/HttpTimeoutException.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/java/org/apache/commons/httpclient/HttpTimeoutException.java 13 Jul 2003 02:58:34 -0000
@@ -0,0 +1,100 @@
+/*
+ * $Header: $
+ * $Revision: $
+ * $Date: $
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ *
+ */
+package org.apache.commons.httpclient;
+
+/**
+ * A timeout while processing an HTTP request: for example a network
+ * timeout or a timeout while waiting for an HttpConnection to become
+ * available.
+ *
+ * @author Laura Werner
+ */
+public class HttpTimeoutException extends HttpRecoverableException {
+
+ /**
+ * Creates a new HttpTimeoutException with the specified message.
+ */
+ public HttpTimeoutException() {
+ super();
+ }
+
+ /**
+ * Creates a new HttpTimeoutException with the specified message.
+ *
+ * @param message The exception message
+ */
+ public HttpTimeoutException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new HttpTimeoutException that wraps the lower-level error
+ * that caused the timeout.
+ *
+ * @param cause The transient, lower-level error that caused this exception,
+ * or null if the cause is unavailable or unknown.
+ * @param message exception message
+ */
+ public HttpTimeoutException(Throwable cause, String message) {
+ super(message);
+ }
+
+}
Index: src/java/org/apache/commons/httpclient/HttpTransportException.java
===================================================================
RCS file: src/java/org/apache/commons/httpclient/HttpTransportException.java
diff -N src/java/org/apache/commons/httpclient/HttpTransportException.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/java/org/apache/commons/httpclient/HttpTransportException.java 13 Jul 2003 02:58:34 -0000
@@ -0,0 +1,117 @@
+/*
+ * $Header: $
+ * $Revision: $
+ * $Date: $
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ *
+ */
+package org.apache.commons.httpclient;
+
+/**
+ * Signals that an error has occurred in the transport layer beneath HTTP.
+ * This includes network I/O errors and timeouts, connection timeouts, etc.
+ * If the is caused by an error in a lower layer,
+ * the HttpTransportException should "wrap" the exception describing the original
+ * error. The wrapped exception, if any, can be accessed via the {@link #getCause()}
+ * method.
+ *
+ * @author Laura Werner
+ */
+public class HttpTransportException extends HttpException {
+ /**
+ * Creates a new HttpTransportException with no message.
+ */
+ public HttpTransportException() {
+ super();
+ this.cause = null;
+ }
+
+ /**
+ * Creates a new HttpProtocolException with the specified message.
+ *
+ * @param message The exception message
+ */
+ public HttpTransportException(String message) {
+ super(message);
+ this.cause = null;
+ }
+
+ /**
+ * Creates a new HttpProtocolException that wraps another exception that
+ * is the original cause of the error.
+ *
+ * @param cause The transient, lower-level error that caused this exception,
+ * or null if the cause is unavailable or unknown.
+ * @param message The exception message
+ */
+ public HttpTransportException(Throwable cause, String message) {
+ super(message);
+ this.cause = cause;
+ }
+
+ /**
+ * Return the lower-level exception that caused this transport error, if any.
+ *
+ * @return The exception that caused this transport error, or null if there
+ * is no underlying exception.
+ */
+ public Throwable getCause() {
+ return cause;
+ }
+
+ /** The original exception representing the cause of this transport error */
+ private final Throwable cause;
+}
Index: src/java/org/apache/commons/httpclient/IOTimeoutException.java
===================================================================
RCS file: src/java/org/apache/commons/httpclient/IOTimeoutException.java
diff -N src/java/org/apache/commons/httpclient/IOTimeoutException.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/java/org/apache/commons/httpclient/IOTimeoutException.java 13 Jul 2003 02:58:35 -0000
@@ -0,0 +1,98 @@
+/*
+ * $Header: $
+ * $Revision: $
+ * $Date: $
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ *
+ */
+package org.apache.commons.httpclient;
+
+/**
+ * A I/O or network timeout while communicating with an HTTP server.
+ *
+ * @author Laura Werner
+ */
+public class IOTimeoutException extends HttpTimeoutException {
+
+ /**
+ * Creates a ConnectTimeoutException.
+ */
+ public IOTimeoutException() {
+ super();
+ }
+
+ /**
+ * Creates a ConnectTimeoutException with a specified message.
+ *
+ * @param message The exception message
+ */
+ public IOTimeoutException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new ConnectTimeoutException that wraps another exception that
+ * is the original cause of the error.
+ *
+ * @param cause The lower-level error that caused this exception,
+ * or null if the cause is unavailable or unknown.
+ * @param message The exception message
+ */
+ public IOTimeoutException(Throwable cause, String message) {
+ super(cause, message);
+ }
+
+}
Index: src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
retrieving revision 1.18
diff -u -r1.18 MultiThreadedHttpConnectionManager.java
--- src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java 5 Jul 2003 22:31:20 -0000 1.18
+++ src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java 13 Jul 2003 02:58:37 -0000
@@ -285,7 +285,7 @@
try {
if (useTimeout && timeToWait <= 0) {
- throw new HttpException("Timeout waiting for connection");
+ throw new ConnectTimeoutException("Timeout waiting for connection");
}
if (LOG.isDebugEnabled()) {
Index: src/java/org/apache/commons/httpclient/StatusLine.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/StatusLine.java,v
retrieving revision 1.9
diff -u -r1.9 StatusLine.java
--- src/java/org/apache/commons/httpclient/StatusLine.java 1 Apr 2003 00:25:24 -0000 1.9
+++ src/java/org/apache/commons/httpclient/StatusLine.java 13 Jul 2003 02:58:37 -0000
@@ -122,14 +122,14 @@
//check validity of the Status-Line
if (!statusLine.startsWith("HTTP")) {
- throw new HttpException("Status-Line '" + statusLine
+ throw new HttpProtocolException("Status-Line '" + statusLine
+ "' does not start with HTTP");
}
//handle the HTTP-Version
int at = statusLine.indexOf(" ");
if (at <= 0) {
- throw new HttpException(
+ throw new HttpProtocolException(
"Unable to parse HTTP-Version from the status line: '"
+ statusLine + "'");
}
@@ -148,7 +148,7 @@
try {
this.statusCode = Integer.parseInt(statusLine.substring(at, to));
} catch (NumberFormatException e) {
- throw new HttpException(
+ throw new HttpProtocolException(
"Unable to parse status code from status line: '"
+ statusLine + "'");
}
@@ -162,7 +162,7 @@
this.reasonPhrase = "";
}
} catch (StringIndexOutOfBoundsException e) {
- throw new HttpException("Status text not specified: '"
+ throw new HttpProtocolException("Status text not specified: '"
+ statusLine + "'");
}
}
Index: src/java/org/apache/commons/httpclient/auth/AuthenticationException.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/AuthenticationException.java,v
retrieving revision 1.2
diff -u -r1.2 AuthenticationException.java
--- src/java/org/apache/commons/httpclient/auth/AuthenticationException.java 6 Apr 2003 22:31:53 -0000 1.2
+++ src/java/org/apache/commons/httpclient/auth/AuthenticationException.java 13 Jul 2003 02:58:38 -0000
@@ -63,7 +63,7 @@
package org.apache.commons.httpclient.auth;
-import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpProtocolException;
/**
* Signals a failure in authentication process
@@ -72,7 +72,7 @@
*
* @since 2.0
*/
-public class AuthenticationException extends HttpException {
+public class AuthenticationException extends HttpProtocolException {
/**
* @see HttpException#HttpException()
Index: src/java/org/apache/commons/httpclient/auth/MalformedChallengeException.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/MalformedChallengeException.java,v
retrieving revision 1.2
diff -u -r1.2 MalformedChallengeException.java
--- src/java/org/apache/commons/httpclient/auth/MalformedChallengeException.java 6 Apr 2003 22:31:53 -0000 1.2
+++ src/java/org/apache/commons/httpclient/auth/MalformedChallengeException.java 13 Jul 2003 02:58:38 -0000
@@ -63,7 +63,7 @@
package org.apache.commons.httpclient.auth;
-import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpProtocolException;
/**
* Signals that authentication challenge is in some way invalid or
@@ -73,7 +73,7 @@
*
* @since 2.0
*/
-public class MalformedChallengeException extends HttpException {
+public class MalformedChallengeException extends HttpProtocolException {
/**
* @see HttpException#HttpException()
Index: src/java/org/apache/commons/httpclient/auth/NTLM.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/NTLM.java,v
retrieving revision 1.1
diff -u -r1.1 NTLM.java
--- src/java/org/apache/commons/httpclient/auth/NTLM.java 5 Jul 2003 22:48:19 -0000 1.1
+++ src/java/org/apache/commons/httpclient/auth/NTLM.java 13 Jul 2003 02:58:39 -0000
@@ -173,11 +173,11 @@
ecipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "DES"));
return ecipher;
} catch (NoSuchAlgorithmException e) {
- throw new HttpException("DES encryption is not available.");
+ throw new AuthenticationException("DES encryption is not available.");
} catch (InvalidKeyException e) {
- throw new HttpException("Invalid key for DES encryption.");
+ throw new AuthenticationException("Invalid key for DES encryption.");
} catch (NoSuchPaddingException e) {
- throw new HttpException(
+ throw new AuthenticationException(
"NoPadding option for DES is not available.");
}
}
@@ -224,9 +224,10 @@
byte[] enc = ecipher.doFinal(bytes);
return enc;
} catch (IllegalBlockSizeException e) {
- throw new HttpException("Invalid block size for DES encryption.");
+ // TODO: It would be nice to be able to wrap the IllegalBlockSizeException
+ throw new AuthenticationException("Invalid block size for DES encryption.");
} catch (BadPaddingException e) {
- throw new HttpException(
+ throw new AuthenticationException(
"Data not padded correctly for DES encryption.");
}
}
Index: src/java/org/apache/commons/httpclient/cookie/MalformedCookieException.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/cookie/MalformedCookieException.java,v
retrieving revision 1.4
diff -u -r1.4 MalformedCookieException.java
--- src/java/org/apache/commons/httpclient/cookie/MalformedCookieException.java 27 Jan 2003 15:25:47 -0000 1.4
+++ src/java/org/apache/commons/httpclient/cookie/MalformedCookieException.java 13 Jul 2003 02:58:40 -0000
@@ -63,7 +63,7 @@
package org.apache.commons.httpclient.cookie;
-import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpProtocolException;
/**
* Signals that a cookie is in some way invalid or illegal in a given
@@ -73,7 +73,7 @@
*
* @since 2.0
*/
-public class MalformedCookieException extends HttpException {
+public class MalformedCookieException extends HttpProtocolException {
/**
* @see HttpException#HttpException()
Index: src/java/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java,v
retrieving revision 1.19
diff -u -r1.19 EntityEnclosingMethod.java
--- src/java/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java 5 Jul 2003 18:43:04 -0000 1.19
+++ src/java/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java 13 Jul 2003 02:58:41 -0000
@@ -74,6 +74,7 @@
import org.apache.commons.httpclient.HttpConnection;
import org.apache.commons.httpclient.HttpConstants;
import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpProtocolException;
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -406,7 +407,7 @@
int contentLength = getRequestContentLength();
if ((contentLength == CONTENT_LENGTH_CHUNKED) && !isHttp11()) {
- throw new HttpException(
+ throw new HttpProtocolException(
"Chunked transfer encoding not allowed for HTTP/1.0");
}
@@ -430,7 +431,8 @@
}
if ((this.repeatCount > 0) && (this.contentCache == null)) {
- throw new HttpException(
+ // TODO: Is this the right exception to throw here?
+ throw new HttpProtocolException(
"Unbuffered entity enclosing request can not be repeated.");
}
Index: src/java/org/apache/commons/httpclient/methods/HeadMethod.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMethod.java,v
retrieving revision 1.19
diff -u -r1.19 HeadMethod.java
--- src/java/org/apache/commons/httpclient/methods/HeadMethod.java 12 May 2003 01:17:49 -0000 1.19
+++ src/java/org/apache/commons/httpclient/methods/HeadMethod.java 13 Jul 2003 02:58:41 -0000
@@ -66,8 +66,8 @@
import java.io.IOException;
import org.apache.commons.httpclient.HttpConnection;
-import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.HttpProtocolException;
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -177,7 +177,7 @@
}
if (conn.isResponseAvailable(this.bodyCheckTimeout)) {
if (isStrictMode()) {
- throw new HttpException(
+ throw new HttpProtocolException(
"Body content may not be sent in response to HTTP HEAD request");
} else {
LOG.warn("Body content returned in response to HTTP HEAD");