[
https://issues.apache.org/jira/browse/XALANJ-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586389#action_12586389
]
Илья Казначеев commented on XALANJ-2325:
----------------------------------------
This bug persists as of today, in xalan 2.7.1.
Why don't you fix such grave bugs?
> XSLTC Causes NoSuchFieldError if global variable is unused
> ----------------------------------------------------------
>
> Key: XALANJ-2325
> URL: https://issues.apache.org/jira/browse/XALANJ-2325
> Project: XalanJ2
> Issue Type: Bug
> Components: XSLTC
> Affects Versions: 2.7
> Environment: Windows 2003, JRE 1.4.
> Reporter: Fred Kruesi
> Assignee: Santiago Pericas-Geertsen
> Attachments: TestXsl.zip, variable.patch
>
>
> If one has a style sheet that imports other style sheets which further
> include other style sheets and the last imported style sheet does not use a
> global variable it declared, XSLTC discards the variable even though it is
> used by other sheets. This leads to a NoSuchFieldError when the sheet is
> used. Following is a schematic view of the sheets. The actual sheets are in a
> test case.
> foo.xsl:
> <xsl:import href="imported/import1.xsl"/>
> <xsl:import href="imported/import2.xsl"/>
> <xsl:template match="bar:element">
> Value of info: <xsl:value-of select="info"/>
> Value of my-var from import: <xsl:call-template name="import1.xsl"/>
> Value of my-var from import: <xsl:call-template name="import2.xsl"/>
> </xsl:template>
> imported/import1.xsl:
> <xsl:include href="../inc1/inc1a.xsl"/>
>
> <xsl:template name="import1.xsl">
> From import1 my-var: <xsl:value-of select="$my-var"/>
> </xsl:template>
> imported/import2.xsl:
> <xsl:include href="../inc1/inc1a.xsl"/>
>
> <xsl:template name="import2.xsl">
> From import2 my-var:
> </xsl:template>
> ../inc1/inc1a.xsl
> <xsl:variable name="my-var">
> <Data code="Y">
> <Desc>Yes</Desc>
> </Data>
> <Data code="N">
> <Desc>No</Desc>
> </Data>
> </xsl:variable>
> Note that imported/import2 does declares, but does not use "my-var". When
> run, the following trace is produced:
> java.lang.NoSuchFieldError: my$dash$var
> at com.gmaci.xsl.foo.import1$dot$xsl()
> at com.gmaci.xsl.foo.template$dot$2()
> at com.gmaci.xsl.foo.applyTemplates()
> at com.gmaci.xsl.foo.applyTemplates()
> at com.gmaci.xsl.foo.applyTemplates()
> at com.gmaci.xsl.foo.transform()
> at
> org.apache.xalan.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:593)
> at
> org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:630)
> at
> org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:301)
> at testXsl.TestDriver.doTransform(TestDriver.java:233)
> at testXsl.TestDriver.main(TestDriver.java:69)
> Exception in thread "main"
> An obvious work-around is to ensure all global variables are used. A patch is
> attached. The thrust of the patch is to discard unused local variables, but
> not to discard any global variables.
> A test case can be provided. In order to use the test case you need to add
> the following jars to the lib folder of the project.
> xalan
> jdom
> serializer
> resolver
> xlm-apis
> xercesImpl
> xsltc
>
> To run the test, execute the Ant script.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]