cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [3/3] git commit: updated refs/heads/master to 03b076c
Date Fri, 17 Jul 2015 11:22:59 GMT
coverity 1116668: conditionally close ds provided connection

Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #599


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/03b076cd
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/03b076cd
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/03b076cd

Branch: refs/heads/master
Commit: 03b076cd1bc7c0c4bac23c7741f884878f4a708a
Parents: 4f1eb8d
Author: Daan Hoogland <daan@onecht.net>
Authored: Fri Jul 17 11:32:44 2015 +0200
Committer: Daan Hoogland <daan@onecht.net>
Committed: Fri Jul 17 13:22:43 2015 +0200

----------------------------------------------------------------------
 framework/db/src/com/cloud/utils/db/Merovingian2.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/03b076cd/framework/db/src/com/cloud/utils/db/Merovingian2.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/Merovingian2.java b/framework/db/src/com/cloud/utils/db/Merovingian2.java
index 0c76fb5..fe0b24d 100644
--- a/framework/db/src/com/cloud/utils/db/Merovingian2.java
+++ b/framework/db/src/com/cloud/utils/db/Merovingian2.java
@@ -71,7 +71,15 @@ public class Merovingian2 extends StandardMBean implements MerovingianMBean
{
             _concierge = new ConnectionConcierge("LockMaster", conn, true);
         } catch (SQLException e) {
             s_logger.error("Unable to get a new db connection", e);
-            throw new CloudRuntimeException("Unable to initialize a connection to the database
for locking purposes: ", e);
+            throw new CloudRuntimeException("Unable to initialize a connection to the database
for locking purposes", e);
+        } finally {
+            if (_concierge == null && conn != null) {
+                try {
+                    conn.close();
+                } catch (SQLException e) {
+                    s_logger.debug("closing connection failed after everything else.", e);
+                }
+            }
         }
     }
 


Mime
View raw message