xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aron Nopanen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FOP-2362) [PATCH] Using Saxon to intermediate format throws NullPointerException
Date Tue, 31 Oct 2017 22:33:00 GMT

    [ https://issues.apache.org/jira/browse/FOP-2362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16227712#comment-16227712

Aron Nopanen commented on FOP-2362:

Please note this same class of problem still happens in FOP 2.2 when writing external objects
to Area Tree output. The issue is in DOM2SAX.writeNode when writing element attributes: Node.getNamespaceURI()
can return null, and this is passed through to AttributesImpl.addAttribute.

> [PATCH] Using Saxon to intermediate format throws NullPointerException
> ----------------------------------------------------------------------
>                 Key: FOP-2362
>                 URL: https://issues.apache.org/jira/browse/FOP-2362
>             Project: FOP
>          Issue Type: Bug
>          Components: unqualified
>    Affects Versions: 1.1
>         Environment: Apple OSX 10.9.2 / Java version 1.7.0_11
>            Reporter: Hauke Haastert
>            Assignee: simon steiner
>         Attachments: extensions.diff, simple.xsl, test.fo
> When rendering an XSL-FO file that contains an AFP-Extension to the intermediate format
while using Saxon as XSLT transformer, a NullPointerException is thrown.
> Steps to reproduce:
> 1. Download and unpack the FOP 1.1 binary release.
> 2. Change into the root directory "fop-1.1" of the release
> 3. Download Saxon HE from http://repo1.maven.org/maven2/net/sf/saxon/Saxon-HE/9.4/Saxon-HE-9.4.jar
and copy the file to the lib directory of the FOP 1.1 release
> 4. Edit the file fop that is located in the root directory of the release and add the
following JVM parameter to the java_exec_args:
>     -Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl
>     The line should now look like:
>     java_exec_args="-Djava.awt.headless=true -Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl"
> 5. Download the attached files test.fo and simple.xsl and run the following fop command:
>     fop -fo test.fo -out application/X-fop-intermediate-format test.if.xml
> Actual Results:
> Application throws NullPointerException:
> java.lang.NullPointerException
>     at net.sf.saxon.event.ReceivingContentHandler.getNodeName(ReceivingContentHandler.java:391)
>     at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:316)
>     at org.apache.fop.util.DelegatingContentHandler.startElement(DelegatingContentHandler.java:185)
>     at org.apache.fop.render.afp.extensions.AFPPageSetup.toSAX(AFPPageSetup.java:125)
>     at org.apache.fop.render.intermediate.IFSerializer.handleExtensionObject(IFSerializer.java:680)
> Expected Results:
>     Application should render IF from FO
> Additional Information:
> In the toSAX method of the class org.apache.fop.render.afp.extensions.AFPPageSetup the
method addAttribute of the class org.xml.sax.helpers.AttributesImpl is called with null as
first argument. Due to the APIDOC of the class org.xml.sax.helpers.AttributesImpl the first
argument must either be the namespace or an empty string, but not null:
>     uri - The Namespace URI, or the empty string if none is available or Namespace processing
is not being performed.
> When changing the parameter value to an empty string, no NullPointerException is thrown
anymore. The same problem exists in other classes in the package org.apache.fop.render.afp.extensions,
so I added a diff file for the complete package (extensions.diff).
> The exception is not thrown when using Xalan as XSL transformer. 

This message was sent by Atlassian JIRA

View raw message