Actions
Bug #6662
openjava.lang.NullPointerException found for saxon:line-number
Status:
New
Priority:
Normal
Assignee:
-
Category:
s9api API
Sprint/Milestone:
-
Start date:
2025-01-21
Due date:
% Done:
0%
Estimated time:
Legacy ID:
Applies to branch:
12, trunk
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
Description
Given this simple XML document:
<root>
<item>a</item>
<item>b</item>
<item>c</item>
</root>
If I run the below command which is an incorrect path in the XML doc:
-qs:"saxon:line-number((//item1)[1])" -s:sample.xml -sa
The following exception is thrown:
Exception in thread "main" java.lang.NullPointerException
at com.saxonica.functions.extfn.VendorFunctionSetPE$LineNumber.call(VendorFunctionSetPE.java:778)
at net.sf.saxon.expr.SystemFunctionCall$SystemFunctionCallElaborator.lambda$elaborateForPull$1(SystemFunctionCall.java:605)
at net.sf.saxon.expr.FunctionCall.iterate(FunctionCall.java:624)
at net.sf.saxon.sxpath.XPathExpression.evaluateSingle(XPathExpression.java:210)
at net.sf.saxon.s9api.XPathSelector.evaluateSingle(XPathSelector.java:258)
at net.sf.saxon.option.cpp.SaxonCAPI.testj(SaxonCAPI.java:1938)
at net.sf.saxon.option.cpp.SaxonCAPI.main(SaxonCAPI.java:1986)
Updated by Michael Kay about 13 hours ago
The register()
call to register the function (VendorFunctionSetPE line 300) gives the argument type as node()?
, but the function implementation isn't checking for an empty sequence being supplied.`
The documentation at https://www.saxonica.com/documentation12/index.html#!functions/saxon/line-number gives the argument as node()
(ie. disallowing an empty sequence), So we have to decide whether to change the signature to match the documentation (in which case the type error will be detected before it gets as far as calling the function implementation).
Please register to edit this issue
Actions