Bug #4721
closedNullPointerException for calling fn:apply on empty sequence
100%
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.
Updated by Michael Kay over 3 years ago
- Status changed from New to In Progress
Problem reproduced, QT3 test case fn-apply-17
created
Updated by Michael Kay over 3 years ago
The argument cardinality is incorrect in the function signature at XPath30FunctionSet.java
line 54.
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.
Updated by Michael Kay over 3 years ago
- Fix Committed on Branch 9.9 added
Retrofitted the patch to the 9.9 branch.
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.
Updated by O'Neil Delpratt over 3 years ago
Bug fix applied in the Saxon 10.3 maintenance release
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