morgand     01/04/30 15:12:27

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        ResponseInputStream.java
  Log:
  method was choking when readLineFromStream returned null
  
  Revision  Changes    Path
  1.2       +9 -5      
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java
  
  Index: ResponseInputStream.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ResponseInputStream.java  2001/04/25 18:42:52     1.1
  +++ ResponseInputStream.java  2001/04/30 22:12:25     1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v
 1.1 2001/04/25 18:42:52 remm Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/04/25 18:42:52 $
  + * $Header: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v
 1.2 2001/04/30 22:12:25 morgand Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/04/30 22:12:25 $
    *
    * ====================================================================
    *
  @@ -74,7 +74,7 @@
    * Socket input stream wrapper.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Remy Maucherat</a>
  - * @version $Revision: 1.1 $ $Date: 2001/04/25 18:42:52 $
  + * @version $Revision: 1.2 $ $Date: 2001/04/30 22:12:25 $
    */
   
   public class ResponseInputStream
  @@ -314,8 +314,12 @@
           if (chunk) {
               
               try {
  -                String numberValue = readLineFromStream().trim();
  -                length = Integer.parseInt(numberValue, 16);
  +                String numberValue = readLineFromStream();
  +                if (numberValue == null) {
  +                  throw new NumberFormatException();
  +                }
  +
  +                length = Integer.parseInt(numberValue.trim(), 16);
               } catch (NumberFormatException e) {
                   // Critical error, unable to parse the chunk length
                   length = 0;
  
  
  

Reply via email to