james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1095117 - in /james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream: Event.java MimeEntity.java
Date Tue, 19 Apr 2011 15:38:32 GMT
Author: bago
Date: Tue Apr 19 15:38:32 2011
New Revision: 1095117

URL: http://svn.apache.org/viewvc?rev=1095117&view=rev
Log:
Revert bad code that broke tests. Whitespace is valid in the boundary. left the CR/LF checks
in place. (MIME4J-189)

Modified:
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/Event.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntity.java

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/Event.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/Event.java?rev=1095117&r1=1095116&r2=1095117&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/Event.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/Event.java Tue Apr
19 15:38:32 2011
@@ -38,9 +38,6 @@ public final class Event { 
     /** Indicates that an obsolete syntax header has been detected */
     public static final Event OBSOLETE_HEADER 
         = new Event("Obsolete header encountered");
-    /** Indicates that while space characters have been found in the boundary */
-    public static final Event WHITESPACE_IN_BOUNDARY 
-        = new Event("Boundary may not contain CR or LF");
     
     private final String code;
     

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntity.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntity.java?rev=1095117&r1=1095116&r2=1095117&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntity.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntity.java Tue
Apr 19 15:38:32 2011
@@ -32,7 +32,6 @@ import org.apache.james.mime4j.io.LineNu
 import org.apache.james.mime4j.io.LineReaderInputStream;
 import org.apache.james.mime4j.io.LineReaderInputStreamAdaptor;
 import org.apache.james.mime4j.io.MimeBoundaryInputStream;
-import org.apache.james.mime4j.util.CharsetUtil;
 import org.apache.james.mime4j.util.MimeUtil;
 
 class MimeEntity extends AbstractEntity {
@@ -213,14 +212,12 @@ class MimeEntity extends AbstractEntity 
 
     private void createMimePartStream() throws MimeException, IOException {
         String boundary = body.getBoundary();
-        for (int i = 0; i < boundary.length(); i++) {
-            char ch = boundary.charAt(i);
-            if (CharsetUtil.isWhitespace(ch)) {
-                monitor(Event.WHITESPACE_IN_BOUNDARY);
-                break;
-            }
+        try {
+            currentMimePartStream = new MimeBoundaryInputStream(inbuffer, boundary);
+        } catch (IllegalArgumentException e) {
+            // thrown when boundary is too long
+            throw new MimeException(e.getMessage(), e);
         }
-        currentMimePartStream = new MimeBoundaryInputStream(inbuffer, boundary);
         dataStream = new LineReaderInputStreamAdaptor(
                 currentMimePartStream,
                 config.getMaxLineLen());



Mime
View raw message