DbUserManager doesn't close test connection in ctor
---------------------------------------------------

                 Key: FTPSERVER-379
                 URL: https://issues.apache.org/jira/browse/FTPSERVER-379
             Project: FtpServer
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.0.4
            Reporter: Dirk Simonis
            Priority: Minor


In the class org.apache.ftpserver.usermanager.impl.DbUserManager the ctor 
doesn't close the test connection and keeps it open until it is close by for 
example the connection pooling or so. It should be closed directly.

Currently the code is:
try {
        // test the connection
        createConnection();
        
        LOG.info("Database connection opened.");
} catch (SQLException ex) {
        LOG.error("Failed to open connection to user database", ex);
        throw new FtpServerConfigurationException(
        "Failed to open connection to user database", ex);
} 

It should be something like this:
Connection con = null;
try {
        // test the connection
        con = createConnection();
        
        LOG.info("Database connection opened.");
} catch (SQLException ex) {
        LOG.error("Failed to open connection to user database", ex);
        throw new FtpServerConfigurationException(
        "Failed to open connection to user database", ex);
} finally{
        closeQuitely(con);
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to