james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nik...@apache.org
Subject svn commit: r675695 - in /james/mime4j/trunk/src: main/java/org/apache/james/mime4j/MimeBoundaryInputStream.java test/java/org/apache/james/mime4j/MultipartTokensTest.java
Date Thu, 10 Jul 2008 19:37:10 GMT
Author: niklas
Date: Thu Jul 10 12:37:09 2008
New Revision: 675695

URL: http://svn.apache.org/viewvc?rev=675695&view=rev
Log:
Resolved MIME4J-47: Applied patch contributed by Oleg Kalnichevski.

Modified:
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/MimeBoundaryInputStream.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/MultipartTokensTest.java

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/MimeBoundaryInputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/MimeBoundaryInputStream.java?rev=675695&r1=675694&r2=675695&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/MimeBoundaryInputStream.java
(original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/MimeBoundaryInputStream.java
Thu Jul 10 12:37:09 2008
@@ -127,6 +127,7 @@
     public void reset() {
         atBoundary = false;
         limit = -1;
+        eof = false;
     }
     
     public int readLine(final ByteArrayBuffer dst) throws IOException {

Modified: james/mime4j/trunk/src/test/java/org/apache/james/mime4j/MultipartTokensTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/test/java/org/apache/james/mime4j/MultipartTokensTest.java?rev=675695&r1=675694&r2=675695&view=diff
==============================================================================
--- james/mime4j/trunk/src/test/java/org/apache/james/mime4j/MultipartTokensTest.java (original)
+++ james/mime4j/trunk/src/test/java/org/apache/james/mime4j/MultipartTokensTest.java Thu
Jul 10 12:37:09 2008
@@ -101,6 +101,49 @@
         checkState(MimeTokenStream.T_END_OF_STREAM);
     }
     
+    public void testShouldParseMoreComplexMessage() throws Exception {
+        String message = 
+            "Content-Type: multipart/alternative; boundary=\"outer-boundary\"\r\n" +
+            "\r\n" +
+            "--outer-boundary\r\n" +
+            "Content-Type: multipart/alternative; boundary=\"inner-boundary\"\r\n" +
+            "\r\n" +
+            "--inner-boundary\r\n" +
+            "Content-Type: text/plain\r\n" +
+            "\r\n" +
+            "Some text\r\n" +
+            "--inner-boundary--\r\n" +
+            "\r\n" +
+            "foo\r\n" +
+            "--outer-boundary--\r\n";
+        
+        parser.parse(new ByteArrayInputStream(US_ASCII.encode(message).array()));
+        checkState(MimeTokenStream.T_START_HEADER);
+        checkState(MimeTokenStream.T_FIELD);
+        checkState(MimeTokenStream.T_END_HEADER);
+        checkState(MimeTokenStream.T_START_MULTIPART);
+        checkState(MimeTokenStream.T_PREAMBLE);
+        checkState(MimeTokenStream.T_START_BODYPART);
+        checkState(MimeTokenStream.T_START_HEADER);
+        checkState(MimeTokenStream.T_FIELD);
+        checkState(MimeTokenStream.T_END_HEADER);
+        checkState(MimeTokenStream.T_START_MULTIPART);
+        checkState(MimeTokenStream.T_PREAMBLE);
+        checkState(MimeTokenStream.T_START_BODYPART);
+        checkState(MimeTokenStream.T_START_HEADER);
+        checkState(MimeTokenStream.T_FIELD);
+        checkState(MimeTokenStream.T_END_HEADER);
+        checkState(MimeTokenStream.T_BODY);
+        checkState(MimeTokenStream.T_END_BODYPART);
+        checkState(MimeTokenStream.T_EPILOGUE);
+        checkState(MimeTokenStream.T_END_MULTIPART);
+        checkState(MimeTokenStream.T_END_BODYPART);
+        checkState(MimeTokenStream.T_EPILOGUE);
+        checkState(MimeTokenStream.T_END_MULTIPART);
+        checkState(MimeTokenStream.T_END_MESSAGE);
+        checkState(MimeTokenStream.T_END_OF_STREAM);
+    }
+    
     public void testShouldParseMessageWithEmbeddedMessage() throws Exception {
         parser.parse(new ByteArrayInputStream(US_ASCII.encode(COMPLEX_MESSAGE).array()));
         checkState(MimeTokenStream.T_START_HEADER);



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message