Project

Profile

Help

Bug #1653

Updated by O'Neil Delpratt over 11 years ago

In a user defined function which has a tail recursive call, we call; We observe When bytecode generation is on, the exception java.lang.NullPointerException is thrown. This occurs thrown when the tail call is within a singleton for-loop which at runtime may be ran zero or one time. conditional. 

 The exception can be reproduced with the following function (taken from http://dnovatchev.wordpress.com/): 

 <pre> 
 <xsl:function name="my:processQueue"    as="xs:string*"> 
   <xsl:param name="pQueue" as="element()*"/> 
   <xsl:param name="pTarget" as="xs:string"/> 
   <xsl:param name="pExcluded" as="xs:string*"/> 
  
   <xsl:sequence select= 
    "if(not($pQueue)) 
       then () 
       else for $vTop in $pQueue[1], 
                $vResult in my:processNode($vTop, $pTarget, $pExcluded)[1] 
		          return 
		            if($vResult/self::result) 
					        then string-join($vResult/*, ' ==> ') 
					        else my:processQueue((subsequence($pQueue, 2), $vResult/*), 
					                             $pTarget, 
					                             ($pExcluded, $vResult/*/value) 
					                            )"/> 
  </xsl:function> 
 </pre>

Back