rjohnsondev / java-libpst

A library to read PST files with java, without need for external libraries.
249 stars 122 forks source link

NullPointerException on Microsoft OneDrive Attachments #77

Open dietmar opened 5 years ago

dietmar commented 5 years ago

Possibly the same problem as reported in https://github.com/rjohnsondev/java-libpst/issues/31

I am processing > 200k e-mails from .pst files with your library version 0.9.4. On 30 of my e-mails, I get a NullPointerException when calling getFileInputStream()

java.lang.NullPointerException
        at com.pff.PSTAttachment.getFileInputStream(PSTAttachment.java:123)

I dug into it and in one case it was a corrupt attachment that I also couldn't open in Microsoft Outlook.

However, for the other 29 problematic attachments, it turned out that they were "attachments" in the form of OneDrive links (see also https://www.msoutlook.info/question/attach-instead-of-link-to-onedrive-files, for example).

Maybe you want to deal with this Microsoft weirdness more gracefully in your library, for example by printing a warning, instead of running into a NullPointerException. But maybe it's also not worth the effort; at least according to my sample, these things are fortunately quite rare.

Thanks for java-libpst by the way!