AmshikaH opened a new pull request, #816:
URL: https://github.com/apache/tomcat/pull/816

   In the getResourceAsStream [1] method, Tomcat checks the recently introduced 
`notFoundClassResources` based on the "path" variable alone, which is always 
the absolute url.
   
   However, there are cases such as [2] in the Apache CXF core component where 
the class loading first tries calling the `getResourceAsStream` [1] method with 
the absolute url as the “name” and if this returns a null stream, it then tries 
the relative url by calling the `getResourceAsStream` [1] method with the 
relative url as the “name”.
   
   In both calls to the `getResourceAsStream` method, the “path” variable set 
at [3] is the absolute url and therefore, Tomcat checks the cache for the 
absolute url both times.
   
   As a result, the second attempt based on the relative url gets skipped, and 
a null stream is returned even though the resource is present.
   
   In this PR, the block where the resource is loaded based on the "name" 
variable has been moved to a separate if block where the cache is checked for 
the "name" variable instead.
   
   [1] 
https://github.com/apache/tomcat/blob/08206671035f05e205806140b11c10c6eb3ca5c3/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1070
   [2] 
https://github.com/apache/cxf/blob/cxf-3.5.9/core/src/main/java/org/apache/cxf/version/Version.java#L38
   [3] 
https://github.com/apache/tomcat/blob/08206671035f05e205806140b11c10c6eb3ca5c3/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1100


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to