From 7ee20399328e30044ebad93f2e561934b7811e51 Mon Sep 17 00:00:00 2001 From: Gary Wu Date: Tue, 11 Apr 2017 11:43:21 -0700 Subject: Fix resources leaks: CatalogDatabase Change-Id: I3274dc7a64637cd7cf18d705258c0fc4985171ee Signed-off-by: Gary Wu --- status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'status-control/src/main/java/org') 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"); -- cgit 1.2.3-korg