giacomo     02/01/31 11:29:04

  Modified:    src/java/org/apache/cocoon/util PostInputStream.java
  Log:
  fixed looping under Catalina/Tomcat. The available() method was always returning 0
  
  Revision  Changes    Path
  1.2       +5 -4      xml-cocoon2/src/java/org/apache/cocoon/util/PostInputStream.java
  
  Index: PostInputStream.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/util/PostInputStream.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PostInputStream.java      3 Jan 2002 12:31:21 -0000       1.1
  +++ PostInputStream.java      31 Jan 2002 19:29:04 -0000      1.2
  @@ -14,7 +14,7 @@
    * It allows to control read operation, restricting the number of bytes read to the 
value returned by getContentLen() method.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Kinga Dziembowski</a>
  - * @version $Id: PostInputStream.java,v 1.1 2002/01/03 12:31:21 giacomo Exp $
  + * @version $Id: PostInputStream.java,v 1.2 2002/01/31 19:29:04 giacomo Exp $
    */
   
   public class PostInputStream extends InputStream {
  @@ -130,8 +130,8 @@
       * <p> This method implements the general contract of the corresponding
       * <code>{@link InputStream#read(byte[], int, int) read}</code> method of
       * the <code>{@link InputStream}</code> class.
  -    * This method delegetes tre read operation to the underlying InputStream 
implementation class but it
  -    * controlls the number of bytes read from the stream.In the remote situation 
the underlying InputStream has no knowledge of
  +    * This method delegetes the read operation to the underlying InputStream 
implementation class but it
  +    * controlls the number of bytes read from the stream. In the remote situation 
the underlying InputStream has no knowledge of
       * the length of the stream and the notion of the "end" is undefined. This 
wrapper class has a knowledge of the
       * length of data send by the requestor by the means of contentLength. This 
method returns the number of bytes read and
       * accumulates the total number of bytes read in m_bytesRead. When the 
m_bytesRead is equal to the specified contentLength
  @@ -207,7 +207,8 @@
       */
       public synchronized int available() throws IOException {
           checkOpen();
  -        return m_inputStream.available();
  +        int avail = m_inputStream.available();
  +        return (avail == 0 ? (m_contentLen - m_bytesRead) : avail);
       }
   
       /**
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to