Project

Profile

Help

Support #5687

closed

Expected exception with variable resolver returning null

Added by Isaac Rivera Rivas about 2 years ago. Updated about 2 years ago.

Status:
Won't fix
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
2022-09-14
Due date:
% Done:

0%

Estimated time:
1:00 h
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

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

StandaloneSaxonTest.java (3.13 KB) StandaloneSaxonTest.java Sample code for reproducing the issue Isaac Rivera Rivas, 2022-09-14 22:46

Please register to edit this issue

Also available in: Atom PDF