Project

Profile

Help

Bug #4764

StandardModuleURIResolver can't succeed if its default constructor is used

Added by Norm Tovey-Walsh about 2 months ago. Updated 28 days ago.

Status:
In Progress
Priority:
Normal
Category:
Configuration
Sprint/Milestone:
-
Start date:
2020-09-29
Due date:
% Done:

0%

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

Description

At the top of StandardModuleURIResolver, we find:

    /**
     * Create a StandardModuleURIResolver. Although the class is generally used as a singleton,
     * a public constructor is provided so that the class can be named in configuration files and
     * instantiated in the same way as user-written module URI resolvers.
     */

    public StandardModuleURIResolver() {

    }

But that constructor leaves config uninitialized. AFAICT, there's no useful code path through the resolver that doesn't attempt to call a method on config (raising an NPE).

History

#1 Updated by Norm Tovey-Walsh about 2 months ago

The problem stems from the addition of this test to resolve():

               if (!config.getAllowedUriTest().test(absoluteURI)) {
                    throw new XPathException("URI scheme '" + absoluteURI.getScheme() + "' has been disallowed");
                }

I don't know if it's sufficient to put a guard around that test (if (config != null) ...) or if that test always needs to work in which case, well, I'm not sure what really.

#2 Updated by Michael Kay about 1 month ago

  • Category set to Configuration
  • Assignee set to Norm Tovey-Walsh
  • Priority changed from Low to Normal

I would suggest

(a) don't do the test if there is no known Configuration (fix needed for 10.x)

(b) after instantiating a ModuleUriResolver, if it extends StandardModuleUriResolver (or conforms to some new to-be-defined interface) then call its setConfiguration() method so it knows the configuration. (this feels more like 11.x)

#3 Updated by Norm Tovey-Walsh 28 days ago

  • Status changed from New to In Progress

Please register to edit this issue

Also available in: Atom PDF