Index: java/org/apache/commons/httpclient/ChunkedInputStream.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ChunkedInputStream.java,v retrieving revision 1.18 diff -u -r1.18 ChunkedInputStream.java --- java/org/apache/commons/httpclient/ChunkedInputStream.java 16 Jul 2003 20:48:27 -0000 1.18 +++ java/org/apache/commons/httpclient/ChunkedInputStream.java 25 Jul 2003 13:56:32 -0000 @@ -67,6 +67,7 @@ import java.io.IOException; import java.io.InputStream; +import org.apache.commons.httpclient.util.ExceptionUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -337,7 +338,9 @@ footers = HttpParser.parseHeaders(in); } catch(HttpException e) { LOG.error("Error parsing trailer headers", e); - throw new IOException(e.getMessage()); + IOException ioe = new IOException(e.getMessage()); + ExceptionUtil.initCause(ioe, e); + throw ioe; } for (int i = 0; i < footers.length; i++) { Index: java/org/apache/commons/httpclient/ChunkedOutputStream.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ChunkedOutputStream.java,v retrieving revision 1.10 diff -u -r1.10 ChunkedOutputStream.java --- java/org/apache/commons/httpclient/ChunkedOutputStream.java 19 Apr 2003 22:29:31 -0000 1.10 +++ java/org/apache/commons/httpclient/ChunkedOutputStream.java 25 Jul 2003 13:56:32 -0000 @@ -121,7 +121,7 @@ */ public ChunkedOutputStream(OutputStream stream) { if (stream == null) { - throw new NullPointerException("stream parameter is null"); + throw new IllegalArgumentException("Stream parameter may not be null"); } this.stream = stream; } Index: java/org/apache/commons/httpclient/HttpConnection.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v retrieving revision 1.69 diff -u -r1.69 HttpConnection.java --- java/org/apache/commons/httpclient/HttpConnection.java 16 Jul 2003 20:48:27 -0000 1.69 +++ java/org/apache/commons/httpclient/HttpConnection.java 25 Jul 2003 13:56:33 -0000 @@ -1214,7 +1214,7 @@ "Output exception occurred on a used connection. Will treat as recoverable.", ioe ); - return new HttpRecoverableException(ioe.toString()); + return new HttpRecoverableException(ioe.getMessage(), ioe); } else { return ioe; } Index: java/org/apache/commons/httpclient/HttpException.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpException.java,v retrieving revision 1.14 diff -u -r1.14 HttpException.java --- java/org/apache/commons/httpclient/HttpException.java 15 Jul 2003 02:19:58 -0000 1.14 +++ java/org/apache/commons/httpclient/HttpException.java 25 Jul 2003 13:56:33 -0000 @@ -70,20 +70,9 @@ /** * Signals that an HTTP or HttpClient exception has occurred. - *
- * The usage of the reserved status and reason codes - *
@@ -102,5 +103,13 @@
*/
public HttpRecoverableException(String message, Throwable cause) {
super(message);
+ // 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) {
+ // The setCause method must not be available
+ }
}
}
Index: java/org/apache/commons/httpclient/HttpTimeoutException.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpTimeoutException.java,v
retrieving revision 1.1
diff -u -r1.1 HttpTimeoutException.java
--- java/org/apache/commons/httpclient/HttpTimeoutException.java 15 Jul 2003 02:19:58 -0000 1.1
+++ java/org/apache/commons/httpclient/HttpTimeoutException.java 25 Jul 2003 13:56:34 -0000
@@ -95,7 +95,7 @@
* if the cause is unavailable, unknown, or not a Throwable
*/
public HttpTimeoutException(String message, Throwable cause) {
- super(message);
+ super(message, cause);
}
}
Index: java/org/apache/commons/httpclient/util/ExceptionUtil.java
===================================================================
RCS file: java/org/apache/commons/httpclient/util/ExceptionUtil.java
diff -N java/org/apache/commons/httpclient/util/ExceptionUtil.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ java/org/apache/commons/httpclient/util/ExceptionUtil.java 25 Jul 2003 13:56:34 -0000
@@ -0,0 +1,93 @@
+/*
+ * $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
+ *