|Summary:||An incomplete fix for the resource leak bug in MemoryUserDatabase.java|
|Component:||Catalina||Assignee:||Tomcat Developers Mailing List <dev>|
Description lianggt08 2012-02-21 11:50:36 UTC
The fix revision 423920 was aimed to remove an resource leak bug on the FileInputStream object "fis" (created line 418) in the method "open()" of the file "/tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java" , but it is incomplete. There are some problems: 1. when the statements at lines 420-439 throw some exception, the "fis" can not be closed as expected. The best way to close such resource objects is putting such close operations in the finaly block of a try-catch-finally structure.
Comment 1 Mark Thomas 2012-03-06 21:04:39 UTC
revision 423920 has nothing to do with attempting to prevent a resource leak. The situation described in this report would generate an error message to the logs on start-up which is very likely to result in Tomcat being shut down and the issue fixed. Even if the issue is not fixed, it would result in a single fd leak. The component that this report references is not intended for production use. Taken together, the above mean that a severity of critical is not appropriate for this issue. It would do very little / no harm to leave the code as it is. This is really an enhancement request to clean up the code a little. This is the second issue of this nature I have reviewed from this reporter that has demonstrated a lack of understanding of the code concerned and over inflated the severity of the issue. It is becoming increasingly tempting to simply close all the issues from this reporter as INVALID until they demonstrate the ability to do some proper analysis.