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/04 13:48:38 UTC
cvs commit: jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/stream ClientCustomStreamReadWriter.java
leif 02/04/04 03:48:38
Modified: altrmi/src/java/org/apache/excalibur/altrmi/client/impl/stream
ClientCustomStreamReadWriter.java
Log:
Fix a Corrupted Stream problem caused by data not being read in fully.
Revision Changes Path
1.2 +17 -3 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/stream/ClientCustomStreamReadWriter.java
Index: ClientCustomStreamReadWriter.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/stream/ClientCustomStreamReadWriter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ClientCustomStreamReadWriter.java 3 Apr 2002 11:29:52 -0000 1.1
+++ ClientCustomStreamReadWriter.java 4 Apr 2002 11:48:38 -0000 1.2
@@ -27,7 +27,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 ClientCustomStreamReadWriter extends ClientStreamReadWriter
{
@@ -83,8 +83,22 @@
int byteArraySize = (int) 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( "ClientCustomStreamWriter.readReply took " + cnt +
+ " reads to read all, " + byteArraySize + ", required bytes." );
+ }
+ */
return (AltrmiReply) SerializationHelper.getInstanceFromBytes(byteArray,
mInterfacesClassLoader);
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>