Bug 56900

Summary: Resource Leaks found by CID 45266 and 45249
Product: Tomcat 8 Reporter: Felix Schumacher <felix.schumacher>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: minor    
Priority: P2    
Version: 8.0.x-trunk   
Target Milestone: ----   
Hardware: All   
OS: All   
Attachments: Close InputStream after use. Factor out common code into a private method.
Close InputStream after use in ContextConfig

Description Felix Schumacher 2014-08-30 13:38:41 UTC
Created attachment 31953 [details]
Close InputStream after use. Factor out common code into a private method.

InputStreams are not closed after using them for loading the content into properties.

This happens a few times in the code base and seems to be a common task. Maybe we should create a utility-method to capsulate that funtion.

For DefaultInstanceManager I have created a private method. For ContextConfig I adapted to local logic only.
Comment 1 Felix Schumacher 2014-08-30 13:39:21 UTC
Created attachment 31954 [details]
Close InputStream after use in ContextConfig
Comment 2 Mark Thomas 2014-09-01 10:07:48 UTC
Thanks for the patches. I applied a variation of them (I used try with resources to reduce the code) to 8.0.x and this will be included in 8.0.13 onwards.
Comment 3 Violeta Georgieva 2014-09-03 15:45:49 UTC
Fix is committed to 7.0.x and will be available in 7.0.56 onwards.