Project

Profile

Help

Bug #4578

closed

NullPointerException when array:fold-left|right $zero argument is an empty sequence

Added by Vladimir Nesterovsky over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XPath conformance
Sprint/Milestone:
-
Start date:
2020-06-07
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
10, 9.9
Fix Committed on Branch:
10, 9.9
Fixed in Maintenance Release:
Platforms:

Description

Following xslt gives an error:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:array="http://www.w3.org/2005/xpath-functions/array"
  exclude-result-prefixes="xs array">

  <xsl:template match="/">
    <xsl:sequence select="
      array:fold-left
      (
        [8, 9], 
        (), 
        function($first as item(), $second as item()) 
        {  
          min(($first, $second))
        }
      )"/>
  </xsl:template>

</xsl:stylesheet>
java.lang.NullPointerException
        at net.sf.saxon.functions.hof.CoercedFunction.call(CoercedFunction.java:151)
        at net.sf.saxon.functions.SystemFunction.dynamicCall(SystemFunction.java:454)
        at net.sf.saxon.ma.arrays.ArrayFunctionSet$ArrayFoldLeft.call(ArrayFunctionSet.java:269)
        at net.sf.saxon.expr.FunctionCall.iterate(FunctionCall.java:543)
        at net.sf.saxon.expr.Expression.process(Expression.java:949)
        at net.sf.saxon.expr.SystemFunctionCall.process(SystemFunctionCall.java:476)
        at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:376)
        at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:555)
        at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:659)
        at net.sf.saxon.s9api.AbstractXsltTransformer.applyTemplatesToSource(AbstractXsltTransformer.java:360)
        at net.sf.saxon.s9api.Xslt30Transformer.applyTemplates(Xslt30Transformer.java:285)
        at net.sf.saxon.Transform.processFile(Transform.java:1313)
        at net.sf.saxon.Transform.doTransform(Transform.java:853)
        at net.sf.saxon.Transform.main(Transform.java:82)
java.lang.RuntimeException: Internal error evaluating template rule  at line 7 in module file:/C:/projects/git/xslt-graph/tests/saxon-10.1-internal-error.xslt
        at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:393)
        at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:555)
        at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:659)
        at net.sf.saxon.s9api.AbstractXsltTransformer.applyTemplatesToSource(AbstractXsltTransformer.java:360)
        at net.sf.saxon.s9api.Xslt30Transformer.applyTemplates(Xslt30Transformer.java:285)
        at net.sf.saxon.Transform.processFile(Transform.java:1313)
        at net.sf.saxon.Transform.doTransform(Transform.java:853)
        at net.sf.saxon.Transform.main(Transform.java:82)
Caused by: java.lang.NullPointerException
        at net.sf.saxon.functions.hof.CoercedFunction.call(CoercedFunction.java:151)
        at net.sf.saxon.functions.SystemFunction.dynamicCall(SystemFunction.java:454)
        at net.sf.saxon.ma.arrays.ArrayFunctionSet$ArrayFoldLeft.call(ArrayFunctionSet.java:269)
        at net.sf.saxon.expr.FunctionCall.iterate(FunctionCall.java:543)
        at net.sf.saxon.expr.Expression.process(Expression.java:949)
        at net.sf.saxon.expr.SystemFunctionCall.process(SystemFunctionCall.java:476)
        at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:376)
        ... 7 more

Please register to edit this issue

Also available in: Atom PDF