-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #12000 - use URIUtil::toURI instead of URI::create in MavenWebAppContext #12001
Conversation
…ce / ResourceFactory). Also use Path.of() instead of Paths.get() per javadoc recommendations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not in favour of resurrecting this method. Use a ResourceFactory. If that is difficult, then improve ResourceFactory. Having a resource-factory-lite method handling user input is asking for trouble. What if they give us a jar:file resource?
@@ -1892,24 +1892,27 @@ else if (scheme.equalsIgnoreCase("file")) | |||
} | |||
|
|||
/** | |||
* <p>Convert a String into a URI suitable for use as a Resource.</p> | |||
* <p>Convert a String into a URI in a sane way.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to say it better than "in a sane way". what does that mean?
* @deprecated This method is currently resolving relative paths against the current directory, which is a mechanism | ||
* that should be implemented by a {@link ResourceFactory}. All calls to this method need to be reviewed. | ||
* <p> | ||
* This exits to take an end user provided String and make a usable URI out of it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No indent.
s/exits/exists/
* It is capable of dealing with paths that have spaces, windows slashes, windows UNC references, | ||
* relative paths, absolute paths, and much more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still feels like a job of a ResourceFactory
. Why is this needed?
@@ -231,7 +231,7 @@ public void setResourceBases(String[] resourceBases) | |||
// This is a user provided list of configurations. | |||
// We have to assume that mounting can happen. | |||
List<URI> uris = Stream.of(resourceBases) | |||
.map(URI::create) | |||
.map(URIUtil::toURI) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ResourceFactory is the class we should be using to convert user provided strings. Especially as what we want is a CompositeResource at the end.
Restore
URIUtil.toURI(String)
, properly javadoc it, and use it where end-user provided Strings are given.Include maven-plugin IT test that replicates reported issue.
Fixes #12000