Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

joakime
Copy link
Contributor

@joakime joakime commented Jul 3, 2024

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

@joakime joakime added the Bug For general bugs on Jetty side label Jul 3, 2024
@joakime joakime requested review from olamy and janbartel July 3, 2024 19:23
@joakime joakime self-assigned this Jul 3, 2024
…ce / ResourceFactory).

Also use Path.of() instead of Paths.get() per javadoc recommendations.
Copy link
Contributor

@gregw gregw left a 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>
Copy link
Contributor

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.
Copy link
Contributor

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/

Comment on lines +1899 to +1900
* It is capable of dealing with paths that have spaces, windows slashes, windows UNC references,
* relative paths, absolute paths, and much more.
Copy link
Contributor

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)
Copy link
Contributor

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.

@janbartel
Copy link
Contributor

@joakime I made PR #12003 to fix the problem with the jetty maven plugin.

@janbartel
Copy link
Contributor

@joakime oops, when I committed my PR #12003 I think it closed the associated issue.

@janbartel
Copy link
Contributor

@joakime I think we've addressed the issue with PR #12003 so I'll close this PR. If there's still work to do, we need a new issue for it.

@janbartel janbartel closed this Jul 9, 2024
@janbartel janbartel deleted the fix/12.0.x/maven-plugin-resource-bases branch July 9, 2024 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Cannot use Paths that have spaces with jetty-ee10-maven-plugin
3 participants