coverity 1116668: conditionally close ds provided connection

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

This closes #599
This commit is contained in:
Daan Hoogland 2015-07-17 11:32:44 +02:00
parent 4f1eb8d6dd
commit 03b076cd1b
1 changed files with 9 additions and 1 deletions

View File

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