Actions
Bug #4721
closedNullPointerException for calling fn:apply on empty sequence
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
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.
Please register to edit this issue
Actions