aboutsummaryrefslogtreecommitdiffstats
path: root/status-control/src
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2017-04-11 11:43:21 -0700
committerGary Wu <gary.i.wu@huawei.com>2017-04-11 11:49:51 -0700
commit7ee20399328e30044ebad93f2e561934b7811e51 (patch)
treed1afc27b4b579c2826ff4b1dd145ada81f48d2c8 /status-control/src
parentb6b7bef8bdcad15af01ac88a038dd763ce59f68f (diff)
Fix resources leaks: CatalogDatabase
Change-Id: I3274dc7a64637cd7cf18d705258c0fc4985171ee Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'status-control/src')
-rw-r--r--status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java4
1 files changed, 1 insertions, 3 deletions
diff --git a/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java b/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java
index e0e712cd48..cd8cc7f13a 100644
--- a/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java
+++ b/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java
@@ -62,10 +62,8 @@ public class HealthCheckUtils {
public enum NodeType {APIH, RA, BPMN};
public boolean catalogDBCheck (MsoLogger subMsoLogger, long startTime) {
- try {
- CatalogDatabase catalogDB = new CatalogDatabase ();
+ try(CatalogDatabase catalogDB = new CatalogDatabase ()) {
catalogDB.healthCheck ();
- catalogDB.close();
} catch (Exception e) {
subMsoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Failed to check catalog database", e);
subMsoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception during healthcheck");