[jbossws-commits] JBossWS SVN: r3584 - branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/attachment.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Thu Jun 14 11:10:58 EDT 2007


Author: thomas.diesler at jboss.com
Date: 2007-06-14 11:10:57 -0400 (Thu, 14 Jun 2007)
New Revision: 3584

Modified:
   branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java
Log:
[JBWS-1620] - Incorrect handling of MIME boundaries in MultipartRelatedDecoder
Thanks Janos Biro

Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java	2007-06-14 14:51:01 UTC (rev 3583)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java	2007-06-14 15:10:57 UTC (rev 3584)
@@ -25,6 +25,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.PushbackInputStream;
 import java.io.UnsupportedEncodingException;
 import java.util.Collection;
 import java.util.Enumeration;
@@ -89,6 +90,7 @@
       String boundaryParameter = contentType.getParameter("boundary");
       String start = contentType.getParameter("start");
       byte[] boundary;
+      byte[] crlf;
 
       if (boundaryParameter == null)
          throw new IllegalArgumentException("multipart/related content type did not contain a boundary");
@@ -100,13 +102,19 @@
             boundary = ("--" + boundaryParameter).getBytes("US-ASCII");
          else 
             boundary = ("\r\n--" + boundaryParameter).getBytes("US-ASCII");
+            
+            crlf = ("\r\n").getBytes("US-ASCII");
       }
       catch (UnsupportedEncodingException e)
       {
          throw new WSException("US-ASCII not supported, this should never happen");
       }
+      
+      // [JBWS-1620] - Incorrect handling of MIME boundaries in MultipartRelatedDecoder
+      PushbackInputStream pushBackStream = new PushbackInputStream(stream,2);
+      pushBackStream.unread(crlf);
 
-      BoundaryDelimitedInputStream delimitedStream = new BoundaryDelimitedInputStream(stream, boundary);
+      BoundaryDelimitedInputStream delimitedStream = new BoundaryDelimitedInputStream(pushBackStream, boundary);
 
       // Eat first inner stream since its empty
       byte[] buffer = new byte[256];




More information about the jbossws-commits mailing list