You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by sn...@apache.org on 2002/11/20 08:29:32 UTC

cvs commit: xml-soap/java/src/org/apache/soap/transport TransportMessage.java

snichol     2002/11/19 23:29:32

  Modified:    java/src/org/apache/soap/transport TransportMessage.java
  Log:
  Fix reading of message for which no content length is specified.
  
  Revision  Changes    Path
  1.22      +8 -6      xml-soap/java/src/org/apache/soap/transport/TransportMessage.java
  
  Index: TransportMessage.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/transport/TransportMessage.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- TransportMessage.java	19 Nov 2002 02:47:38 -0000	1.21
  +++ TransportMessage.java	20 Nov 2002 07:29:32 -0000	1.22
  @@ -174,12 +174,14 @@
               // returns a -1.
               while ((contentLength < 0 || offset < contentLength) && (bytesRead >= 0)) {
                   bytesRead = is.read(bytes, offset, bytes.length - offset);
  -                offset += bytesRead;
  -                if (contentLength < 0 && offset >= bytes.length) {
  -                    byte[] newbuf = new byte[bytes.length * 2];
  -                    System.arraycopy(bytes, 0, newbuf, 0, bytes.length);
  -                    bytes = newbuf;
  -                }
  +                if (bytesRead > 0) {
  +	                offset += bytesRead;
  +	                if (contentLength < 0 && offset >= bytes.length) {
  +	                    byte[] newbuf = new byte[bytes.length * 2];
  +	                    System.arraycopy(bytes, 0, newbuf, 0, bytes.length);
  +	                    bytes = newbuf;
  +	                }
  +	            }
               }
   
               if (contentLength < 0) {