Project

Profile

Help

Bug #2590

closed

NPE when saxon:assign refers to an undeclared variable

Added by Radu Coravu almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Saxon extensions
Sprint/Milestone:
Start date:
2016-01-19
Due date:
% Done:

100%

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

Description

I obtained a NPE trying to compile a larger XSL.

I reduced the XSL it to this:

<xsl:stylesheet version="2.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:saxon="http://saxon.sf.net/"
    extension-element-prefixes="saxon">
    
    <xsl:template name="formatStringByToken" as="text()*">
        <xsl:value-of select="$newLine"/>
        <saxon:assign name="remain" select="$prmLength"/>
    </xsl:template>
</xsl:stylesheet>

When I compile it I obtain:

<pre>
java.lang.NullPointerException
	at com.saxonica.xsltextn.style.SaxonAssign.validate(SaxonAssign.java:53)
	at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1610)
	at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1645)
	at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1614)
	at net.sf.saxon.style.StylesheetPackage.preprocess(StylesheetPackage.java:478)
	at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:180)
	at net.sf.saxon.style.Compilation.compileSingletonPackage(Compilation.java:94)
	at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:543)
	at net.sf.saxon.jaxp.SaxonTransformerFactory.newTemplates(SaxonTransformerFactory.java:175)
	at net.sf.saxon.jaxp.SaxonTransformerFactory.newTransformer(SaxonTransformerFactory.java:129)
	at ro.sync.xml.transformer.TransformerCreator.createXSLTransformer(TransformerCreator.java:1453)
	at ro.sync.xml.transformer.TransformerCreator.createTransformer(TransformerCreator.java:736)
	at ro.sync.xml.transformer.TransformerCreator.createValidationOnlyTransformer(TransformerCreator.java:597)
	at ro.sync.exml.validate.scanners.StylesheetErrorScanner.scanInternal(StylesheetErrorScanner.java:370)
	at ro.sync.exml.validate.AbstractErrorScanner$1.run(AbstractErrorScanner.java:177)
	at ro.sync.exml.validate.AbstractErrorScanner$1.run(AbstractErrorScanner.java:1)
	at java.security.AccessController.doPrivileged(Native Method)
	at ro.sync.util.security.Sandbox.runWithPerms(Sandbox.java:726)
	at ro.sync.exml.validate.AbstractErrorScanner$2$1$1.run(AbstractErrorScanner.java:211)
	at ro.sync.exml.validate.AbstractErrorScanner$2$1$1.run(AbstractErrorScanner.java:1)
	at ro.sync.util.security.Sandbox.runWithThreadConfirmation(Sandbox.java:921)
	at ro.sync.exml.validate.AbstractErrorScanner$2$1.run(AbstractErrorScanner.java:207)
	at ro.sync.exml.validate.AbstractErrorScanner$2$1.run(AbstractErrorScanner.java:1)
	at ro.sync.util.security.Sandbox.runWithWriteConfirmation(Sandbox.java:898)
	at ro.sync.exml.validate.AbstractErrorScanner$2.run(AbstractErrorScanner.java:203)
	at ro.sync.exml.validate.AbstractErrorScanner$2.run(AbstractErrorScanner.java:1)
	at ro.sync.util.security.Sandbox.runWithConnectConfirmation(Sandbox.java:877)
	at ro.sync.exml.validate.AbstractErrorScanner.scan(AbstractErrorScanner.java:200)
	at ro.sync.exml.validate.scanners.SynchronizedErrorScanner.scan(SynchronizedErrorScanner.java:123)
	at ro.sync.exml.editor.validate.ValidationAssistant.processErrors(ValidationAssistant.java:1244)
	at ro.sync.exml.editor.validate.ValidationAssistant.runValidation(ValidationAssistant.java:890)
	at ro.sync.exml.editor.validate.ValidationAssistant.runValidation(ValidationAssistant.java:763)
	at ro.sync.exml.editor.validate.ValidationAssistant.checkForErrors(ValidationAssistant.java:743)
	at ro.sync.exml.editor.validate.ValidationAssistant$2.appRun(ValidationAssistant.java:637)
	at ro.sync.ui.application.ApplicationThread.run(ApplicationThread.java:133)

Please register to edit this issue

Also available in: Atom PDF