Hide Forgot
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(); }
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