james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1095398 - in /james/mime4j/trunk/core/src: main/java/org/apache/james/mime4j/stream/DefaultBodyDescriptor.java main/java/org/apache/james/mime4j/stream/RawFieldParser.java test/java/org/apache/james/mime4j/stream/RawFieldParserTest.java
Date Wed, 20 Apr 2011 13:02:16 GMT
Author: olegk
Date: Wed Apr 20 13:02:16 2011
New Revision: 1095398

URL: http://svn.apache.org/viewvc?rev=1095398&view=rev
Log:
MIME4J-189: fixed regression caused by incorrect handling of folded quoted strings in RawFieldParser

Modified:
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/DefaultBodyDescriptor.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawFieldParser.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/RawFieldParserTest.java

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/DefaultBodyDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/DefaultBodyDescriptor.java?rev=1095398&r1=1095397&r2=1095398&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/DefaultBodyDescriptor.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/DefaultBodyDescriptor.java
Wed Apr 20 13:02:16 2011
@@ -133,9 +133,7 @@ public class DefaultBodyDescriptor imple
 
     private void parseContentType(RawField field) throws MimeException {
         contentTypeSet = true;
-        // TODO this is a temporary fix while MIME4J-189 is fixed for real.
-        RawField rf = new RawField(field.getName(), field.getBody());
-        RawBody body = RawFieldParser.DEFAULT.parseRawBody(rf);
+        RawBody body = RawFieldParser.DEFAULT.parseRawBody(field);
         String main = body.getValue();
         Map<String, String> params = new HashMap<String, String>();
         for (NameValuePair nmp: body.getParams()) {

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawFieldParser.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawFieldParser.java?rev=1095398&r1=1095397&r2=1095398&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawFieldParser.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawFieldParser.java
Wed Apr 20 13:02:16 2011
@@ -265,7 +265,7 @@ public class RawFieldParser {
                 }
                 if (current == '\\') {
                     escaped = true;
-                } else {
+                } else if (current != '\r' && current != '\n') {
                     dst.append(current);
                 }
             }

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/RawFieldParserTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/RawFieldParserTest.java?rev=1095398&r1=1095397&r2=1095398&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/RawFieldParserTest.java
(original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/RawFieldParserTest.java
Wed Apr 20 13:02:16 2011
@@ -427,13 +427,7 @@ public class RawFieldParserTest extends 
         assertEquals("boundary", params.get(1).getValue());
     }
 
-    /**
-     * Proof for MIME4J-189.
-     * Either RawFieldParser implements unfolding or callers of RawFieldParser
-     * have to make sure the content is unfolded before being parsed.
-     */
-    /** TODO fix the main code.
-    public void testFoldedContentType() {
+    public void testRawBodyParseFolded() {
         ByteSequence buf = ContentUtil.encode(
                 "multipart/alternative; boundary=\"simple\r\n boundary\"");
         RawFieldParser parser = new RawFieldParser();
@@ -446,6 +440,5 @@ public class RawFieldParserTest extends 
         assertEquals("boundary", params.get(0).getName());
         assertEquals("simple boundary", params.get(0).getValue());
     }
-    */
 
 }



Mime
View raw message