Hauke Haastert created FOP-2362:
-----------------------------------

             Summary: Rendering AFP extension to intermediate format throws 
NullPointerException
                 Key: FOP-2362
                 URL: https://issues.apache.org/jira/browse/FOP-2362
             Project: Fop
          Issue Type: Bug
          Components: general
    Affects Versions: 1.1
         Environment: Apple OSX 10.9.2 / Java version 1.7.0_11
            Reporter: Hauke Haastert


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
(v6.2#6252)

Reply via email to