[jbossws-commits] JBossWS SVN: r15994 - stack/native/branches/jbossws-native-2.0.1.SP2_CP11_JBPAPP-8450/src/main/java/org/jboss/ws/core/soap/attachment.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Fri Mar 16 12:54:22 EDT 2012


Author: klape
Date: 2012-03-16 12:54:22 -0400 (Fri, 16 Mar 2012)
New Revision: 15994

Modified:
   stack/native/branches/jbossws-native-2.0.1.SP2_CP11_JBPAPP-8450/src/main/java/org/jboss/ws/core/soap/attachment/BoundaryDelimitedInputStream.java
Log:
[JBPAPP-8450] MTOM services returns two extra bytes at the end

Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP11_JBPAPP-8450/src/main/java/org/jboss/ws/core/soap/attachment/BoundaryDelimitedInputStream.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP11_JBPAPP-8450/src/main/java/org/jboss/ws/core/soap/attachment/BoundaryDelimitedInputStream.java	2012-03-16 16:52:51 UTC (rev 15993)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP11_JBPAPP-8450/src/main/java/org/jboss/ws/core/soap/attachment/BoundaryDelimitedInputStream.java	2012-03-16 16:54:22 UTC (rev 15994)
@@ -58,6 +58,8 @@
    
    private boolean bufferingCompleted;
    
+   private boolean checkLeadingCRLF;
+   
    /**
     * Constructs a <code>BoundaryDelimitedInputStream</code> using the passed
     * <code>InputStream</code> as the source for the outer stream.
@@ -71,6 +73,7 @@
       source = in;
       this.boundary = (byte[]) boundary.clone();
       boyerMoore = new SimpleBoyerMoore(this.boundary);
+      checkLeadingCRLF = boundary.length > 0 && boundary[0] != '\r';
    }
 
    /*
@@ -201,6 +204,13 @@
       } 
       else 
       {
+         if (checkLeadingCRLF && boundaryPosition > 1)
+         {
+            if (buffer[boundaryPosition - 1] == '\n' && buffer[boundaryPosition - 2] == '\r')
+            {
+               boundaryPosition -= 2;
+            }
+         }
          returnLength = boundaryPosition;
          createLeftOvers(buffer, returnLength + boundary.length, position);
          



More information about the jbossws-commits mailing list