Project

Profile

Help

Bug #4721

closed

NullPointerException for calling fn:apply on empty sequence

Added by Martin Honnen over 3 years ago. Updated over 3 years ago.

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

100%

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

Description

I noticed that the simple XQuery () => apply([]) gives a NullPointerException in Saxon. Shouldn't it raise XPTY0004?

java -cp 'C:\Program Files\Saxonica\SaxonHE10-2J\saxon-he-10.2.jar' net.sf.saxon.Query -qs:"() => apply([])"
<?xml version="1.0" encoding="UTF-8"?>java.lang.NullPointerException
        at net.sf.saxon.functions.ApplyFn.call(ApplyFn.java:128)
        at net.sf.saxon.expr.FunctionCall.iterate(FunctionCall.java:548)
        at net.sf.saxon.expr.Expression.process(Expression.java:949)
        at net.sf.saxon.expr.SystemFunctionCall.process(SystemFunctionCall.java:481)
        at net.sf.saxon.query.XQueryExpression.run(XQueryExpression.java:455)
        at net.sf.saxon.s9api.XQueryEvaluator.run(XQueryEvaluator.java:370)
        at net.sf.saxon.Query.runQuery(Query.java:895)
        at net.sf.saxon.Query.doQuery(Query.java:423)
        at net.sf.saxon.Query.main(Query.java:97)
Fatal error during query: java.lang.NullPointerException:  (no message)

It is not particulary meaninful to pass the empty sequence but I guess Saxon doesn't want to acknowledge that with a NullPointerException and furthermore in real code using function-lookup(..) => apply([..]) it is easy to end up with an empty sequence erroneously passed in.

Actions #1

Updated by Michael Kay over 3 years ago

  • Status changed from New to In Progress

Problem reproduced, QT3 test case fn-apply-17 created

Actions #2

Updated by Michael Kay over 3 years ago

The argument cardinality is incorrect in the function signature at XPath30FunctionSet.java line 54.

Actions #3

Updated by Michael Kay over 3 years ago

  • Status changed from In Progress to Resolved
  • Assignee set to Michael Kay
  • Applies to branch trunk added
  • Fix Committed on Branch 10, trunk added

Patch committed on 10.x and development branches.

Actions #4

Updated by Michael Kay over 3 years ago

  • Fix Committed on Branch 9.9 added

Retrofitted the patch to the 9.9 branch.

Actions #5

Updated by O'Neil Delpratt over 3 years ago

  • Fixed in Maintenance Release 9.9.1.8 added

Bug fix applied on the Saxon 9.9.1.8 maintenance release. Leaving open until applied on the Saxon 10 maintenance release.

Actions #6

Updated by O'Neil Delpratt over 3 years ago

Bug fix applied in the Saxon 10.3 maintenance release

Actions #7

Updated by O'Neil Delpratt over 3 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 10.3 added

Please register to edit this issue

Also available in: Atom PDF