Skip to content

NullPointer when parsing Outlook Message with nested empty Outlook message #326

@Faelean

Description

@Faelean

Hi,
when I run the following code I get a NullPointer for some msg files. Parsing the file with the OutlookMessageParser and then calling the getDate() method doesn't produce the error so the problem appears to be related to converting the OutlookMessage to an Email.
This doesn't affect the majority of mails and I haven't figured out what's special about the example mails I have.
I can't publish these mails here, but if you want I can send them to you.

	public static void main(String[] args) throws IOException {
		String msgFileName = ".\\files\\example.msg";
		
		try (FileInputStream fileInputStream = new FileInputStream(msgFileName)) {

			Email email = EmailConverter.outlookMsgToEmail(fileInputStream);
			
			//OutlookMessageParser outlookMessageParser = new OutlookMessageParser();
			//OutlookMessage outlookMessage = outlookMessageParser.parseMsg(fileInputStream);
			//outlookMessage.getDate();
		}
	}
Exception in thread "main" java.lang.NullPointerException
	at org.simplejavamail.outlookmessageparser.model.OutlookMessage.getDate(OutlookMessage.java:856)
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.buildEmailFromOutlookMessage(OutlookEmailConverter.java:102)
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.buildEmailFromOutlookMessage(OutlookEmailConverter.java:123)
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.outlookMsgToEmailBuilder(OutlookEmailConverter.java:85)
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmailBuilder(EmailConverter.java:230)
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:212)
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:204)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions