Bug 52732 - An incomplete fix for the resource leak bug in ExpressionFactory.java
An incomplete fix for the resource leak bug in ExpressionFactory.java
Status: RESOLVED FIXED
Product: Tomcat 7
Classification: Unclassified
Component: Integration
trunk
PC All
: P2 enhancement (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2012-02-21 12:22 UTC by lianggt08
Modified: 2012-03-06 22:58 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 12:22:44 UTC
The fix revision 1043157 was aimed to remove an resource leak bug on the BufferedReader object "br " (created in line 231), the InputStream  object "is" (created in line 222 or 224) in the method "getClassNameServices()" of the file 
"/tomcat/trunk/java/javax/el/ExpressionFactory.java" , but it is incomplete. 

There are some problems: 
1. when "br" is not created successfully but the temp InputStreamReader is created successfully at line 231, the temp InputStreamReader will be leaked. 

The best way to close such resource objects is putting such close operations for each resource object in the finaly block of a try-catch-finally structure.
Comment 1 Mark Thomas 2012-03-06 22:58:31 UTC
Yet another enhancement claiming greater severity than deserved.

Fixed in trunk and 7.0.x and will be included in 7.0.27 onwards.