Actions
Bug #1792
closedArrayIndexOutOfBoundsException when converting xs:string variable with occurrence indicator
Start date:
2013-06-03
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
Description
Given the following stylesheet code snippet:
<xsl:template name="t_element">
<xsl:param name="ver" as="xs:string?" select="'1.0'"/>
<xsl:element name="test"><xsl:value-of select="xs:double($ver) >= xs:double('1.1')" /></xsl:element>
</xsl:template>
The following exception is thrown when bytecode generation option is 'on'. The problem here is that the '@as@' attribute is declared with type @xs:string?@. The occurrence indicator means zero or one occurrence, however we are given a default value which when used in the xs:double construct is not being correctly converted to xs:double in the byte code. I confirm that the correct type conversion happens in the interpreted code:
java.lang.ArrayIndexOutOfBoundsException: 1
at org.objectweb.asm.Frame.a(Unknown Source)
at org.objectweb.asm.Frame.a(Unknown Source)
at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source)
at org.objectweb.asm.commons.GeneratorAdapter.endMethod(Unknown Source)
at com.saxonica.bytecode.util.CompilerService.compileToByteCode(CompilerService.java:636)
at com.saxonica.expr.ee.OptimizerEE.compileToByteCode(OptimizerEE.java:1338)
at net.sf.saxon.style.XSLTemplate.optimize(XSLTemplate.java:464)
at net.sf.saxon.style.PrincipalStylesheetModule.compileStylesheet(PrincipalStylesheetModule.java:818)
at net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:391)
at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:236)
at net.sf.saxon.PreparedStylesheet.compile(PreparedStylesheet.java:114)
at net.sf.saxon.Transform.doTransform(Transform.java:565)
at net.sf.saxon.Transform.main(Transform.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Error
Please register to edit this issue
Actions