[ 
https://issues.apache.org/jira/browse/PDFBOX-2477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14194919#comment-14194919
 ] 

ASF subversion and git services commented on PDFBOX-2477:
---------------------------------------------------------

Commit 1636417 from [~tilman] in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1636417 ]

PDFBOX-2477: avoid NPE in ResourceRef with no child elements; minor code cleanup

> NPE in DomXmpParser.createProperty
> ----------------------------------
>
>                 Key: PDFBOX-2477
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2477
>             Project: PDFBox
>          Issue Type: Bug
>          Components: XmpBox
>    Affects Versions: 1.8.7, 1.8.8, 2.0.0
>            Reporter: Tilman Hausherr
>            Assignee: Tilman Hausherr
>             Fix For: 1.8.8, 2.0.0
>
>         Attachments: gs-bugzilla692826.pdf
>
>
> I get this NPE with the attached file:
> {code}
> Exception in thread "main" java.lang.NullPointerException
>       at 
> org.apache.xmpbox.xml.DomXmpParser.createProperty(DomXmpParser.java:352)
>       at 
> org.apache.xmpbox.xml.DomXmpParser.parseDescriptionRoot(DomXmpParser.java:292)
>       at org.apache.xmpbox.xml.DomXmpParser.parse(DomXmpParser.java:206)
>       at org.apache.xmpbox.xml.DomXmpParser.parse(DomXmpParser.java:114)
>       at 
> org.apache.pdfbox.preflight.process.MetadataValidationProcess.validate(MetadataValidationProcess.java:67)
>       at 
> org.apache.pdfbox.preflight.utils.ContextHelper.callValidation(ContextHelper.java:73)
>       at 
> org.apache.pdfbox.preflight.utils.ContextHelper.validateElement(ContextHelper.java:88)
>       at 
> org.apache.pdfbox.preflight.PreflightDocument.validate(PreflightDocument.java:168)
>       at 
> org.apache.pdfbox.preflight.Validator_A1b.runSimple(Validator_A1b.java:161)
>       at 
> org.apache.pdfbox.preflight.Validator_A1b.main(Validator_A1b.java:126)
> {code}
> The cause is this:
> {code}
> <xapMM:DerivedFrom rdf:parseType="Resource"/>
> {code}
> According to the XMP spec, that part can have missing elements, i.e. it is 
> not an error. So I'll just add a null check.
> There are more potiential NPE risks in that code, however I prefer to get 
> examples.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to