Cihad Guzel created CONNECTORS-1590:
---------------------------------------
Summary: Resources should be closed in a finally block
Key: CONNECTORS-1590
URL: https://issues.apache.org/jira/browse/CONNECTORS-1590
Project: ManifoldCF
Issue Type: Bug
Components: Framework core
Affects Versions: ManifoldCF 2.12
Reporter: Cihad Guzel
Fix For: ManifoldCF 2.13
{code:java}
public class DBInterfaceHSQLDB extends Database implements IDBInterface {
...
try
{
Connection c =
DriverManager.getConnection(_localUrl+databaseName,userName,password);
Statement s = c.createStatement();
s.execute("SHUTDOWN");
c.close();
}
catch (Exception e)
{
// Never any exception!
e.printStackTrace();
}
{code}
Connections that implement the _Closeable_ interface or its super-interface,
_AutoCloseable_, needs to be closed after use. That close call must be made in
a *finally* block otherwise an exception could keep the call from being made.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)