You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2012/04/06 09:57:05 UTC

svn commit: r1310214 - /cxf/branches/2.5.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java

Author: ffang
Date: Fri Apr  6 07:57:04 2012
New Revision: 1310214

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

Modified:
    cxf/branches/2.5.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java

Modified: cxf/branches/2.5.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java?rev=1310214&r1=1310213&r2=1310214&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java (original)
+++ cxf/branches/2.5.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java Fri Apr  6 07:57:04 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);