Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes c8b2403b1 -> c140c236d


[CXF-7025] Fix problem detecting boundary with streams that return a single 
byte at a time

# Conflicts:
#       core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/8783d922
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/8783d922
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/8783d922

Branch: refs/heads/3.0.x-fixes
Commit: 8783d922b983754b201c8e8eaf43de0dbf772dd4
Parents: c8b2403
Author: Daniel Kulp <dk...@apache.org>
Authored: Thu Mar 30 15:40:41 2017 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Thu Mar 30 18:14:59 2017 -0400

----------------------------------------------------------------------
 .../apache/cxf/attachment/AttachmentDeserializer.java  | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/8783d922/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java 
b/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
index 245bf6a..afc3bc5 100644
--- a/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
+++ b/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
@@ -157,9 +157,16 @@ public class AttachmentDeserializer {
         PushbackInputStream in = new PushbackInputStream(is, 4096);
         byte buf[] = new byte[2048];
         int i = in.read(buf);
-        String msg = IOUtils.newStringFromBytes(buf, 0, i);
-        in.unread(buf, 0, i);
-        
+        int len = i;
+        while (i > 0 && len < buf.length) {
+            i = in.read(buf, len, buf.length - len);
+            if (i > 0) {
+                len += i;
+            }
+        }
+        String msg = IOUtils.newStringFromBytes(buf, 0, len);
+        in.unread(buf, 0, len);
+
         // Reset the input stream since we'll need it again later
         message.setContent(InputStream.class, in);
 

Reply via email to