james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mariano Kamp (JIRA)" <mime4j-...@james.apache.org>
Subject [jira] [Comment Edited] (MIME4J-235) NPE during parsing of an message
Date Wed, 08 Jan 2014 14:31:52 GMT

    [ https://issues.apache.org/jira/browse/MIME4J-235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13865474#comment-13865474
] 

Mariano Kamp edited comment on MIME4J-235 at 1/8/14 2:30 PM:
-------------------------------------------------------------

Here you go:
{code:title=Test.java|borderStyle=solid}
import java.io.FileInputStream;
import java.io.IOException;

import org.apache.james.mime4j.dom.Message;
import org.apache.james.mime4j.message.DefaultMessageBuilder;
import org.apache.james.mime4j.stream.MimeConfig;

public class Test {
	
	public static void main(String[] args) throws IOException {
		
		FileInputStream fis = new FileInputStream("errors/error-205-NullPointerException.mbox");
		
		DefaultMessageBuilder messageBuilder = new DefaultMessageBuilder();
		messageBuilder.setMimeEntityConfig(new MimeConfig.Builder()
				.setMaxLineLen(-1).setMaxHeaderLen(-1).setMaxHeaderCount(-1)
				.build());
		Message message = messageBuilder.parseMessage(fis);
		System.out.println(message);
		
		fis.close();
	}

}
{code}

This produces:

{code}
Exception in thread "main" java.lang.NullPointerException
	at org.apache.james.mime4j.io.MimeBoundaryInputStream.<init>(MimeBoundaryInputStream.java:67)
	at org.apache.james.mime4j.stream.MimeEntity.createMimePartStream(MimeEntity.java:366)
	at org.apache.james.mime4j.stream.MimeEntity.advance(MimeEntity.java:320)
	at org.apache.james.mime4j.stream.MimeTokenStream.next(MimeTokenStream.java:368)
	at org.apache.james.mime4j.parser.MimeStreamParser.parse(MimeStreamParser.java:176)
	at org.apache.james.mime4j.message.DefaultMessageBuilder.parseMessage(DefaultMessageBuilder.java:316)
	at Test.main(Test.java:19)
{code}

Technically you would need to remove the last lines from the testfile as this is the stacktrace
of the original error in hadoop. But it "works" either way, producing the NPE that is.

As reported and mentioned on the list this happens with 0.8.0, the only version that I was
able to download.

Best, Mariano


was (Author: mariano.kamp):
Here you go:
{code:title=Test.java|borderStyle=solid}
import java.io.FileInputStream;
import java.io.IOException;

import org.apache.james.mime4j.dom.Message;
import org.apache.james.mime4j.message.DefaultMessageBuilder;
import org.apache.james.mime4j.stream.MimeConfig;

public class Test {
	
	public static void main(String[] args) throws IOException {
		
		FileInputStream fis = new FileInputStream("errors/error-205-NullPointerException.mbox");
		
		DefaultMessageBuilder messageBuilder = new DefaultMessageBuilder();
		messageBuilder.setMimeEntityConfig(new MimeConfig.Builder()
				.setMaxLineLen(-1).setMaxHeaderLen(-1).setMaxHeaderCount(-1)
				.build());
		Message message = messageBuilder.parseMessage(fis);
		System.out.println(message);
		
		fis.close();
	}

}
{code}

This produces:

Exception in thread "main" java.lang.NullPointerException
	at org.apache.james.mime4j.io.MimeBoundaryInputStream.<init>(MimeBoundaryInputStream.java:67)
	at org.apache.james.mime4j.stream.MimeEntity.createMimePartStream(MimeEntity.java:366)
	at org.apache.james.mime4j.stream.MimeEntity.advance(MimeEntity.java:320)
	at org.apache.james.mime4j.stream.MimeTokenStream.next(MimeTokenStream.java:368)
	at org.apache.james.mime4j.parser.MimeStreamParser.parse(MimeStreamParser.java:176)
	at org.apache.james.mime4j.message.DefaultMessageBuilder.parseMessage(DefaultMessageBuilder.java:316)
	at Test.main(Test.java:19)

Technically you would need to remove the last lines from the testfile as this is the stacktrace
of the original error in hadoop. But it "works" either way, producing the NPE that is.

As reported and mentioned on the list this happens with 0.8.0, the only version that I was
able to download.

Best, Mariano

> NPE during parsing of an message
> --------------------------------
>
>                 Key: MIME4J-235
>                 URL: https://issues.apache.org/jira/browse/MIME4J-235
>             Project: James Mime4j
>          Issue Type: Bug
>          Components: parser (core)
>    Affects Versions: 0.8.0
>            Reporter: Mariano Kamp
>         Attachments: error-205-NullPointerException.mbox, error-95-NullPointerException.mbox
>
>
> Ran into an NPE. Reported it to the mailing list, was referred to here.
> http://mail-archives.apache.org/mod_mbox/james-mime4j-dev/201401.mbox/browser
> The linked message also contains the offending mail as well as the full strack trace.
> Don't see how I could upload the file here.
> java.lang.NullPointerException
> at
> org.apache.james.mime4j.io.MimeBoundaryInputStream.<init>(MimeBoundaryInputStream.java:67)
> at
> org.apache.james.mime4j.stream.MimeEntity.createMimePartStream(MimeEntity.java:366)
> at
> org.apache.james.mime4j.stream.MimeEntity.advance(MimeEntity.java:320)
> at
> org.apache.james.mime4j.stream.MimeTokenStream.next(MimeTokenStream.java:368)
> at
> org.apache.james.mime4j.parser.MimeStreamParser.parse(MimeStreamParser.java:176)
> at
> org.apache.james.mime4j.message.DefaultMessageBuilder.parseMessage(DefaultMessageBuilder.java:316)
> at com.mboxanalytics.util.MboxUtil.parseMessage(MboxUtil.java:95)



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message