| Summary: | Unsatisfied obligation to close InputStream in Apache plug-in | ||
|---|---|---|---|
| Product: | [Other] RHQ Project | Reporter: | Mike Foley <mfoley> |
| Component: | Plugins | Assignee: | Robert Buck <rbuck> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Mike Foley <mfoley> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 4.1 | CC: | hrupp |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2012-02-07 19:25:42 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
bob ... u closed all these input streams en masse ... right? I did, but apparently this is one that crept by me. let me fix this, this is a two second fix. commit 985e7fab93e5ed3b72c88ce23a1f1200d8bb5096 Author: Robert Buck <rbuck> Date: 2011-10-07 10:33:52 -0400 [BZ 721121] Fix IO stream resource leak. changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE |
Description of problem: Unsatisfied obligation to close InputStream in Apache plug-in .... if an exception is thrown. Specifically, org.rhq.plugins.apache.ApachePluginLifecycleListener.copyFile() Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Unsatisifed obligation to close InputStream in the event an exception is thrown Expected results: Programmatically closing InputStream under all circumstances (including if an exception is thrown). Additional info: public void copyFile(InputStream in,File destination) throws Exception{ if (!destination.canWrite()) throw new Exception("Creating of temporary file for lens failed. Destination file " + destination.getAbsolutePath()+" is not accessible."); OutputStream out = new FileOutputStream(destination); byte[] buf = new byte[1024]; int length; while ((length = in.read(buf)) > 0) { out.write(buf, 0, length); } in.close(); out.close(); }