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:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</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: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>