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

Fix patched module resource lookup #793

Merged

Conversation

Sineaggi
Copy link

@Sineaggi Sineaggi commented Sep 8, 2023

The current getURI method constructs a classpath resource from the getClasspathElementURI method. This doesn't worked for patched modules that could come from different classpaths (for example the module may start as a jar but have a directory patched in).

Calling the ModuleReader#find method (https://docs.oracle.com/javase%2F9%2Fdocs%2Fapi%2F%2F/java/lang/module/ModuleReader.html#find-java.lang.String-) instead will give us the URI of the resource.

Might fix #704

@Sineaggi
Copy link
Author

Sineaggi commented Sep 8, 2023

Hmm, on further investigation perhaps it's the getClasspathElementURI that needs fixing.

@lukehutch
Copy link
Member

This is a really high-quality PR -- thanks for the work on this and the attention to detail as to how code works in ClassGraph! However, based on your last comment, I'll let you dig a bit further before I merge this. (Sorry, I'm really short on time to help out with this right now...) Please let me know what you figure out.

@lukehutch lukehutch merged commit d126d8c into classgraph:latest Oct 13, 2023
1 check passed
@Sineaggi Sineaggi deleted the fix-patched-module-resource-lookup branch October 13, 2023 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate resources found with Maven / Surefire patching test resources into the module path.
2 participants