cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [1/3] cxf git commit: [CXF-7025] Fix problem detecting boundary with streams that return a single byte at a time
Date Thu, 30 Mar 2017 22:13:38 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 28a092319 -> 6fd76780c


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


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

Branch: refs/heads/master
Commit: ea97f3dd62a3a271faf7f363aca618d921c14abb
Parents: 28a0923
Author: Daniel Kulp <dkulp@apache.org>
Authored: Thu Mar 30 15:40:41 2017 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Thu Mar 30 15:40:41 2017 -0400

----------------------------------------------------------------------
 .../apache/cxf/attachment/AttachmentDeserializer.java    | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ea97f3dd/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 3a82dc5..9b40a8a 100644
--- a/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
+++ b/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
@@ -157,8 +157,15 @@ 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);


Mime
View raw message