You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rd...@apache.org on 2008/05/25 15:55:02 UTC

svn commit: r659982 - /james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java

Author: rdonkin
Date: Sun May 25 06:55:02 2008
New Revision: 659982

URL: http://svn.apache.org/viewvc?rev=659982&view=rev
Log:
Confirmed and fixed MIME4J-36 NullPointerException in Header.writeTo with missing Content-Type https://issues.apache.org/jira/browse/MIME4J-36.

Added:
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java

Added: james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java?rev=659982&view=auto
==============================================================================
--- james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java (added)
+++ james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java Sun May 25 06:55:02 2008
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.james.mime4j.message;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import org.apache.james.mime4j.ExampleMail;
+import org.apache.james.mime4j.util.MessageUtils;
+
+import junit.framework.TestCase;
+
+public class MessageWriteToTest extends TestCase {
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+    
+    public void testSimpleMailStrictIgnore() throws Exception {
+        Message message = createMessage(ExampleMail.RFC822_SIMPLE_BYTES);
+        assertFalse("Not multipart", message.isMultipart());
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        message.writeTo(out, MessageUtils.STRICT_IGNORE);
+    }
+    
+    public void testSimpleMailStrictError() throws Exception {
+        Message message = createMessage(ExampleMail.RFC822_SIMPLE_BYTES);
+        assertFalse("Not multipart", message.isMultipart());
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        message.writeTo(out, MessageUtils.STRICT_ERROR);
+    }
+    
+    public void testSimpleMailLenient() throws Exception {
+        Message message = createMessage(ExampleMail.RFC822_SIMPLE_BYTES);
+        assertFalse("Not multipart", message.isMultipart());
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        message.writeTo(out, MessageUtils.LENIENT);
+    }
+    
+    private Message createMessage(byte[] octets) throws Exception {
+        ByteArrayInputStream in = new ByteArrayInputStream(octets);
+        Message message = new Message(in);
+        return message;
+    }
+}



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


Re: svn commit: r659982 - /james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java

Posted by Bernd Fondermann <bf...@brainlounge.de>.
Sorry for the noise, I could have sworn this was in my moderation queue?!

   Bernd

Bernd Fondermann wrote:
> On Sun, May 25, 2008 at 3:55 PM,  <rd...@apache.org> wrote:
>> Author: rdonkin
>> Date: Sun May 25 06:55:02 2008
>> New Revision: 659982
>>
>> URL: http://svn.apache.org/viewvc?rev=659982&view=rev
>> Log:
>> Confirmed and fixed MIME4J-36 NullPointerException in Header.writeTo with missing Content-Type https://issues.apache.org/jira/browse/MIME4J-36.
>>
>> Added:
>>    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java
>>
>> Added: james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java
>> URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java?rev=659982&view=auto
>> ==============================================================================
>> --- james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java (added)
>> +++ james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java Sun May 25 06:55:02 2008
>> @@ -0,0 +1,65 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements.  See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership.  The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License.  You may obtain a copy of the License at
>> + *
>> + *   http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied.  See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + */
>> +package org.apache.james.mime4j.message;
>> +
>> +import java.io.ByteArrayInputStream;
>> +import java.io.ByteArrayOutputStream;
>> +
>> +import org.apache.james.mime4j.ExampleMail;
>> +import org.apache.james.mime4j.util.MessageUtils;
>> +
>> +import junit.framework.TestCase;
>> +
>> +public class MessageWriteToTest extends TestCase {
>> +
>> +    protected void setUp() throws Exception {
>> +        super.setUp();
>> +    }
>> +
>> +    protected void tearDown() throws Exception {
>> +        super.tearDown();
>> +    }
>> +
>> +    public void testSimpleMailStrictIgnore() throws Exception {
>> +        Message message = createMessage(ExampleMail.RFC822_SIMPLE_BYTES);
>> +        assertFalse("Not multipart", message.isMultipart());
>> +        ByteArrayOutputStream out = new ByteArrayOutputStream();
>> +        message.writeTo(out, MessageUtils.STRICT_IGNORE);
>> +    }
>> +
>> +    public void testSimpleMailStrictError() throws Exception {
>> +        Message message = createMessage(ExampleMail.RFC822_SIMPLE_BYTES);
>> +        assertFalse("Not multipart", message.isMultipart());
>> +        ByteArrayOutputStream out = new ByteArrayOutputStream();
>> +        message.writeTo(out, MessageUtils.STRICT_ERROR);
>> +    }
>> +
>> +    public void testSimpleMailLenient() throws Exception {
>> +        Message message = createMessage(ExampleMail.RFC822_SIMPLE_BYTES);
>> +        assertFalse("Not multipart", message.isMultipart());
>> +        ByteArrayOutputStream out = new ByteArrayOutputStream();
>> +        message.writeTo(out, MessageUtils.LENIENT);
>> +    }
>> +
>> +    private Message createMessage(byte[] octets) throws Exception {
>> +        ByteArrayInputStream in = new ByteArrayInputStream(octets);
>> +        Message message = new Message(in);
>> +        return message;
>> +    }
>> +}
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-dev-help@james.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
> 
> 


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


