Project

Profile

Help

Bug #2185

closed

NullPointerException when setting a parameter value

Added by Radu Pisoi about 10 years ago. Updated about 10 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2014-10-16
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

I obtained the following exception when setting a parameter value in a transformer:

Exception in thread "main" java.lang.NullPointerException
	at net.sf.saxon.s9api.XsltExecutable.getGlobalParameters(XsltExecutable.java:126)
	at net.sf.saxon.jaxp.TransformerImpl.setParameter(TransformerImpl.java:196)
	at com.oxygenxml.xsl.saxon.RunTransformation.main(RunTransformation.java:62)

The exception above could be obtained by running the next sample Java application:

public static void main(String[] args) throws TransformerException {
	// Create transformer
	TransformerFactory transformerFactory = TransformerFactoryImpl.newInstance();
	
	File xslFile = new File(xslPath);		
	InputSource inputSource = new InputSource(xslFile.toURI().toString());
	Source source = new SAXSource(inputSource);
	Transformer transformer = transformerFactory.newTransformer(source);
	
	// Create XML  SAX source
	Source xmlSource = new SAXSource(new InputSource(new File(xmlPath).toURI().toString()));
	
	// Output stream result
	Result outputTarget = new StreamResult(new File(outPath));
	
	// Run transformation
	transformer.setParameter("param", "2.0");
	transformer.transform(xmlSource, outputTarget);
}

Where XML file content is:

<?xml version="1.0" encoding="UTF-8"?>
<root/>

and XSL file content is:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    <xsl:template match="/">  
        test
    </xsl:template>
</xsl:stylesheet>

Related issues

Is duplicate of Saxon - Bug #2178: NullPointerException in TransformerImpl.setParameter()Closed2014-10-13

Actions
Has duplicate Saxon - Bug #2203: NPE in XsltExecutable with 9.6.0-1DuplicateMichael Kay2014-10-29

Actions
Actions #1

Updated by Michael Kay about 10 years ago

  • Status changed from New to Duplicate
  • Priority changed from Low to Normal

Please register to edit this issue

Also available in: Atom PDF