aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArundathi Patil <arundpil@in.ibm.com>2018-08-27 16:51:35 +0530
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>2018-08-27 16:52:24 +0530
commitba7e52156a998a5cffc59a95c05d104074a23964 (patch)
tree610c9921652dd9d16fd321b597e1376b4672a099
parent0d2f003049e562354fda88729dbab70f46daa25f (diff)
MusicHealthCheck.java- Fixed sonar issue
Fixed sonar issue, A nullpointer exception could be thrown Issue-ID: MUSIC-108 Change-Id: Id025658bde7b92bbacd940fc6c2121fc84086ea6 Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
-rw-r--r--src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java10
1 files changed, 6 insertions, 4 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 9c3e842e..af6e6151 100644
--- a/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java
+++ b/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java
@@ -56,16 +56,19 @@ public class MusicHealthCheck {
result = getAdminKeySpace(consistency);
} catch(Exception e) {
if(e.getMessage().toLowerCase().contains("unconfigured table healthcheck")) {
- System.out.println("Creating table....");
+ logger.error("Error", e);
+ logger.debug("Creating table....");
boolean ksresult = createKeyspace();
if(ksresult)
try {
result = getAdminKeySpace(consistency);
} catch (MusicServiceException e1) {
// TODO Auto-generated catch block
+ logger.error("Error", e);
e1.printStackTrace();
}
} else {
+ logger.error("Error", e);
return "One or more nodes are down or not responding.";
}
}
@@ -103,8 +106,9 @@ public class MusicHealthCheck {
} catch (MusicServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
+ logger.error("Error", e);
}
- if(rs.getResult().toLowerCase().contains("success"))
+ if(rs != null && rs.getResult().toLowerCase().contains("success"))
return true;
else
return false;
@@ -126,8 +130,6 @@ public class MusicHealthCheck {
logger.info(EELFLoggerDelegate.applicationLogger, "Zookeeper is Active and Running");
return "ACTIVE";
- // return "Zookeeper is not responding";
-
}
public String getCassandrHost() {