PathMatchingResourcePatternResolver resolves differently for jar and filesystem resources
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
The PathMatchingResourcePatternResolver matches folders differently depending on whether they are in a jar file or the filesystem. When running tests in gradle the output is not jarred, while deployed code is. This makes the class useless.
### Steps to Reproduce
1. Put some resources files in folders in a module
2. In a test use a PathMatchingResourcePatternResolver to getResources with a pattern that matches the folders. Fx 'classpath*:/bar/foo*' The folders should be returned as Resource instances.
3. In another module that depends the first module run a copy of the previous test. The folders will not be returned as Resource instances as the matcher doesn't match on the names.
### Expected Behaviour
The resources are resolved and returned from both filesystem and jar files.
### Actual Behaviour
When using a pattern ending with 'foo*', folders called foo1, foo2, etc. are matched in the file system, but not matched in a jar. When using a pattern ending with foo*/' - note the folder separator - the above-mentioned folders are matched in the jar, but not in the filesystem.
### Environment Information
- **Grails Version:** 3.3.9, but I see the code has not been chenged in years
- **JDK Version:** 1.8
Contributor guide
Research direction
Start by reproducing the reported PathMatchingResourcePatternResolver behavior with classpath*:/bar/foo* against filesystem and jar resources, using the two-module setup described. Compare which folder Resource instances are returned for patterns with and without the folder separator; done means matching folders consistently in both environments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100