Project

Profile

Help

Bug #6222

closed

XMLResolver fails on windows paths in system identifiers that are reachable but can't be resolved, even if "-Dxml.catalog.fixWindowsSystemIdentifiers=true" was given.

Added by Stefan Krause about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Low
Category:
-
Sprint/Milestone:
-
Start date:
2023-10-12
Due date:
% Done:

0%

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

Description

XMLResolver fails on windows paths in system identifiers that are reachable but can't be resolved, even if "-Dxml.catalog.fixWindowsSystemIdentifiers=true" was given.

stack trace:

java.lang.IllegalArgumentException: Illegal character in path at index 1: .\test.dtd
        at java.base/java.net.URI.create(Unknown Source)
        at java.base/java.net.URI.resolve(Unknown Source)
        at org.xmlresolver.Resolver.openConnection(Resolver.java:250)
        at org.xmlresolver.Resolver.resolveEntity(Resolver.java:204)
        at net.sf.saxon.lib.CatalogResourceResolver.resolveEntity(CatalogResourceResolver.java:194)
        at net.sf.saxon.lib.EntityResolverWrappingResourceResolver.resolveEntity(EntityResolverWrappingResourceResolver.java:46)
[…]

Steps to reproduce (see attached ZIP file):

xml-inputfile.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root SYSTEM ".\test.dtd">
<root id="id12345"/>

test.dtd

  • is a valid DTD
  • is located in the same directory as xml-inputfile.xml

command line

java -cp "path\to\saxon\*;path\to\saxon\lib\*" -Dxml.catalog.fixWindowsSystemIdentifiers=true net.sf.saxon.Transform -xsl:"main.xsl" -s:"xml-inputfile.xml" -o:"xml-outputfile.xml" [-catalog:catalog_0X.xml]

Current Results

  • no catalog given (run_01.bat)
    • fails
  • catalog is given and system identifier can be resolved (run_02.bat uses catalog_01.xml)
    • works
  • catalog is given and system identifier can't be resolved (run_03.bat uses catalog_02.xml)
    • fails

Expected results: (like run_02.bat)

  • input file is loaded
  • no exception is thrown
  • no warning appears

Files

#6222_xmlresolver.zip (3.34 KB) #6222_xmlresolver.zip Stefan Krause, 2023-10-12 09:34

Please register to edit this issue

Also available in: Atom PDF