[ https://issues.apache.org/jira/browse/CASSANDRA-3606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13166758#comment-13166758 ]
Zoltan Farkas commented on CASSANDRA-3606: ------------------------------------------ the code can still leak, see comment: FileInputStream tsf = new FileInputStream(options.truststore); // next line can throw a exception (FileNotFoundException) and then tsf will leak FileInputStream ksf = new FileInputStream(options.keystore); SSLContext ctx; try { ... } catch (Exception e) { throw new IOException("Error creating the initializing the SSL Context", e); } finally { FileUtils.closeQuietly(tsf); FileUtils.closeQuietly(ksf); } the following is a better implementation: FileInputStream tsf = new FileInputStream(options.truststore); try { FileInputStream ksf = new FileInputStream(options.keystore); SSLContext ctx; try { ... } catch (Exception e) { throw new IOException("Error creating the initializing the SSL Context", e); } } finally { ksf.close(); } } finally { tsf.close() } In general I am in favor having the test code at the same quality... > Resource Leaks in code > ---------------------- > > Key: CASSANDRA-3606 > URL: https://issues.apache.org/jira/browse/CASSANDRA-3606 > Project: Cassandra > Issue Type: Bug > Affects Versions: 1.0.5 > Reporter: Zoltan Farkas > Original Estimate: 1h > Remaining Estimate: 1h > > at the following locations: > At SSLFactory:[line 87] > At SSTableExportTest:[line 83] > At CommitLogTest:[line 191] > At KeyGenerator:[line 108] > At Ec2Snitch.java:[line 74] > At SSTableExportTest.java:[line 83] > At CassandraServer.java:[line 1164] > At CommitLogTest.java:[line 191] > At ByteBufferUtilTest.java:[line 194] > At LazilyCompactedRowTest.java:[line 108] -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira