Project

Profile

Help

Support #1629

Updated by O'Neil Delpratt over 11 years ago

Reported Bug reported by Jesper Tverskov: 
 
 For arithmetic expressions where the types have not been resolved at compile time a NoSuchMethodException exception is thrown. 

 This error can be reproduced with the attached stylesheet. 
 
 1. If the row count, "rcount", is lower than 9, the recursion works. following stylesheet: 

 <pre> 
 If it is 9 the number of rows returned explodes. If it is higher than 
 9 no rows are returned. 

 2. It is easy to fix the templates, I can do one of two: 

 If I change: 

 <xsl:with-param> 
  ... 
    <xsl:template name="createOutput"> 
         <xsl:param name="i"/> 
         <xsl:if test="$i &lt;= $max"> 
           output... 
             <xsl:call-template name="createOutput"> 
                 <xsl:with-param name="i"> 
                     <xsl:value-of select="$i + 1"/> 
                 </xsl:with-param> 
             </xsl:call-template> 
         </xsl:if> 
     </xsl:template>     
 ... 
 </xsl:with-param> </pre> 

 to: The stack trace of the exception: 

 <xsl:with-param select="$i + 1"/> <pre> 
 Everything Exception in thread "main" java.lang.AssertionError: java.lang.NoSuchMethodException: net.sf.saxon.value.AtomicValue.getItemType(net.sf.saxon.type.TypeHierarchy) 
	 at com.saxonica.bytecode.util.Generator.invokeInstanceMethod(Generator.java:270) 
	 at com.saxonica.bytecode.CalculatorCompiler.anyAnyArithmetic(CalculatorCompiler.java:583) 
	 at com.saxonica.bytecode.CalculatorCompiler.access$300(CalculatorCompiler.java:27) 
	 at com.saxonica.bytecode.CalculatorCompiler$AnyPlusAny.compute(CalculatorCompiler.java:621) 
	 at com.saxonica.bytecode.ArithmeticCompiler.compileToItem(ArithmeticCompiler.java:78) 
	 at com.saxonica.bytecode.util.CompilerService.compileToItem(CompilerService.java:717) 
	 at com.saxonica.bytecode.AtomicSequenceConverterCompiler.compileToPrimitive(AtomicSequenceConverterCompiler.java:114) 
	 at com.saxonica.bytecode.util.CompilerService.compileToPrimitive(CompilerService.java:769) 
	 at com.saxonica.bytecode.SimpleNodeConstructorCompiler.compileToPush(SimpleNodeConstructorCompiler.java:32) 
	 at com.saxonica.bytecode.ToPushCompiler.compileToIterator(ToPushCompiler.java:32) 
	 at com.saxonica.bytecode.util.CompilerService.compileToIterator(CompilerService.java:691) 
	 at com.saxonica.bytecode.DocumentInstrCompiler.compileToItem(DocumentInstrCompiler.java:96) 
	 at com.saxonica.bytecode.util.CompilerService.compileToItem(CompilerService.java:717) 
	 at com.saxonica.bytecode.LetExpressionCompiler.compileCommonExpr(LetExpressionCompiler.java:301) 
	 at com.saxonica.bytecode.ApplyTemplatesCompiler.compileParameterSet(ApplyTemplatesCompiler.java:147) 
	 at com.saxonica.bytecode.CallTemplateCompiler.compileToPush(CallTemplateCompiler.java:141) 
	 at com.saxonica.bytecode.util.CompilerService.compileToPush(CompilerService.java:704) 
	 at com.saxonica.bytecode.BlockCompiler.compileToPush(BlockCompiler.java:42) 
	 at com.saxonica.bytecode.util.CompilerService.compileToPush(CompilerService.java:704) 
	 at com.saxonica.bytecode.ChooseCompiler.compileToPush(ChooseCompiler.java:169) 
	 at com.saxonica.bytecode.util.CompilerService.compileToPush(CompilerService.java:704) 
	 at com.saxonica.bytecode.BlockCompiler.compileToPush(BlockCompiler.java:42) 
	 at com.saxonica.bytecode.util.CompilerService.compileToPush(CompilerService.java:704) 
	 at com.saxonica.bytecode.util.CompilerService.compileToByteCode(CompilerService.java:596) 
	 at com.saxonica.expr.ee.OptimizerEE.compileToByteCode(OptimizerEE.java:1336) 
	 at net.sf.saxon.style.XSLTemplate.optimize(XSLTemplate.java:459) 
	 at net.sf.saxon.style.PrincipalStylesheetModule.compileStylesheet(PrincipalStylesheetModule.java:811) 
	 at net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:381) 
	 at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:226) 
	 at net.sf.saxon.PreparedStylesheet.compile(PreparedStylesheet.java:105) 
	 at net.sf.saxon.Transform.doTransform(Transform.java:557) 
	 at net.sf.saxon.Transform.main(Transform.java:75) 
 </pre> 

 This bug is ok. related to bytecode generation. In the class AtomicValue the method getItemType no longer accepts the argument TypeHierarchy. A fix has been applied to subversion in the class CalculatorCompiler. 

 It A workaround before maintenance release is also ok if I change it to: 

 <xsl:with-param    as="xs:integer"> 
  <xsl:value-of select="$i + 1"/> 
 </xsl:with-param> available would be to add the attribute @as="xs:integer"@ to the instruction @xsl:param@ with @name="i"@. Another workaround for users is to switch off the byte generation feature in the Saxon configuration.

Back