Support #5687
closedExpected exception with variable resolver returning null
0%
Description
Hey there!
I'm new to the community so hope this is the right way to create an issue. I noticed that there seems to be a behavior difference in the XPathFactory between a JDK (specifically openjdk version "1.8.0_345") and Saxon (specifically 11.4) creating a factory with net.sf.saxon.xpath.XPathFactoryImpl instead of the default XPathFactory.
When I do a variable lookup for a variable that doesn't exist, I would expect to get an exception thrown but in Saxon I get an empty result back. If I'm not mistaken, Saxon follows the JAXP 1.3 spec for this implementation and according to the spec when evaluating expressions for variables, "... An javax.xml.xpath.XPathExpressionException is raised if the variable resolver is undefined or the resolver returns null for the variable." The fix is pretty easy for this based of the 11.4 latest code.
Wanted to start a discussion for this to see what the community thought about this and if possible, I can provide a fix for it as well. I'm attaching a sample java class which hopefully provides more insights.
Thanks in advance!
Files
Please register to edit this issue