Bug 62868

Summary: WebappClassLoaderBase getResources(String) is not ordered according to delegate flag
Product: Tomcat 8 Reporter: Donald <dkwakkel>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.5.x-trunk   
Target Milestone: ----   
Hardware: PC   
OS: Linux   

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:

{quote}
@apiNote
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.
{quote}

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