Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-2477

NPE in DomXmpParser.createProperty

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.7, 1.8.8, 2.0.0
    • 1.8.8, 2.0.0
    • XmpBox
    • None

    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.

      Attachments

        1. gs-bugzilla692826.pdf
          1.31 MB
          Tilman Hausherr

        Activity

          People

            tilman Tilman Hausherr
            tilman Tilman Hausherr
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: