cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1310200 - /cxf/trunk/api/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java
Date Fri, 06 Apr 2012 07:27:42 GMT
Author: ffang
Date: Fri Apr  6 07:27:41 2012
New Revision: 1310200

URL: http://svn.apache.org/viewvc?rev=1310200&view=rev
Log:
[CXF-4227]AttachmentDeserializerTest contains buggy code for reading an InputStream.

Modified:
    cxf/trunk/api/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java

Modified: cxf/trunk/api/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java?rev=1310200&r1=1310199&r2=1310200&view=diff
==============================================================================
--- cxf/trunk/api/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java
(original)
+++ cxf/trunk/api/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java
Fri Apr  6 07:27:41 2012
@@ -486,9 +486,12 @@ public class AttachmentDeserializerTest 
             byte bts[] = new byte[1024];
             
             InputStream ins = ds.getInputStream();
-            int count = ins.read(bts, 0, bts.length);
-            int sz = ins.read(bts, count, bts.length - count);
+            int count = 0;
+            int sz = ins.read(bts, 0, bts.length);
             while (sz != -1) {
+                count += sz;
+                // We do not expect the data to fill up the buffer:
+                assertTrue(count < bts.length);
                 sz = ins.read(bts, count, bts.length - count);
             }
             assertEquals(x + 1, count);



Mime
View raw message