Gregor Müller created FOP-3076:
----------------------------------
Summary: Nullpointer with ZUGFeRD XMP MetaData
Key: FOP-3076
URL: https://issues.apache.org/jira/browse/FOP-3076
Project: FOP
Issue Type: Bug
Components: fo/unqualified
Affects Versions: 2.7
Reporter: Gregor Müller
Attachments: zugferd.fo
ZUGFeRD allows to add invoice meta data in XML form to pdf documents. Adding
the file as attachment works really well. However the ZUGFeRD Standard also
requires to add XMP Metadata. When doing that a NullPointerException occurs.
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>}}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)