From 4b23fde59f0ddb4802d162f7fa97f2e18d43ffe2 Mon Sep 17 00:00:00 2001 From: surya-huawei Date: Fri, 22 Sep 2017 10:30:39 +0530 Subject: Use isEmpty() to check collection size Major sonar issue in dashboard module *Using collection.isEmpty() instead of collection.size() makes code more readable and is more performant Issue-Id: CCSDK-87 Change-Id: I201d1c7982ce6a1509a462d7d151a41ab2912f91 Signed-off-by: surya-huawei --- .../java/org/onap/oom/dashboard/controller/HealthCheckController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oom-app-common/src/main/java/org/onap/oom/dashboard/controller/HealthCheckController.java b/oom-app-common/src/main/java/org/onap/oom/dashboard/controller/HealthCheckController.java index fe54790..7ed3fbe 100644 --- a/oom-app-common/src/main/java/org/onap/oom/dashboard/controller/HealthCheckController.java +++ b/oom-app-common/src/main/java/org/onap/oom/dashboard/controller/HealthCheckController.java @@ -72,7 +72,7 @@ public class HealthCheckController extends UnRestrictedBaseController { @SuppressWarnings("unchecked") // Get the single app. List list = dataAccessService.getList(App.class, null); - if (list.size() > 0) + if (!list.isEmpty()) healthStatus = new HealthStatus(200, SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME) + " health check succeeded"); else healthStatus = new HealthStatus(500, SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME) + " health check failed to run db query"); -- cgit 1.2.3-korg