Actions
Bug #3723
closedProblem with reflexive extension function using ?void=this and SEF files
Start date:
2018-03-18
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
9.8, trunk
Fix Committed on Branch:
9.8, trunk
Fixed in Maintenance Release:
Platforms:
Description
Reported by direct email to MHK.
The essence is a call to a user-defined function which is returning an external Java object:
<xsl:function as="jt:java.util.zip.ZipOutputStream" name="test:zos">
<xsl:param as="xs:string" name="path" />
....
<xsl:sequence select="ZipOutputStream:new($fos)" />
</xsl:function>
where the external object then has an extension function applied to it:
<xsl:variable name="zos"
select="Q{java:java.util.zip.ZipOutputStream?void=this}setComment(test:zos(xxxx), 'comment')" />
This is working fine when invoked directly, but fails when running from a SEF file, with the error:
java.lang.IllegalStateException: A Closure can only be read once
at net.sf.saxon.value.Closure.iterate(Closure.java:166)
at com.saxonica.expr.JavaExtensionFunctionCall.iterate(JavaExtensionFunctionCall.java:438)
The user-defined-function test:zos()
returns a Closure that can only be used once because it thinks the result will only be needed once (it is used as the argument to the setComment() call). However, because of the ?void=this option in the extension function URI, the value is actually used twice: once as the argument to the call, and again as the result of the call.
Please register to edit this issue
Actions