Index: ResponseInputStream.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v
retrieving revision 1.13
diff -u -r1.13 ResponseInputStream.java
--- ResponseInputStream.java	17 Feb 2002 12:20:06 -0000	1.13
+++ ResponseInputStream.java	17 Feb 2002 19:42:43 -0000
@@ -69,6 +69,8 @@
 /**
  * <p>{@link InputStream} wrapper supporting the chunked transfer encoding.</p>
  *
+ * @see RequestOutputStream
+ *
  * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  * @author Sean C. Sullivan
  * @author <a href="mailto:dion@apache.org">dIon Gillard</a>
@@ -80,6 +82,8 @@
 
     /**
      *
+     * Construct a wrapped input stream 
+     *
      * @param stream Must be non-null.
      * @param chunked <code>true</code> if the input stream is chunked
      * @param contentLength content length
@@ -97,9 +101,11 @@
     }
 
     /**
-     * Construct a servlet input stream associated with the specified Request.
+     * Construct a wrapped input stream 
+     *
+     * @param stream must be non-null
+     * @param method must be non-null
      *
-     * @param request The associated request
      */
     public ResponseInputStream(InputStream stream, HttpMethod method) {
         super();
@@ -129,7 +135,9 @@
             try {
                 this.contentLength =
                     Integer.parseInt(contentLengthHeader.getValue());
-            } catch (NumberFormatException e) {
+            } 
+            catch (NumberFormatException ignored) {
+		// we are intentionally ignoring this exception
             }
         }
 
@@ -204,25 +212,35 @@
 
         if (!closed) {
 
-            if (chunk) {
+            try {
+
+            	if (chunk) {
 
-                while (!endChunk) {
-                    int b = read();
-                    if (b < 0)
-                        break;
-                }
-
-            } else {
-
-                if (length > 0) {
-                    while (count < length) {
-                        int b = read();
-                        if (b < 0)
-                            break;
-                    }
-                }
+               		while (!endChunk) {
+               	     		int b = read();
+               	     		if (b < 0)
+               	       		  break;
+               	 	}
+
+            	 } 
+		 else {
+
+                	if (length > 0) {
+                    		while (count < length) {
+                        		int b = read();
+                        		if (b < 0)
+                            			break;
+                   		}
+                	}
+            	 }
             }
-            closed = true;
+            catch (java.io.IOException ex) {
+            	throw ex;
+            }
+            finally {
+            	closed = true;
+            }
+
         }
     }
 
@@ -313,7 +331,7 @@
             try {
                 String numberValue = readLineFromStream();
                 if (numberValue == null) {
-                  throw new NumberFormatException();
+                  throw new NumberFormatException("unable to find chunk length");
                 }
 
                 length = Integer.parseInt(numberValue.trim(), 16);

