Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException on Microsoft OneDrive Attachments #77

Open
dietmar opened this issue Apr 9, 2019 · 0 comments
Open

NullPointerException on Microsoft OneDrive Attachments #77

dietmar opened this issue Apr 9, 2019 · 0 comments

Comments

@dietmar
Copy link

dietmar commented Apr 9, 2019

Possibly the same problem as reported in #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).

  • They all returned 7 from getAttachMethod() (which shouldn't even be possible according to http://rjohnsondev.github.io/java-libpst/com/pff/PSTAttachment.html#getAttachMethod--)
  • Most of them returned an URL of the form https://1drv.ms/.../<some random string> from getLongPathname()
  • Some of them returned an URL of the form https://<some company name>.sharepoint.com/.../<some random string>
  • Entering these URLs in a web browser, I can access the files, but Microsoft annoyingly tries to make it difficult to do that programmatically, so finally I didn't bother and just excluded these e-mails.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant