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 #11092 - Allow MetaInfConfiguration parsing of java.class.path to support globs #12287

Open
wants to merge 4 commits into
base: jetty-12.0.x
Choose a base branch
from

Conversation

joakime
Copy link
Contributor

@joakime joakime commented Sep 18, 2024

Use ResourceFactory.split(String) to properly parse the java.class.path so that globs can be supported in MetaInfConfiguration as well.

Fixes #11092
Fixes #12283

Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you could add the extra term to the glob string as per my comment, then I think we're ok.

@Test
public void testSplitOnPathSeparatorWithGlob() throws IOException
{
try (ResourceFactory.Closeable resourceFactory = ResourceFactory.closeable())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add another term to the glob string that is just a single jar file, to mimic a classpath that has both glob and individual jar files on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test kind has that already, 2 non globs, and 1 glob.
Also the existing test testSplitOnPipeWithGlob() has the same.
Do you want the non-glob to be specifically a jar?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Followup, do you want the extra non-globs to be before or after the glob?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really mind the position of the jar, just so long as the test is a combination of dirs, a dir with glob and at least one explicit jar.

Stream.of(classPath.split(File.pathSeparator))
.map(resourceFactory::newResource)
.filter(r -> uriPatternPredicate.test(r.getURI()))
resourceFactory.split(classPath, File.pathSeparator)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, technically we shouldn't fix ee8 and ee9 because they should be bug-for-bug compatible with jetty 10/11. But ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Jetty 10/11 we ignore globs here.
The raw string is created a File and then if it doesn't exist, it's ignored.
The thing is, a File with a * glob always produces a File instance that doesn't exist (or can be opened).
But a Path cannot even be created with a * glob, it throws an Exception.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

understood.

@janbartel
Copy link
Contributor

@joakime some test failures to address here as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 👀 In review
2 participants