Uploaded image for project: 'XMLGraphicsCommons'
  1. XMLGraphicsCommons
  2. XGC-130

NullPointerException in org.apache.xmlgraphics.xmp.XMPHandler.endElement

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.7
    • 2.8
    • xmp
    • None

    Description

      Hi there, 

      when using XMP metadata for formatting objects I get a null pointer from the org.apache.xmlgraphics.xmp.XMPHandler class.

      I also opened a ticket in fop (https://issues.apache.org/jira/browse/FOP-3076) But it seems the bug is happening in XMPHandler. Attached the formatting objects file with the XMP metadata. 

      Would be really nice if you could have a look at it.

      Thank you,

      Gregor

      I am running the command:

      fop -r -fo zugferd.fo -pdf zugferd.pdf

      Juni 10, 2022 7:09:35 PM org.apache.fop.cli.Main startFOP
      SEVERE: Exception
      org.apache.fop.apps.FOPException: java.lang.NullPointerException
      java.lang.NullPointerException
              at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:296)
              at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:116)
              at org.apache.fop.cli.Main.startFOP(Main.java:183)
              at org.apache.fop.cli.Main.main(Main.java:214)
      Caused by: java.lang.NullPointerException
              at org.apache.xmlgraphics.xmp.XMPHandler.endElement(XMPHandler.java:291)
              at org.apache.fop.fo.FOTreeBuilder$3.run(FOTreeBuilder.java:207)
              at org.apache.fop.fo.FOTreeBuilder$3.run(FOTreeBuilder.java:204)
              at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
              at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:203)
              at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1102)
              at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
              at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)
              at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
              at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
              at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
              at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
              at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
              at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
              at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
              at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
              at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)
              at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:293)
              ... 3 more

       

       

      The bug might also be caused in org.apache.xmlgraphics.xmp.XMPHandler

      The line before the null pointer stated

      assert getCurrentProperties() != null : "no current property";

       

      The FO File is also attached to this report.

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
      <fo:simple-page-master master-name="master-first-page" page-width="210mm" page-height="297mm" margin-top="0mm"
      margin-bottom="0mm" margin-left="0mm" margin-right="0mm">
      <fo:region-body margin-top="90mm" margin-bottom="25mm" margin-left="15mm" margin-right="15mm"/>

      </fo:simple-page-master>
      </fo:layout-master-set>

      <x:xmpmeta xmlns:x="adobe:ns:meta/">
      <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:Description xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/"
      xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#"
      xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#" rdf:about="">
      <pdfaExtension:schemas>
      <rdf:Bag>
      <rdf:li rdf:parseType="Resource">
      <pdfaSchema:schema>Factur-X PDFA Extension Schema</pdfaSchema:schema>
      <pdfaSchema:namespaceURI>urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#
      </pdfaSchema:namespaceURI>
      <pdfaSchema:prefix>fx</pdfaSchema:prefix>
      <pdfaSchema:property>
      <rdf:Seq>
      <rdf:li rdf:parseType="Resource">
      <pdfaProperty:name>DocumentFileName</pdfaProperty:name>
      <pdfaProperty:valueType>Text</pdfaProperty:valueType>
      <pdfaProperty:category>external</pdfaProperty:category>
      <pdfaProperty:description>name of the embedded XML invoice file
      </pdfaProperty:description>
      </rdf:li>
      <rdf:li rdf:parseType="Resource">
      <pdfaProperty:name>DocumentType</pdfaProperty:name>
      <pdfaProperty:valueType>Text</pdfaProperty:valueType>
      <pdfaProperty:category>external</pdfaProperty:category>
      <pdfaProperty:description>INVOICE</pdfaProperty:description>
      </rdf:li>
      <rdf:li rdf:parseType="Resource">
      <pdfaProperty:name>Version</pdfaProperty:name>
      <pdfaProperty:valueType>Text</pdfaProperty:valueType>
      <pdfaProperty:category>external</pdfaProperty:category>
      <pdfaProperty:description>The actual version of the Factur-X XML schema
      </pdfaProperty:description>
      </rdf:li>
      <rdf:li rdf:parseType="Resource">
      <pdfaProperty:name>ConformanceLevel</pdfaProperty:name>
      <pdfaProperty:valueType>Text</pdfaProperty:valueType>
      <pdfaProperty:category>external</pdfaProperty:category>
      <pdfaProperty:description>The conformance level of the embedded Factur-X data
      </pdfaProperty:description>
      </rdf:li>
      </rdf:Seq>
      </pdfaSchema:property>
      </rdf:li>
      </rdf:Bag>
      </pdfaExtension:schemas>
      </rdf:Description>

      <rdf:Description xmlns:fx="urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#" rdf:about=""
      fx:ConformanceLevel="EN 16931" fx:DocumentFileName="factur-x.xml" fx:DocumentType="INVOICE"
      fx:Version="1.0"/>
      </rdf:RDF>
      </x:xmpmeta>

      <fo:page-sequence master-reference="master-first-page">
      <fo:flow flow-name="xsl-region-body">
      <fo:block color="#313131">Hello ZUGFeRD</fo:block>
      </fo:flow>
      </fo:page-sequence>
      </fo:root>

      Attachments

        1. zugferd.fo
          4 kB
          Gregor Müller
        2. zugferd-1.fo
          5 kB
          Gregor Müller

        Activity

          People

            ssteiner Simon Steiner
            gmueller Gregor Müller
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: