Uploaded image for project: 'FtpServer'
  1. FtpServer
  2. FTPSERVER-379

DbUserManager doesn't close test connection in ctor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0.4
    • 1.0.5, 1.1.0
    • Core
    • None

    Description

      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);
      }

      Attachments

        Activity

          People

            niklas Niklas Therning
            dirk.simonis Dirk Simonis
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: