Description
I get this NPE with the attached file:
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)
The cause is this:
<xapMM:DerivedFrom rdf:parseType="Resource"/>
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.