Project

Profile

Help

Bug #5950

closed

EntityResolverWrappingResourceResolver is too demanding

Added by Norm Tovey-Walsh about 1 year ago. Updated 8 months ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2023-03-31
Due date:
% Done:

100%

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

Description

The EntityResolverWrappingResourceResolver only succeeds if the underlying resource resolver that it's wrapping returns a StreamSource. The built in CatalogResourceResolver does this, it takes the result that it gets back from the underlying catalog resolver and wraps it in a stream source.

However, it's possible (I haven't constructed a test case to demonstrate this yet), to configure the parser so that it's using a different resource resolver, for example, org.apache.xerces.util.EntityResolver2Wrapper. That returns a standard SAX source and EntityResolverWrappingResourceResolver fails.

I expect the answer is to be more accepting in the wrapper and turn the standard sorts of sources that can be returned into StreamSources in the wrapper. But it'll be easier to determine that after I've manged to construct a test case.

Actions #1

Updated by Norm Tovey-Walsh about 1 year ago

I've constructed a test case. If the resolver returns a SAXSource, which seems highly likely, then simply adding

        if (resolved instanceof SAXSource) {
            return ((SAXSource) resolved).getInputSource();
        }

is an obvious and low-risk fix. If the source returned is something else, it's less clear.

In principle, I suppose one could construct an InputSource from a StAXSource or a DOMSource, but it's not clear it would be worth the effort.

Actions #2

Updated by Norm Tovey-Walsh about 1 year ago

  • Status changed from New to Resolved
  • Fix Committed on Branch 11, 12, trunk added

I've committed the fix that makes SAXSource succeed. I don't think it's practical to attempt to support StAXSource or DOMSource, but I also think those are very unlikely in practice.

Actions #3

Updated by O'Neil Delpratt about 1 year ago

  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 12.2 added

Bug fix applied in the Saxon 12.2 maintenance release.

Actions #4

Updated by Debbie Lockett 8 months ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 11.6 added

Bug fix applied in the Saxon 11.6 maintenance release.

Please register to edit this issue

Also available in: Atom PDF