Author: darran.lofthouse(a)jboss.com
Date: 2009-05-01 08:00:51 -0400 (Fri, 01 May 2009)
New Revision: 9941
Modified:
legacy/branches/jbossws-1.2.1.GA_CP/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java
Log:
[JBPAPP-1972] Incorrect handling of MIME boundaries in MultipartRelatedDecoder.
Modified:
legacy/branches/jbossws-1.2.1.GA_CP/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_CP/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java 2009-05-01
11:25:12 UTC (rev 9940)
+++
legacy/branches/jbossws-1.2.1.GA_CP/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java 2009-05-01
12:00:51 UTC (rev 9941)
@@ -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];
Show replies by date