Actions
Bug #1653
closedjava.lang.NullPointerException thrown in tail recursive user defined function
Start date:
2012-12-04
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
Description
In a user defined function which has a tail recursive call, we observe When bytecode generation is on, the exception java.lang.NullPointerException is thrown. This occurs when the tail call is within a singleton for-loop which at runtime may be ran zero or one time.
The exception can be reproduced with the following function (taken from http://dnovatchev.wordpress.com/):
<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>
Please register to edit this issue
Actions