Bug 62868 - WebappClassLoaderBase getResources(String) is not ordered according to delegate flag
Summary: WebappClassLoaderBase getResources(String) is not ordered according to delega...
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 8.5.x-trunk
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2018-10-30 09:35 UTC by Donald
Modified: 2018-11-02 11:27 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Donald 2018-10-30 09:35:26 UTC
WebappClassLoaderBase.getResources(String) is not implemented. Resulting in fallback to normal ClassLoader which is not self first as a webapp classloader should be. This is a problem when e.g. using javax.activation, which uses getResources for e.g. which mail provider will be used.

This seems a regression from https://bz.apache.org/bugzilla/show_bug.cgi?id=3936.
Comment 1 Remy Maucherat 2018-10-30 10:22:35 UTC
This is not a regression at all, only the ordering is "wrong" as findResources is (still) implemented.
Comment 2 Remy Maucherat 2018-10-30 14:15:01 UTC
Although the enumeration returned has an ordering, I think the library which starts to take into account ordering, and your trying to override a resource (apparently) is too much to expect overall. So the issue should not be fixed IMO.
Comment 3 Donald 2018-10-30 15:49:38 UTC
According to the javadoc of java.lang.ClassLoader.getResources(String) the order is important:

When overriding this method it is recommended that an implementation ensures that any delegation is consistent with the getResource(String) method. This should ensure that the first element returned by the Enumeration's nextElement method is the same resource that the getResource(String) method would return.

Can you reconsider this ticket?
Comment 4 Remy Maucherat 2018-10-31 14:09:40 UTC
I think that justifies keeping it open.
Comment 5 Mark Thomas 2018-11-02 11:27:55 UTC
Fixed in:
- trunk for 9.0.13 onwards
- 8.5.x for 8.5.35 onwards
- 7.0.x for 7.0.92 onwards