[
https://issues.apache.org/jira/browse/PDFBOX-1884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tim Allison updated PDFBOX-1884:
--------------------------------
Attachment: PDFBOX-1884.patch.zip
Patch with unit tests and test file attached.
Place test file in: src/test/resources/org/apache/pdfbox/pdmodel, and you
should be good to go.
The strategy I chose for the fix was to initialize an empty COSDictionary if
the dict that was passed in to PDComplexFileSpecification was null.
A fix that would be truer to the underlying PDF objects would be to set the
PDComplexFileSpecification = COSNull or null instead of building an object with
a null dict, but that would require many more changes throughout.
Happy to draft alternate solution if that is preferred. Thank you.
> Avoid NPE when encountering null PDComplexFileSpecification
> -----------------------------------------------------------
>
> Key: PDFBOX-1884
> URL: https://issues.apache.org/jira/browse/PDFBOX-1884
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 1.8.4
> Reporter: Tim Allison
> Priority: Minor
> Attachments: PDFBOX-1884.patch.zip,
> null_PDComplexFileSpecification.pdf
>
>
> In some pdfs in the wild, PDComplexFileSpecification can be null. It would be
> great if we could skip those files that don't have any contents and not throw
> an NPE.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)