james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1095108 - /james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/RawFieldParserTest.java
Date Tue, 19 Apr 2011 15:13:41 GMT
Author: bago
Date: Tue Apr 19 15:13:41 2011
New Revision: 1095108

URL: http://svn.apache.org/viewvc?rev=1095108&view=rev
Log:
Added test to prove MIME4J-189 issue

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

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=1095108&r1=1095107&r2=1095108&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
Tue Apr 19 15:13:41 2011
@@ -264,4 +264,23 @@ 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.
+     */
+    public void testFoldedContentType() {
+        ByteSequence buf = ContentUtil.encode(
+                "multipart/alternative; boundary=\"simple\r\n boundary\"");
+        RawFieldParser parser = new RawFieldParser();
+        ParserCursor cursor = new ParserCursor(0, buf.length());
+        RawBody body = parser.parseRawBody(buf, cursor);
+        assertNotNull(body);
+        assertEquals("multipart/alternative", body.getValue());
+        List<NameValuePair> params = body.getParams();
+        assertEquals(1, params.size());
+        assertEquals("boundary", params.get(0).getName());
+        assertEquals("simple boundary", params.get(0).getValue());
+    }
+
 }
\ No newline at end of file



Mime
View raw message