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] [Commented] (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:comment-tabpanel&focusedCommentId=16782728#comment-16782728
] 

Karl Wright commented on CONNECTORS-1590:
-----------------------------------------

This particular invocation is only ever invoked when we're shutting down ManifoldCF.  You
will find that there are no other such invocations where resources are potentially leaked.
 In this case, the leak is harmless because we are in the process of shutting down anyway.

I don't believe this requires a "fix".


> 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
>            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