You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/02/26 22:17:12 UTC

DO NOT REPLY [Bug 6692] New: - using a variable in a format-number function causes a null point exception during compilation

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6692>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6692

using a variable in a format-number function causes a null point exception during compilation

           Summary: using a variable in a format-number function causes a
                    null point exception during compilation
           Product: XalanJ2
           Version: 2.3
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Xalan-Xsltc
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: bk@avolent.com


The following spreadsheet causes a null pointer exception during compilation.
Ther reason is the use of $bar in the third format-number parameter. 

<!DOCTYPE xsl:stylesheet [<!ENTITY nbsp "&#160;">]>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


<xsl:decimal-format
            decimal-separator = '.'
            grouping-separator = ','/>

<xsl:decimal-format
    name="PERIOD"
    decimal-separator = "."
    grouping-separator = ','/>

<xsl:decimal-format
    name="COMMA"
    decimal-separator = ","
    grouping-separator = '.'/>
                   
<xsl:template match="/">
	<xsl:variable name="foo">
		<xsl:value-of select="a/b/c"/>
	</xsl:variable>
	<xsl:variable name="bar">
		<xsl:value-of select="e/f/g"/>
	</xsl:variable>
	<xsl:value-of select="format-number('1.23', $foo, $bar)"/> 
</xsl:template>
				  

</xsl:stylesheet>


The stack trace is :

D:\>java org.apache.xalan.xsltc.cmdline.Compile -x -s -u file:///error.xsl
java.lang.NullPointerException
        at
org.apache.xalan.xsltc.compiler.VariableRef.translate(VariableRef.java:106)
        at
org.apache.xalan.xsltc.compiler.FormatNumberCall.translate(FormatNumberCall.java:130)
        at org.apache.xalan.xsltc.compiler.ValueOf.translate(ValueOf.java:121)
        at
org.apache.xalan.xsltc.compiler.SyntaxTreeNode.translateContents(SyntaxTreeNode.java:535)
        at org.apache.xalan.xsltc.compiler.Template.translate(Template.java:366)
        at
org.apache.xalan.xsltc.compiler.TopLevelElement.compile(TopLevelElement.java:96)
        at org.apache.xalan.xsltc.compiler.Mode.compileTemplates(Mode.java:404)
        at org.apache.xalan.xsltc.compiler.Mode.compileApplyTemplates(Mode.java:664)
        at
org.apache.xalan.xsltc.compiler.Stylesheet.compileModes(Stylesheet.java:424)
        at org.apache.xalan.xsltc.compiler.Stylesheet.translate(Stylesheet.java:525)
        at org.apache.xalan.xsltc.compiler.XSLTC.compile(XSLTC.java:321)
        at org.apache.xalan.xsltc.compiler.XSLTC.compile(XSLTC.java:232)
        at org.apache.xalan.xsltc.compiler.XSLTC.compile(XSLTC.java:355)
        at org.apache.xalan.xsltc.cmdline.Compile.main(Compile.java:170)
Compiler error(s):
  null