You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NullPointer when parsing Outlook Message with nested empty Outlook message #326
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.
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)
I can understand the exception bug when date is null somehow, but I cannot explain the difference between converting it with EmailConverter vs OutlookMessageParser. I would actually like to reproduce it with the debugger, so if you could send your problem email, I would really appreciate it.
It turns out that outlook-message-parser identifies a nested Outlook message attached, which is completely empty (which is invalid). I'm not sure why it finds a nested Outlook attachment, but I need some criteria by which I can ignore such an attachment.
This use case is resolved if I reject nested Outlook messages when their ID is empty, but I have no idea if this is always the case. At least all the existing junit tests still pass, including the ones with nested message attachments, but I would like to have more confidence in this solution.
I fixed the issue which will be in release 7.0.0. It might take some time for this fix to go public because of that. In the meantime, you can fix it by forcing the outlook-message-parser dependency to version >= 1.7.12.
<dependencyManagement>
<dependencies>
<dependency><!-- fixes #326 (workaround until SJM 7.0.0 is released) -->
<groupId>org.simplejavamail</groupId>
<artifactId>outlook-message-parser</artifactId>
<version>1.7.12</version>
</dependency>
</dependencies>
</dependencyManagement>
changed the title [-]NullPointer when parsing Outlook Message[/-][+]NullPointer when parsing Outlook Message with nested empty Outlook message[/+]on Jan 2, 2022
Activity
bbottema commentedon Jun 28, 2021
I can understand the exception bug when date is null somehow, but I cannot explain the difference between converting it with EmailConverter vs OutlookMessageParser. I would actually like to reproduce it with the debugger, so if you could send your problem email, I would really appreciate it.
bbottema commentedon Jun 30, 2021
It turns out that outlook-message-parser identifies a nested Outlook message attached, which is completely empty (which is invalid). I'm not sure why it finds a nested Outlook attachment, but I need some criteria by which I can ignore such an attachment.
bbottema commentedon Jun 30, 2021
This use case is resolved if I reject nested Outlook messages when their ID is empty, but I have no idea if this is always the case. At least all the existing junit tests still pass, including the ones with nested message attachments, but I would like to have more confidence in this solution.
#326: fixed NPE with incorrectly generated nested empty outlook message
bbottema commentedon Jul 3, 2021
I fixed the issue which will be in release 7.0.0. It might take some time for this fix to go public because of that. In the meantime, you can fix it by forcing the outlook-message-parser dependency to version >= 1.7.12.
[-]NullPointer when parsing Outlook Message[/-][+]NullPointer when parsing Outlook Message with nested empty Outlook message[/+]bbottema commentedon Jan 2, 2022
7.0.0 just released with the fix for this.