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

support directory in jar #315

Merged
merged 1 commit into from
Aug 28, 2023
Merged

support directory in jar #315

merged 1 commit into from
Aug 28, 2023

Conversation

wangshihui
Copy link

@wangshihui wangshihui commented Jun 12, 2023

support directory in jar, classloader method: classloader.getResource(entryName) when the entryName is a drectory ,this method would return null.In some opensource tools use this feature to load the resouces in the same folder
would faile

Resolves #314

@Ladicek
Copy link
Contributor

Ladicek commented Jun 12, 2023

Ah so this is to retain the directory structure in a JAR that is being reindexed. That seems sensible, but I'm not sure about the code that follows the if that's modified here -- does it handle directory entries correctly? I'd expect problems there.

@wangshihui
Copy link
Author

Ah so this is to retain the directory structure in a JAR that is being reindexed. That seems sensible, but I'm not sure about the code that follows the if that's modified here -- does it handle directory entries correctly? I'd expect problems there.

I test in my project after modification,every thing works ok. and we cuurently store and use it in our private repository.

if exlude the dirctory structure from the jar, classloader.getResource("") would retrun null. so if application want to get all resources from a named directory is complexed.
eg: get the all properties from classpath:config, should walk through all the entries. then filer the prefix with config

also: a lot of opensource tools use this feature of classloader.getResources(dirctory), if no direcotry enty in the jar file,these tools can not work 。

@Ladicek Ladicek added this to the 3.1.3 milestone Aug 28, 2023
@Ladicek Ladicek merged commit 1d3da86 into smallrye:main Aug 28, 2023
39 checks passed
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.

classloader.getResource(entryName) return null
2 participants