[4.x] Fixes a jar-only URL resolution bug #7748
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR corrects a flaw where persistence roots were not being properly inferred from URLs pointing at
META-INF/persistence.xml
locations.In prior versions, prior to the JDK's deprecation of
new URL(someOtherUrl, "..")
invocations, something in that recipe handledjar
URLs transparently. When I changed this to work onURI
objects as the deprecation warnings suggested, suddenlyjar
URLs were not handled transparently.This PR ensures that, for example, the inferring of a persistence root from a URI of
jar:file:///path/some.jar!/META-INF/persistence.xml
will correctly befile:///path/some.jar
.(In addition, the PR hoists this calculation out of a loop where it was incorrectly located for an embarrassingly long time.)
The PR also adds a unit test demonstrating some of the more amazing and interesting features of
jar
URIs.Documentation impact: none