Re: svn commit: r659982 - /james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java

Posted by Bernd Fondermann <be...@googlemail.com>.
On Sun, May 25, 2008 at 3:55 PM,  <rd...@apache.org> wrote:
> Author: rdonkin
> Date: Sun May 25 06:55:02 2008
> New Revision: 659982
>
> URL: http://svn.apache.org/viewvc?rev=659982&view=rev
> Log:
> Confirmed and fixed MIME4J-36 NullPointerException in Header.writeTo with missing Content-Type https://issues.apache.org/jira/browse/MIME4J-36.
>
> Added:
>    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java
>
> Added: james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java
> URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java?rev=659982&view=auto
> ==============================================================================
> --- james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java (added)
> +++ james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java Sun May 25 06:55:02 2008
> @@ -0,0 +1,65 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License.  You may obtain a copy of the License at
> + *
> + *   http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied.  See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + */
> +package org.apache.james.mime4j.message;
> +
> +import java.io.ByteArrayInputStream;
> +import java.io.ByteArrayOutputStream;
> +
> +import org.apache.james.mime4j.ExampleMail;
> +import org.apache.james.mime4j.util.MessageUtils;
> +
> +import junit.framework.TestCase;
> +
> +public class MessageWriteToTest extends TestCase {
> +
> +    protected void setUp() throws Exception {
> +        super.setUp();
> +    }
> +
> +    protected void tearDown() throws Exception {
> +        super.tearDown();
> +    }
> +
> +    public void testSimpleMailStrictIgnore() throws Exception {
> +        Message message = createMessage(ExampleMail.RFC822_SIMPLE_BYTES);
> +        assertFalse("Not multipart", message.isMultipart());
> +        ByteArrayOutputStream out = new ByteArrayOutputStream();
> +        message.writeTo(out, MessageUtils.STRICT_IGNORE);
> +    }
> +
> +    public void testSimpleMailStrictError() throws Exception {
> +        Message message = createMessage(ExampleMail.RFC822_SIMPLE_BYTES);
> +        assertFalse("Not multipart", message.isMultipart());
> +        ByteArrayOutputStream out = new ByteArrayOutputStream();
> +        message.writeTo(out, MessageUtils.STRICT_ERROR);
> +    }
> +
> +    public void testSimpleMailLenient() throws Exception {
> +        Message message = createMessage(ExampleMail.RFC822_SIMPLE_BYTES);
> +        assertFalse("Not multipart", message.isMultipart());
> +        ByteArrayOutputStream out = new ByteArrayOutputStream();
> +        message.writeTo(out, MessageUtils.LENIENT);
> +    }
> +
> +    private Message createMessage(byte[] octets) throws Exception {
> +        ByteArrayInputStream in = new ByteArrayInputStream(octets);
> +        Message message = new Message(in);
> +        return message;
> +    }
> +}
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>

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