Bug 48109 - Improve binaryStream processing in WebappClassLoader#findResourceInternal
Summary: Improve binaryStream processing in WebappClassLoader#findResourceInternal
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 6.0.20
Hardware: PC Windows XP
: P2 minor (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-02 19:49 UTC by Konstantin Kolinko
Modified: 2010-03-05 13:34 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.