-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Issue Overview
When my test app calls getResource("META-INF/someResource.txt") on the web app's classloader, it fails to find anything - even though the file exists in a JAR file in the WEB-INF/lib directory. When I search for the same resource using getResources, the returned set of URLs includes the URL to the resource in the WEB-INF/lib JAR file.
Expected Behaviour
The getResource method should search JAR files in the WEB-INF/lib directory after searching the WEB-INF/classes directory.
Current Behaviour
The getResource method only searches the WEB-INF/classes directory.
Steps To Reproduce
- Deploy a WAR file that contains a WEB-INF/lib JAR file that contains a text files called META-INF/someResource.txt.
- From another test case, obtain the WAR's classloader and invoke
loader.getResources("META-INF/someResource.txt")- this will return an Enumeration with a URL to the resource - all good so far. - From another test case, obtain the WAR's classloader and invoke
loader.getResource("META-INF/someResource.txt")- this will fail.
Additional Information
I think the problem is here:
Line 74 in 96b67cb
| public URL findResource(String name) { |
Unlike the getResources method, this method just adjusts the name for searching the WEB-INF/classes directory and then delegates to the super class. I think it should follow the same pattern as getResources and search the JAR files in the WEB-INF/lib directory.