manifoldcf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karl Wright (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (CONNECTORS-1590) Resources should be closed in a finally block
Date Sun, 03 Mar 2019 13:08:00 GMT

     [ https://issues.apache.org/jira/browse/CONNECTORS-1590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Karl Wright reassigned CONNECTORS-1590:
---------------------------------------

    Assignee: Karl Wright

> 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
>            Assignee: Karl Wright
>            Priority: Major
>             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)

Mime
View raw message