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	18 Feb 2002 01:52:37 -0000
@@ -73,6 +73,9 @@
  * @author Sean C. Sullivan
  * @author <a href="mailto:dion@apache.org">dIon Gillard</a>
  * @version $Revision: 1.13 $ $Date: 2002/02/17 12:20:06 $
+ *
+ * @see RequestOutputStream
+ *
  */
 public class ResponseInputStream extends InputStream {
 
@@ -99,7 +102,9 @@
     /**
      * Construct a servlet input stream associated with the specified Request.
      *
-     * @param request The associated request
+     * @param stream Must be non-null.
+     * @param method Must be non-null.
+     *
      */
     public ResponseInputStream(InputStream stream, HttpMethod method) {
         super();
@@ -129,7 +134,8 @@
             try {
                 this.contentLength =
                     Integer.parseInt(contentLengthHeader.getValue());
-            } catch (NumberFormatException e) {
+            } catch (NumberFormatException ignored) {
+                   // we are intentionally ignoring the NumberFormatException
             }
         }
 
@@ -204,25 +210,33 @@
 
         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;
-                    }
-                }
-            }
-            closed = true;
+       		         while (!endChunk) {
+       		             int b = read();
+       		             if (b < 0)
+       		                 break;
+       		         }
+	
+       		    } else {
+
+                	if (length > 0) {
+                    		while (count < length) {
+                        		int b = read();
+                        		if (b < 0)
+                            		break;
+                    		}
+                	}
+
+            	    }
+		}
+		catch (java.io.IOException ex) {
+			throw ex;
+		}
+		finally {
+	            closed = true;
+		}
         }
     }
 
@@ -313,7 +327,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);
