mbecke 2003/07/14 19:19:59
Modified: httpclient/src/java/org/apache/commons/httpclient
HttpMethodBase.java HttpRecoverableException.java
MultiThreadedHttpConnectionManager.java
StatusLine.java HttpParser.java HttpException.java
httpclient/src/java/org/apache/commons/httpclient/methods
HeadMethod.java EntityEnclosingMethod.java
httpclient/src/java/org/apache/commons/httpclient/auth
NTLMScheme.java MalformedChallengeException.java
AuthenticationException.java NTLM.java
httpclient/src/java/org/apache/commons/httpclient/cookie
MalformedCookieException.java
Added: httpclient/src/java/org/apache/commons/httpclient
HttpTimeoutException.java TransportException.java
ProtocolException.java ConnectTimeoutException.java
IOTimeoutException.java
httpclient/src/test/org/apache/commons/httpclient
TestExceptions.java
Log:
Initial redesign of Exception framework.
PR: 19868
Submitted by: Laura Werner
Reviewed by: Oleg Kalnichevski, Adrian Sutton and Michael Becke
Revision Changes Path
1.166 +14 -13
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java
Index: HttpMethodBase.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -r1.165 -r1.166
--- HttpMethodBase.java 13 Jul 2003 13:54:50 -0000 1.165
+++ HttpMethodBase.java 15 Jul 2003 02:19:58 -0000 1.166
@@ -131,7 +131,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">dIon Gillard</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jeff Dever</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
- * @author Ortwin Gl�ck
+ * @author Ortwin Gl�ck
* @author Eric Johnson
* @author Michael Becke
* @author <a href="mailto:[EMAIL PROTECTED]">Oleg Kalnichevski</a>
@@ -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 ProtocolException("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 ProtocolException("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 ProtocolException("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 ProtocolException("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 ProtocolException("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 ProtocolException("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 ProtocolException("Unrecognized server protocol: '"
+ httpVersion + "'");
}
1.8 +20 -9
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpRecoverableException.java
Index: HttpRecoverableException.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpRecoverableException.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- HttpRecoverableException.java 28 Jan 2003 22:25:21 -0000 1.7
+++ HttpRecoverableException.java 15 Jul 2003 02:19:58 -0000 1.8
@@ -67,27 +67,38 @@
* <p>
* 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 [EMAIL PROTECTED] TransportException#getCause()} method.
* </p>
* @author Unascribed
* @version $Revision$ $Date$
*/
-public class HttpRecoverableException extends HttpException {
+public class HttpRecoverableException extends TransportException {
/**
- * Creates a new HttpRecoverableException.
+ * Creates a new HttpRecoverableException with a <tt>null</tt> detail message.
*/
public HttpRecoverableException() {
super();
}
/**
- * Creates a new HttpRecoverableException with the
- * specified message.
+ * Creates a new HttpRecoverableException with the specified detail message.
*
* @param message exception message
*/
public HttpRecoverableException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new HttpRecoverableException with the specified detail message and
cause.
+ *
+ * @param message the exception detail message
+ * @param cause the <tt>Throwable</tt> that caused this exception, or
<tt>null</tt>
+ * if the cause is unavailable, unknown, or not a <tt>Throwable</tt>
+ */
+ public HttpRecoverableException(String message, Throwable cause) {
super(message);
}
}
1.19 +4 -4
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
Index: MultiThreadedHttpConnectionManager.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- MultiThreadedHttpConnectionManager.java 5 Jul 2003 22:31:20 -0000 1.18
+++ MultiThreadedHttpConnectionManager.java 15 Jul 2003 02:19:58 -0000 1.19
@@ -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()) {
1.10 +8 -8
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/StatusLine.java
Index: StatusLine.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/StatusLine.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- StatusLine.java 1 Apr 2003 00:25:24 -0000 1.9
+++ StatusLine.java 15 Jul 2003 02:19:58 -0000 1.10
@@ -122,14 +122,14 @@
//check validity of the Status-Line
if (!statusLine.startsWith("HTTP")) {
- throw new HttpException("Status-Line '" + statusLine
+ throw new ProtocolException("Status-Line '" + statusLine
+ "' does not start with HTTP");
}
//handle the HTTP-Version
int at = statusLine.indexOf(" ");
if (at <= 0) {
- throw new HttpException(
+ throw new ProtocolException(
"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 ProtocolException(
"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 ProtocolException("Status text not specified: '"
+ statusLine + "'");
}
}
1.8 +4 -4
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpParser.java
Index: HttpParser.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpParser.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- HttpParser.java 26 May 2003 21:51:37 -0000 1.7
+++ HttpParser.java 15 Jul 2003 02:19:58 -0000 1.8
@@ -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 ProtocolException("Unable to parse header: " + line);
}
name = line.substring(0, colon).trim();
value = new StringBuffer(line.substring(colon + 1).trim());
1.14 +112 -12
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpException.java
Index: HttpException.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpException.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- HttpException.java 28 Jan 2003 04:40:20 -0000 1.13
+++ HttpException.java 15 Jul 2003 02:19:58 -0000 1.14
@@ -63,13 +63,14 @@
package org.apache.commons.httpclient;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+
/**
* Signals that an HTTP or HttpClient exception has occurred.
* <p>
- * Why is it from URIException?
- * To simplify the programming style for the inherited exception instances.
- *
- * <p>
* The usage of the reserved status and reason codes
* <ul>
* <li> -x: Internal use
@@ -85,21 +86,120 @@
* @author Unascribed
* @version $Revision$ $Date$
*/
-public class HttpException extends URIException {
+public class HttpException extends IOException {
/**
- * Creates a new HttpException.
+ * Creates a new HttpException with a <tt>null</tt> detail message.
*/
public HttpException() {
super();
+ this.cause = null;
}
/**
- * Creates a new HttpException with the specified message.
+ * Creates a new HttpException with the specified detail message.
*
- * @param message exception message
+ * @param message the exception detail message
*/
public HttpException(String message) {
super(message);
+ this.cause = null;
}
+
+ /**
+ * Creates a new HttpException with the specified detail message and cause.
+ *
+ * @param message the exception detail message
+ * @param cause the <tt>Throwable</tt> that caused this exception, or
<tt>null</tt>
+ * if the cause is unavailable, unknown, or not a <tt>Throwable</tt>
+ */
+ public HttpException(String message, Throwable cause) {
+ super(message);
+ this.cause = cause;
+
+ // If we're running on JDK 1.4 or later, tell Throwable what the cause was
+ try {
+ Class[] paramsClasses = new Class[] { Throwable.class };
+ Method initCause = Throwable.class.getMethod("initCause",
paramsClasses);
+ initCause.invoke(this, new Object[] { cause });
+ } catch (Exception e) {
+ e.printStackTrace();
+ // The setCause method must not be available
+ }
+ }
+
+ /**
+ * Return the <tt>Throwable</tt> that caused this exception, or <tt>null</tt>
+ * if the cause is unavailable, unknown, or not a <tt>Throwable</tt>.
+ *
+ * @return the <tt>Throwable</tt> that caused this exception, or <tt>null</tt>
+ * if the cause is unavailable, unknown, or not a <tt>Throwable</tt>
+ */
+ public Throwable getCause() {
+ return cause;
+ }
+
+ /**
+ * Print this HttpException and its stack trace to the standard error stream.
+ */
+ public void printStackTrace() {
+ printStackTrace(System.err);
+ }
+
+ /**
+ * Print this HttpException and its stack trace to the specified print stream.
+ *
+ * @param s the <tt>PrintStream</tt> to which the exception and its stack trace
+ * should be written
+ */
+ public void printStackTrace(PrintStream s) {
+ try {
+ // JDK 1.4 has a nice printStackTrace method that prints the cause's
stack
+ // trace too and prunes out duplicate stack frames. Call it if
possible,
+ // which is determined by checking whether JDK 1.4's getStackTrace
method is present
+ Class[] paramsClasses = new Class[] { };
+ this.getClass().getMethod("getStackTrace", paramsClasses);
+ super.printStackTrace(s);
+ } catch (Exception ex) {
+ // If that didn't work, print it out ourselves
+ // First print this exception's stack trace.
+ super.printStackTrace(s);
+ if (cause != null) {
+ // Print out the exception that caused this one.
+ // This will recurse if the cause is another HttpException.
+ s.print("Caused by: ");
+ cause.printStackTrace(s);
+ }
+ }
+ }
+
+ /**
+ * Print this HttpException and its stack trace to the specified print writer.
+ *
+ * @param s the <tt>PrintWriter</tt> to which the exception and its stack trace
+ * should be written
+ */
+ public void printStackTrace(PrintWriter s) {
+ try {
+ // JDK 1.4 has a nice printStackTrace method that prints the cause's
stack
+ // trace too and prunes out duplicate stack frames. Call it if
possible,
+ // which is determined by checking whether JDK 1.4's getStackTrace
method is present
+ Class[] paramsClasses = new Class[] { };
+ this.getClass().getMethod("getStackTrace", paramsClasses);
+ super.printStackTrace(s);
+ } catch (Exception ex) {
+ // If that didn't work, print it out ourselves
+ // First print this exception's stack trace.
+ super.printStackTrace(s);
+ if (cause != null) {
+ // Print out the exception that caused this one.
+ // This will recurse if the cause is another HttpException.
+ s.print("Caused by: ");
+ cause.printStackTrace(s);
+ }
+ }
+ }
+
+ /** The original Throwable representing the cause of this error */
+ private final Throwable cause;
}
1.1
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpTimeoutException.java
Index: HttpTimeoutException.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpTimeoutException.java,v
1.1 2003/07/15 02:19:58 mbecke Exp $
* $Revision: 1.1 $
* $Date: 2003/07/15 02:19:58 $
*
* ====================================================================
*
* 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 [EMAIL PROTECTED]
*
* 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
* <http://www.apache.org/>.
*
*/
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 <a href="mailto:[EMAIL PROTECTED]">Laura Werner</a>
*
* @since 2.1
*/
public class HttpTimeoutException extends HttpRecoverableException {
/**
* Creates a new HttpTimeoutException with a <tt>null</tt> detail message.
*/
public HttpTimeoutException() {
super();
}
/**
* Creates a new HttpTimeoutException with the specified detail message.
*
* @param message The exception detail message
*/
public HttpTimeoutException(String message) {
super(message);
}
/**
* Creates a new HttpTimeoutException with the specified detail message and
cause.
*
* @param message the exception detail message
* @param cause the <tt>Throwable</tt> that caused this exception, or
<tt>null</tt>
* if the cause is unavailable, unknown, or not a <tt>Throwable</tt>
*/
public HttpTimeoutException(String message, Throwable cause) {
super(message);
}
}
1.1
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/TransportException.java
Index: TransportException.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/TransportException.java,v
1.1 2003/07/15 02:19:58 mbecke Exp $
* $Revision: 1.1 $
* $Date: 2003/07/15 02:19:58 $
*
* ====================================================================
*
* 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 [EMAIL PROTECTED]
*
* 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
* <http://www.apache.org/>.
*
*/
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 TransportException should "wrap" the exception describing the original
* error. The wrapped exception, if any, can be accessed via the [EMAIL PROTECTED]
#getCause()}
* method.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Laura Werner</a>
*
* @since 2.1
*/
public class TransportException extends HttpException {
/**
* Creates a new TransportException with a <tt>null</tt> detail message.
*/
public TransportException() {
super();
}
/**
* Creates a new ProtocolException with the specified message.
*
* @param message The exception detail message
*/
public TransportException(String message) {
super(message);
}
/**
* Creates a new ProtocolException with the specified detail message and cause.
*
* @param message the exception detail message
* @param cause the <tt>Throwable</tt> that caused this exception, or
<tt>null</tt>
* if the cause is unavailable, unknown, or not a <tt>Throwable</tt>
*/
public TransportException(String message, Throwable cause) {
super(message, cause);
}
}
1.1
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ProtocolException.java
Index: ProtocolException.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ProtocolException.java,v
1.1 2003/07/15 02:19:58 mbecke Exp $
* $Revision: 1.1 $
* $Date: 2003/07/15 02:19:58 $
*
* ====================================================================
*
* 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 [EMAIL PROTECTED]
*
* 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
* <http://www.apache.org/>.
*
*/
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 <a href="mailto:[EMAIL PROTECTED]">Laura Werner</a>
*
* @since 2.1
*/
public class ProtocolException extends HttpException {
/**
* Creates a new ProtocolException with a <tt>null</tt> detail message.
*/
public ProtocolException() {
super();
}
/**
* Creates a new ProtocolException with the specified detail message.
*
* @param message The exception detail message
*/
public ProtocolException(String message) {
super(message);
}
/**
* Creates a new ProtocolException with the specified detail message and cause.
*
* @param message the exception detail message
* @param cause the <tt>Throwable</tt> that caused this exception, or
<tt>null</tt>
* if the cause is unavailable, unknown, or not a <tt>Throwable</tt>
*/
public ProtocolException(String message, Throwable cause) {
super(message, cause);
}
}
1.1
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ConnectTimeoutException.java
Index: ConnectTimeoutException.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ConnectTimeoutException.java,v
1.1 2003/07/15 02:19:58 mbecke Exp $
* $Revision: 1.1 $
* $Date: 2003/07/15 02:19:58 $
*
* ====================================================================
*
* 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 [EMAIL PROTECTED]
*
* 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
* <http://www.apache.org/>.
*
*/
package org.apache.commons.httpclient;
/**
* A timeout while connecting to an HTTP server or waiting for an
* available connection from an HttpConnectionManager.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Laura Werner</a>
*
* @since 2.1
*/
public class ConnectTimeoutException extends HttpTimeoutException {
/**
* Creates a ConnectTimeoutException with a <tt>null</tt> detail message.
*/
public ConnectTimeoutException() {
super();
}
/**
* Creates a ConnectTimeoutException with the specified detail message.
*
* @param message The exception detail message
*/
public ConnectTimeoutException(String message) {
super(message);
}
/**
* Creates a new ConnectTimeoutException with the specified detail message and
cause.
*
* @param message the exception detail message
* @param cause the <tt>Throwable</tt> that caused this exception, or
<tt>null</tt>
* if the cause is unavailable, unknown, or not a <tt>Throwable</tt>
*/
public ConnectTimeoutException(String message, Throwable cause) {
super(message, cause);
}
}
1.1
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/IOTimeoutException.java
Index: IOTimeoutException.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/IOTimeoutException.java,v
1.1 2003/07/15 02:19:58 mbecke Exp $
* $Revision: 1.1 $
* $Date: 2003/07/15 02:19:58 $
*
* ====================================================================
*
* 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 [EMAIL PROTECTED]
*
* 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
* <http://www.apache.org/>.
*
*/
package org.apache.commons.httpclient;
/**
* A I/O or network timeout while communicating with an HTTP server.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Laura Werner</a>
*
* @since 2.1
*/
public class IOTimeoutException extends HttpTimeoutException {
/**
* Creates a IOTimeoutException with a <tt>null</tt> detail message.
*/
public IOTimeoutException() {
super();
}
/**
* Creates a IOTimeoutException with a specified message.
*
* @param message The exception detail message
*/
public IOTimeoutException(String message) {
super(message);
}
/**
* Creates a new IOTimeoutException with the specified detail message and cause.
*
* @param message the exception detail message
* @param cause the <tt>Throwable</tt> that caused this exception, or
<tt>null</tt>
* if the cause is unavailable, unknown, or not a <tt>Throwable</tt>
*/
public IOTimeoutException(String message, Throwable cause) {
super(message, cause);
}
}
1.1
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestExceptions.java
Index: TestExceptions.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestExceptions.java,v
1.1 2003/07/15 02:19:58 mbecke Exp $
* $Revision: 1.1 $
* $Date: 2003/07/15 02:19:58 $
*
* ====================================================================
*
* 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 [EMAIL PROTECTED]
*
* 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
* <http://www.apache.org/>.
*
*/
package org.apache.commons.httpclient;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import junit.framework.TestCase;
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Laura Werner</a>
*/
public class TestExceptions extends TestCase
{
/**
* Constructor for TestExceptions.
* @param arg0
*/
public TestExceptions(String arg0)
{
super(arg0);
}
/** Make sure that you can retrieve the "cause" from an HttpException */
public void testGetCause() {
Exception aCause = new IOException("the cause");
try {
throw new HttpException("http exception", aCause);
}
catch (HttpException e) {
assertEquals("Retrieve cause from caught exception", e.getCause(),
aCause);
}
}
/** Make sure HttpConnection prints its stack trace to a PrintWriter properly */
public void testStackTraceWriter() {
Exception aCause = new IOException("initial exception");
try {
throw new HttpException("http exception", aCause);
}
catch (HttpException e) {
// Get the stack trace printed into a string
StringWriter stringWriter = new StringWriter();
PrintWriter writer = new PrintWriter(stringWriter);
e.printStackTrace(writer);
writer.flush();
String stackTrace = stringWriter.toString();
// Do some validation on what got printed
validateStackTrace(e, stackTrace);
}
}
/** Make sure HttpConnection prints its stack trace to a PrintStream properly */
public void testStackTraceStream() {
Exception aCause = new IOException("initial exception");
try {
throw new HttpException("http exception", aCause);
}
catch (HttpException e) {
// Get the stack trace printed into a string
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
PrintStream stream = new PrintStream(byteStream);
e.printStackTrace(stream);
stream.flush();
String stackTrace = byteStream.toString(); // Assume default charset
// Do some validation on what got printed
validateStackTrace(e, stackTrace);
}
}
/**
* Make sure an HttpException stack trace has the right info in it.
* This doesn't bother parsing the whole thing, just does some sanity checks.
*/
private void validateStackTrace(HttpException exception, String stackTrace) {
assertTrue("Starts with exception string",
stackTrace.startsWith(exception.toString()));
Throwable cause = exception.getCause();
if (cause != null) {
assertTrue("Contains 'cause'", stackTrace.toLowerCase().indexOf("cause")
!= -1);
assertTrue("Contains cause.toString()",
stackTrace.indexOf(cause.toString()) != -1);
}
}
}
1.20 +9 -9
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMethod.java
Index: HeadMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMethod.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- HeadMethod.java 12 May 2003 01:17:49 -0000 1.19
+++ HeadMethod.java 15 Jul 2003 02:19:58 -0000 1.20
@@ -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.ProtocolException;
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -98,14 +98,14 @@
* @since 1.0
*/
public class HeadMethod extends HttpMethodBase {
- //~ Static variables/initializers ������������������������������������������
+ //~ Static variables/initializers
������������������������������������������
/** Log object for this class. */
private static final Log LOG = LogFactory.getLog(HeadMethod.class);
private int bodyCheckTimeout = -1; /* Disabled per default */
- //~ Constructors �����������������������������������������������������������
+ //~ Constructors
�����������������������������������������������������������
/**
* No-arg constructor.
@@ -128,7 +128,7 @@
setFollowRedirects(true);
}
- //~ Methods ����������������������������������������������������������������
+ //~ Methods
����������������������������������������������������������������
/**
* Returns <tt>"HEAD"</tt>.
@@ -177,7 +177,7 @@
}
if (conn.isResponseAvailable(this.bodyCheckTimeout)) {
if (isStrictMode()) {
- throw new HttpException(
+ throw new ProtocolException(
"Body content may not be sent in response to HTTP HEAD
request");
} else {
LOG.warn("Body content returned in response to HTTP HEAD");
1.21 +8 -6
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java
Index: EntityEnclosingMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- EntityEnclosingMethod.java 13 Jul 2003 21:29:06 -0000 1.20
+++ EntityEnclosingMethod.java 15 Jul 2003 02:19:58 -0000 1.21
@@ -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.ProtocolException;
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 ProtocolException(
"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 ProtocolException(
"Unbuffered entity enclosing request can not be repeated.");
}
1.8 +5 -5
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/NTLMScheme.java
Index: NTLMScheme.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/NTLMScheme.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- NTLMScheme.java 5 Jul 2003 22:48:19 -0000 1.7
+++ NTLMScheme.java 15 Jul 2003 02:19:58 -0000 1.8
@@ -77,7 +77,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
* @author Rodney Waldhoff
* @author <a href="mailto:[EMAIL PROTECTED]">Jeff Dever</a>
- * @author Ortwin Gl�ck
+ * @author Ortwin Gl�ck
* @author Sean C. Sullivan
* @author <a href="mailto:[EMAIL PROTECTED]">Adrian Sutton</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Mike Bowler</a>
@@ -195,7 +195,7 @@
credentials.getUserName(), credentials.getPassword(),
credentials.getHost(), credentials.getDomain());
} catch (HttpException e) {
- throw new AuthenticationException(e.getMessage());
+ throw new AuthenticationException(e.getMessage(), e);
}
return "NTLM " + s;
}
1.3 +20 -7
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/MalformedChallengeException.java
Index: MalformedChallengeException.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/MalformedChallengeException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MalformedChallengeException.java 6 Apr 2003 22:31:53 -0000 1.2
+++ MalformedChallengeException.java 15 Jul 2003 02:19:58 -0000 1.3
@@ -63,7 +63,7 @@
package org.apache.commons.httpclient.auth;
-import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.ProtocolException;
/**
* Signals that authentication challenge is in some way invalid or
@@ -73,19 +73,32 @@
*
* @since 2.0
*/
-public class MalformedChallengeException extends HttpException {
+public class MalformedChallengeException extends ProtocolException {
/**
- * @see HttpException#HttpException()
+ * Creates a new MalformedChallengeException with a <tt>null</tt> detail
message.
*/
public MalformedChallengeException() {
super();
}
/**
- * @see HttpException#HttpException(String)
+ * Creates a new MalformedChallengeException with the specified message.
+ *
+ * @param message the exception detail message
*/
public MalformedChallengeException(String message) {
super(message);
+ }
+
+ /**
+ * Creates a new MalformedChallengeException with the specified detail message
and cause.
+ *
+ * @param message the exception detail message
+ * @param cause the <tt>Throwable</tt> that caused this exception, or
<tt>null</tt>
+ * if the cause is unavailable, unknown, or not a <tt>Throwable</tt>
+ */
+ public MalformedChallengeException(String message, Throwable cause) {
+ super(message, cause);
}
}
1.3 +21 -7
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/AuthenticationException.java
Index: AuthenticationException.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/AuthenticationException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AuthenticationException.java 6 Apr 2003 22:31:53 -0000 1.2
+++ AuthenticationException.java 15 Jul 2003 02:19:58 -0000 1.3
@@ -63,7 +63,7 @@
package org.apache.commons.httpclient.auth;
-import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.ProtocolException;
/**
* Signals a failure in authentication process
@@ -72,19 +72,33 @@
*
* @since 2.0
*/
-public class AuthenticationException extends HttpException {
+public class AuthenticationException extends ProtocolException {
/**
- * @see HttpException#HttpException()
+ * Creates a new AuthenticationException with a <tt>null</tt> detail message.
*/
public AuthenticationException() {
super();
}
/**
- * @see HttpException#HttpException(String)
+ * Creates a new AuthenticationException with the specified message.
+ *
+ * @param message the exception detail message
*/
public AuthenticationException(String message) {
super(message);
}
+
+ /**
+ * Creates a new AuthenticationException with the specified detail message and
cause.
+ *
+ * @param message the exception detail message
+ * @param cause the <tt>Throwable</tt> that caused this exception, or
<tt>null</tt>
+ * if the cause is unavailable, unknown, or not a <tt>Throwable</tt>
+ */
+ public AuthenticationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
}
1.2 +10 -11
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/NTLM.java
Index: NTLM.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/NTLM.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NTLM.java 5 Jul 2003 22:48:19 -0000 1.1
+++ NTLM.java 15 Jul 2003 02:19:58 -0000 1.2
@@ -173,12 +173,12 @@
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.",
e);
} catch (InvalidKeyException e) {
- throw new HttpException("Invalid key for DES encryption.");
+ throw new AuthenticationException("Invalid key for DES encryption.", e);
} catch (NoSuchPaddingException e) {
- throw new HttpException(
- "NoPadding option for DES is not available.");
+ throw new AuthenticationException(
+ "NoPadding option for DES is not available.", e);
}
}
@@ -224,10 +224,9 @@
byte[] enc = ecipher.doFinal(bytes);
return enc;
} catch (IllegalBlockSizeException e) {
- throw new HttpException("Invalid block size for DES encryption.");
+ throw new AuthenticationException("Invalid block size for DES
encryption.", e);
} catch (BadPaddingException e) {
- throw new HttpException(
- "Data not padded correctly for DES encryption.");
+ throw new AuthenticationException("Data not padded correctly for DES
encryption.", e);
}
}
1.5 +22 -9
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/cookie/MalformedCookieException.java
Index: MalformedCookieException.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/cookie/MalformedCookieException.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MalformedCookieException.java 27 Jan 2003 15:25:47 -0000 1.4
+++ MalformedCookieException.java 15 Jul 2003 02:19:59 -0000 1.5
@@ -63,7 +63,7 @@
package org.apache.commons.httpclient.cookie;
-import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.ProtocolException;
/**
* Signals that a cookie is in some way invalid or illegal in a given
@@ -73,19 +73,32 @@
*
* @since 2.0
*/
-public class MalformedCookieException extends HttpException {
+public class MalformedCookieException extends ProtocolException {
/**
- * @see HttpException#HttpException()
+ * Creates a new MalformedCookieException with a <tt>null</tt> detail message.
*/
public MalformedCookieException() {
super();
}
-
- /**
- * @see HttpException#HttpException(String)
+
+ /**
+ * Creates a new MalformedCookieException with a specified message string.
+ *
+ * @param message The exception detail message
*/
public MalformedCookieException(String message) {
super(message);
+ }
+
+ /**
+ * Creates a new MalformedCookieException with the specified detail message and
cause.
+ *
+ * @param message the exception detail message
+ * @param cause the <tt>Throwable</tt> that caused this exception, or
<tt>null</tt>
+ * if the cause is unavailable, unknown, or not a <tt>Throwable</tt>
+ */
+ public MalformedCookieException(String message, Throwable cause) {
+ super(message, cause);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]