Bug 52727 - An incomplete fix for the resource leak bug in HostConfig.java
Summary: An incomplete fix for the resource leak bug in HostConfig.java
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: trunk
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-21 11:58 UTC by lianggt08
Modified: 2012-03-06 21:16 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lianggt08 2012-02-21 11:58:35 UTC
The fix revision 423920  was aimed to remove an resource leak bug on the  BufferedOutputStream object "ostream " (created line 804) in the method "deployWAR" of the file "/tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java" , but it is incomplete. 

There are some problems: 
1. when "ostream" is not created successfully but the  temp FileOutputStream object  is created successfully  , the temp  FileOutputStream  object  will be  leaked. 

The best way to close such resource objects is putting such close operations for each object in the finaly block of a try-catch-finally structure.
Comment 1 Mark Thomas 2012-03-06 21:16:48 UTC
r423920 had nothing to do with attempting to fix a resource leak.

The only failures that might occur during the constructor of BufferedOutputStream are the sort that signify far bigger problems that a resource leak.

Yet another bug with an over-stated severity that should be an enhancement request to clean-up the code.