You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by le...@apache.org on 2002/04/06 13:44:23 UTC

cvs commit: jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl ServerCustomStreamReadWriter.java

leif        02/04/06 03:44:23

  Modified:    altrmi/src/java/org/apache/excalibur/altrmi/server/impl
                        ServerCustomStreamReadWriter.java
  Log:
  When a large amout of data is sent to the server in a call, the data was not being
  read fully.
  
  Revision  Changes    Path
  1.2       +17 -3     jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/ServerCustomStreamReadWriter.java
  
  Index: ServerCustomStreamReadWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/ServerCustomStreamReadWriter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServerCustomStreamReadWriter.java	3 Apr 2002 11:29:55 -0000	1.1
  +++ ServerCustomStreamReadWriter.java	6 Apr 2002 11:44:23 -0000	1.2
  @@ -25,7 +25,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class ServerCustomStreamReadWriter extends ServerStreamReadWriter {
   
  @@ -60,8 +60,22 @@
   
           int byteArraySize = mDataInputStream.readInt();
           byte[] byteArray = new byte[byteArraySize];
  -
  -        mDataInputStream.read(byteArray);
  +        int pos = 0;
  +        int cnt = 0;
  +        // Loop here until the entire array has been read in.
  +        while( pos < byteArraySize )
  +        {
  +            int read = mDataInputStream.read( byteArray, pos, byteArraySize - pos );
  +            pos += read;
  +            cnt++;
  +        }
  +        /*
  +        if (cnt > 1)
  +        {
  +            System.out.println( "ServerCustomStreamReadWriter.readReply took " + cnt +
  +                " reads to read all, " + byteArraySize + ", required bytes." );
  +        }
  +        */
   
           return (AltrmiRequest) SerializationHelper.getInstanceFromBytes(byteArray);
       }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>