From fb745184ca27f81f270884023a10dd2219a526c1 Mon Sep 17 00:00:00 2001 From: Driptaroop Das Date: Fri, 1 Feb 2019 01:14:43 +0530 Subject: MusicHealthCheck.java - Multiple Sonar Fixes MusicHealthCheck.java - Multiple Sonar Fixes Issue-ID: MUSIC-302 Change-Id: I8e9b8be0d35b5a8d3042ffe056b4d29c5bb7888e Signed-off-by: Driptaroop Das --- .../onap/music/eelf/healthcheck/MusicHealthCheck.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java b/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java index 93c44468..7cff9d30 100644 --- a/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java +++ b/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java @@ -83,20 +83,12 @@ public class MusicHealthCheck { } private Boolean getAdminKeySpace(String consistency) throws MusicServiceException { - - PreparedQueryObject pQuery = new PreparedQueryObject(); pQuery.appendQueryString("insert into admin.healthcheck (id) values (?)"); pQuery.addValue(UUID.randomUUID()); - ResultType rs = MusicCore.nonKeyRelatedPut(pQuery, consistency); - logger.info(rs.toString()); - if (rs != null) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - - + ResultType rs = MusicCore.nonKeyRelatedPut(pQuery, consistency); + logger.info(rs.toString()); + return null != rs; } private boolean createKeyspace() { @@ -110,10 +102,7 @@ public class MusicHealthCheck { e.printStackTrace(); logger.error("Error", e); } - if(rs != null && rs.getResult().toLowerCase().contains("success")) - return true; - else - return false; + return rs != null && rs.getResult().toLowerCase().contains("success"); } public String getZookeeperStatus() { -- cgit 1.2.3-korg