Project

Profile

Help

NullPointer exception in instruct.CopyOf

Added by Anonymous over 18 years ago

Legacy ID: #3416860 Legacy Poster: Lloyd McKenzie (lmckenzi)

When the following transform is run in Saxon 8.6, it dies with a NullPointerException. It doesn't matter what input file you run it on because saxon dies in the transform compile stage. All that matters is that the input file actually exists. The process to re-create the problem is: java - jar saxon8.jar -T whatever.xml test.xsl The problem occurs with both java 1.4.2_06 and 1.5.0_01-b08. It does not occur with saxon7.jar The problem actually surfaced in a more complex transform and occurred even without the "-T" option. However, I've chopped it down to the bare minimum and the -T option does seem to be necessary to cause the problem to occur in this stripped down version. I recognize that the transform as shown isn't terribly useful, but that's because it's been stripped down to the bare minimum. The contents of test.xsl is: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template name="someTemplate"> <xsl:variable name="someVariable"> <xsl:for-each select="*"> <xsl:copy-of select="."/> </xsl:for-each> </xsl:variable> <xsl:for-each select="$someVariable"/> </xsl:template> </xsl:stylesheet> The resulting stack-trace is: Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor java.lang.NullPointerException at net.sf.saxon.instruct.CopyOf.createsNewNodes(CopyOf.java:59) at net.sf.saxon.instruct.Instruction.computeSpecialProperties(Instruction.java:205) at net.sf.saxon.expr.ComputedExpression.computeStaticProperties(ComputedExpression.java:285) at net.sf.saxon.expr.ComputedExpression.getSpecialProperties(ComputedExpression.java:274) at net.sf.saxon.instruct.TraceWrapper.createsNewNodes(TraceWrapper.java:149) at net.sf.saxon.instruct.Instruction.computeSpecialProperties(Instruction.java:205) at net.sf.saxon.expr.ComputedExpression.computeStaticProperties(ComputedExpression.java:285) at net.sf.saxon.expr.ComputedExpression.getSpecialProperties(ComputedExpression.java:274) at net.sf.saxon.instruct.ForEach.createsNewNodes(ForEach.java:68) at net.sf.saxon.instruct.Instruction.computeSpecialProperties(Instruction.java:205) at net.sf.saxon.expr.ComputedExpression.computeStaticProperties(ComputedExpression.java:285) at net.sf.saxon.expr.ComputedExpression.getDependencies(ComputedExpression.java:346) at net.sf.saxon.instruct.TraceWrapper.getDependencies(TraceWrapper.java:139) at net.sf.saxon.expr.ComputedExpression.computeDependencies(ComputedExpression.java:363) at net.sf.saxon.expr.ComputedExpression.computeStaticProperties(ComputedExpression.java:285) at net.sf.saxon.expr.ComputedExpression.getSpecialProperties(ComputedExpression.java:274) at net.sf.saxon.expr.LetExpression.typeCheck(LetExpression.java:56) at net.sf.saxon.instruct.TraceWrapper.typeCheck(TraceWrapper.java:39) at net.sf.saxon.instruct.TraceWrapper.typeCheck(TraceWrapper.java:39) at net.sf.saxon.style.XSLTemplate.compile(XSLTemplate.java:304) at net.sf.saxon.style.XSLStylesheet.compileStylesheet(XSLStylesheet.java:1018) at net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:290) at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:117) at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:130) at net.sf.saxon.Transform.doMain(Transform.java:435) at net.sf.saxon.Transform.main(Transform.java:60) Fatal error during transformation: null Can you confirm that this is a bug, and if so, let me know when it's fixed? Thanks!


Replies (2)

RE: NullPointer exception in instruct.CopyOf - Added by Anonymous over 18 years ago

Legacy ID: #3417477 Legacy Poster: Michael Kay (mhkay)

Thanks. This is the second time this has been reported today. I've logged the bug with a patch at https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1350704&amp;group_id=29872&amp;atid=397617 I'm afraid this one is sufficiently bad it will warrant a maintenance release. Michael Kay

RE: NullPointer exception in instruct.CopyOf - Added by Anonymous over 18 years ago

Legacy ID: #3417484 Legacy Poster: Michael Kay (mhkay)

In the meantime, please note that you can probably replace xsl:copy-of with xsl:sequence as a workaround.

    (1-2/2)

    Please register to reply