Project

Profile

Help

Bug #5880

closed

-p:on command line option with XQuery seems to give "Static error in query: Exception in ModuleURIResolver"

Added by Martin Honnen about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Category:
Command Line
Sprint/Milestone:
-
Start date:
2023-02-10
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
11, 12
Fix Committed on Branch:
11, 12, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

I am trying to use the -p:on command line option with XQuery, however with 11.5 Java HE and EE as well as with SaxonCS 11.5 as well as with 12.0 EE I get an error Static error in query: Exception in ModuleURIResolver.

File attached and inline:

declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization";

declare option output:method "html";
declare option output:html-version "5";
declare option output:media-type "text/html";
declare option output:indent "no";

doc('https://martin-honnen.github.io/xml/2023/test2023020801.xml?strip-space=yes')

Output of runs:

PS C:\Users\marti\OneDrive\Documents\XQuery\strip-space> java -cp 'C:\Program Files\Saxonica\SaxonHE11-5J\saxon-he-11.5.jar' net.sf.saxon.Query -t -p:on -q:strip-space-url-param1.xq
SaxonJ-HE 11.5 from Saxonica
Java version 11.0.12
Analyzing query from strip-space-url-param1.xq
Static error in query: Exception in ModuleURIResolver:
PS C:\Users\marti\OneDrive\Documents\XQuery\strip-space> java -cp 'C:\Program Files\Saxonica\SaxonEE11-5J\saxon-ee-11.5.jar' net.sf.saxon.Query -t -p:on -q:strip-space-url-param1.xq
SaxonJ-EE 11.5 from Saxonica
Java version 11.0.12
Using license serial number ...
Analyzing query from strip-space-url-param1.xq
Static error in query: Exception in ModuleURIResolver:
PS C:\Users\marti\OneDrive\Documents\XQuery\strip-space> java -cp 'C:\Program Files\Saxonica\SaxonEE12-0J\saxon-ee-12.0.jar' net.sf.saxon.Query -t -p:on -q:strip-space-url-param1.xq
SaxonJ-EE 12.0 from Saxonica
Java version 11.0.12
Using license serial number ...
Analyzing query from strip-space-url-param1.xq
Static error in query: Exception in ModuleURIResolver:
PS C:\Users\marti\OneDrive\Documents\XQuery\strip-space> java -cp 'C:\Program Files\Saxonica\SaxonHE12-0J\saxon-he-12.0.jar' net.sf.saxon.Query -t -p:on -q:strip-space-url-param1.xq
SaxonJ-HE 12.0 from Saxonica
Java version 11.0.12
Analyzing query from strip-space-url-param1.xq
Static error in query: Exception in ModuleURIResolver:
PS C:\Users\marti\OneDrive\Documents\XQuery\strip-space> & 'C:\Program Files\Saxonica\SaxonCS-11.5\SaxonCS.exe' query -t
 -p:on -q:strip-space-url-param1.xq
SaxonCS-EE 11.5 from Saxonica
.NET 6.0.10 on Windows 10.0.22621.0
Using license serial number ..
Analyzing query from strip-space-url-param1.xq
Exception in ModuleURIResolver: : Object reference not set to an instance of an object.
Exiting with code 2

Norm says HE is not supposed to support -p but that the error for EE is a bug.

SaxonCS 12.0 does seem to work, though


Files

strip-space-url-param1.xq (326 Bytes) strip-space-url-param1.xq Martin Honnen, 2023-02-10 15:51
Actions #1

Updated by Michael Kay about 1 year ago

Also happens with the -u option. We're passing a fairly ridiculous request to the catalog resolver and it's crashing out with an NPE, which we then handle badly in terms of diagnostics.

Actions #2

Updated by Norm Tovey-Walsh about 1 year ago

  • Assignee set to Norm Tovey-Walsh

Right. I'll have a look.

Actions #3

Updated by Norm Tovey-Walsh about 1 year ago

  • Status changed from New to In Progress

As Mike observes, we're making a very strange call to the StandardModuleURIResolver. It appears that when URIs are involved, the location hints for the module are initialized with the URI(s) but the module URI and base URI are null. That's the source of the NPE.

It's not immediately obvious to me that we wouldn't get the same result by passing the location hint as the module URI, but presumably there are situations in which query parameters on the location hints are handled in some other way. Although this bug appears to be surfacing in the resolution of the initial Query module which doesn't, at least in this case, have any query parameters.

The least invasive fix seems to be to simply skip the attempt to use the module URI and base URI to resolve the module if they're both null.

Actions #4

Updated by Norm Tovey-Walsh about 1 year ago

  • Status changed from In Progress to Resolved

Fix committed to main and saxon11 branches.

Actions #5

Updated by O'Neil Delpratt about 1 year ago

  • Fix Committed on Branch 11, 12, trunk added
Actions #6

Updated by O'Neil Delpratt about 1 year ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 12.1 added

Bug fix applied in the Saxon 12.1 maintenance release.

Please register to edit this issue

Also available in: Atom PDF