Bug 48109

Summary: Improve binaryStream processing in WebappClassLoader#findResourceInternal
Product: Tomcat 6 Reporter: Konstantin Kolinko <knst.kolinko>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: minor    
Priority: P2    
Version: 6.0.20   
Target Milestone: default   
Hardware: PC   
OS: Windows XP   

Description Konstantin Kolinko 2009-11-02 19:49:49 UTC
(based on http://marc.info/?l=tomcat-dev&m=124192105131636&w=2)

In WebappClassLoader#findResourceInternal() there is a lot of code between opening the binaryStream and starting to use it.

There is a lot of processing, e.g.:
  if (!openJARs()) {
     return null;
  if (antiJARLocking).

If something happens in those steps, it is possible to leak InputStream references.

One case is fixed with rev.772872,
but it would be better to add a global try/finally block.
Comment 1 Mark Thomas 2010-02-08 14:08:51 UTC
Fixed in trunk and proposed for 6.0.x
Comment 2 Mark Thomas 2010-02-23 23:15:47 UTC
This has been fixed in 6.0.x and will be included in 6.0.25 onwards.
Comment 3 Mark Thomas 2010-03-05 13:34:55 UTC
This has also been fixed in 5.5.x and will be included in 5.5.29 onwards.