commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient ResponseInputStream.java
Date Mon, 18 Feb 2002 06:30:40 GMT
dion        02/02/17 22:30:40

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        ResponseInputStream.java
  Log:
  Patches from Sean C. Sullivan
  
  Revision  Changes    Path
  1.14      +29 -23    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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ResponseInputStream.java	17 Feb 2002 12:20:06 -0000	1.13
  +++ ResponseInputStream.java	18 Feb 2002 06:30:40 -0000	1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v
1.13 2002/02/17 12:20:06 dion Exp $
  - * $Revision: 1.13 $
  - * $Date: 2002/02/17 12:20:06 $
  + * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v
1.14 2002/02/18 06:30:40 dion Exp $
  + * $Revision: 1.14 $
  + * $Date: 2002/02/18 06:30:40 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -72,7 +72,10 @@
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
    * @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 $
  + * @version $Revision: 1.14 $ $Date: 2002/02/18 06:30:40 $
  + *
  + * @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
               }
           }
   
  @@ -203,26 +209,27 @@
   */
   
           if (!closed) {
  -
  -            if (chunk) {
  -
  -                while (!endChunk) {
  -                    int b = read();
  -                    if (b < 0)
  -                        break;
  -                }
  -
  -            } else {
  -
  -                if (length > 0) {
  -                    while (count < length) {
  +            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;
  +                        }
  +                    }
                   }
  +            } catch (java.io.IOException ex) {
  +                throw ex;
  +            } finally {
  +                    closed = true;
               }
  -            closed = true;
           }
       }
   
  @@ -290,8 +297,7 @@
       /**
        * Fill the chunk buffer.
        */
  -    private boolean fillBuffer()
  -        throws IOException {
  +    private boolean fillBuffer() throws IOException {
   
           // Has this stream been closed?
           if (closed)
  @@ -313,7 +319,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);
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message