This commit extracts the DTD/XSD remote lookup fallback from the resolveEntity method into a protected method.
A warn logging statement is added to the extracted fallback in order to make it clear that remote lookup happened.
Overriding the protected method would allow users to avoid this fallback entirely if it isn't desirable, without the need to duplicate the local resolution code.
Fixes gh-29662.
Comment From: simonbasle
draft
because I'm wondering about the extracted method's javadoc: it should probably list returning null
and throwing as override possibilities, but I'm not sure how to explain what each of these options does in a nutshell. would appreciate suggestions here
Comment From: scantor
draft
because I'm wondering about the extracted method's javadoc: it should probably list returningnull
and throwing as override possibilities, but I'm not sure how to explain what each of these options does in a nutshell. would appreciate suggestions here
Refer to the EntityResolver's resolveEntity semantics as a reference perhaps? That's ultimately what you're triggering.
Comment From: sbrannen
draft
because I'm wondering about the extracted method's javadoc: it should probably list returningnull
and throwing as override possibilities, but I'm not sure how to explain what each of these options does in a nutshell. would appreciate suggestions hereRefer to the EntityResolver's resolveEntity semantics as a reference perhaps? That's ultimately what you're triggering.
Returning null
will trigger the default behavior of the parser.
Throwing an exception should cause the parser to fail (and skip any attempt to load the remote resource).
We should introduce tests for both use cases.
Comment From: sbrannen
This has been merged into main
in 5965917d1655819379236bba0d3098b70bc6eb80 and revised in 8df4f927fd5d584ae1c9306cb2cd47c2e5bf6d2c.
Thanks, and... congratulations on having your first PR merged into the code base! 👍