bbottema / outlook-message-parser

A Java parser for Outlook messages (.msg files)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NPE on ClientSubmitTime when original message has not been sent yet

bbottema opened this issue · comments

Copied from bbottema/simple-java-mail#243

While investigating bbottema/outlook-message-parser#23 we found an issue with the OutlookMessage.getClientSubmitTime() method.

java.lang.NullPointerException
	at org.simplejavamail.outlookmessageparser.model.OutlookMessage.getClientSubmitTime(OutlookMessage.java:849)
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.buildEmailFromOutlookMessage(OutlookEmailConverter.java:73)
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.outlookMsgToEmailBuilder(OutlookEmailConverter.java:60)
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmailBuilder(EmailConverter.java:226)
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:209)
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:201)

The issue is present with the following test emails from the outlook-message-parser.

  • tst_unicode.msg
  • unsent draft.msg
  • chinese message.msg
  • forward with attachments and embedded images.msg
  • the nested mail from 'nested simple mail.msg'

Seems like this created another issue:
This is from the tst_unicode.msg

java.lang.IllegalArgumentException: Implicit NotNull argument 1 of org/simplejavamail/email/internal/EmailPopulatingBuilderImpl.to must not be null
	at org.simplejavamail.email.internal.EmailPopulatingBuilderImpl.to(EmailPopulatingBuilderImpl.java)
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.copyReceiversFromOutlookMessage(OutlookEmailConverter.java:97)
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.buildEmailFromOutlookMessage(OutlookEmailConverter.java:77)
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.outlookMsgToEmailBuilder(OutlookEmailConverter.java:60)
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmailBuilder(EmailConverter.java:226)
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:209)
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:201)

Second thing, I don't know if this might be a seperate issue:
Using the unsent draft.msg, the sender looks like this:

image

Seems like this created another issue:
This is from the tst_unicode.msg

How do I reproduce this, @Faelean?

Second thing, I don't know if this might be a seperate issue:

I'll have a look, thanks for the heads up. Quick question, this worked for you previously or you just noticed it now?

Seems like this created another issue:
This is from the tst_unicode.msg

How do I reproduce this, @Faelean?

I haven't change anything in my code, the two mails creating issues are the same as before. I haven't seen this issue because of the NullPointer.

Sorry I missunderstood, I commented here because you 'moved' the issue in Simple Java Mail here, the original call is EmailConverter.outlookMsgToEmail(stream) from Simple Java Mail.

@Faelean as for the IllegalArgumentException, please refer to #26 (fix released in 1.7.2).

As for the other issue, I suspect this is an Outlook version problem where the properties work differently. This is an email that doesn't have a sent-address (yet), but the property for it is still encoded with a garbage value.

I'm not sure how to handle this yet.

@Faelean as for garbage sender issue, please refer to #27 (fix released in 1.7.3).

@Faelean, Simple Java Mail now uses 1.7.3 in release 6.0.1