Correctly closing DB connection used for first verifying the connection (FTPSERVER-379)

git-svn-id: https://svn.apache.org/repos/asf/mina/ftpserver/trunk@964457 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/main/java/org/apache/ftpserver/usermanager/impl/DbUserManager.java b/core/src/main/java/org/apache/ftpserver/usermanager/impl/DbUserManager.java
index ac33863..7054763 100644
--- a/core/src/main/java/org/apache/ftpserver/usermanager/impl/DbUserManager.java
+++ b/core/src/main/java/org/apache/ftpserver/usermanager/impl/DbUserManager.java
@@ -92,15 +92,18 @@
         this.authenticateStmt = authenticateStmt;
         this.isAdminStmt = isAdminStmt;
 
-        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);
+        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); 
         }
     }