From bc6260e4b214d8a1544e653a3f6a63d525ac9d7a Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Tue, 28 Aug 2018 12:46:42 +0530 Subject: MusicCore.java : Fixed sonar issue Fixed sonar issue, null pointer exception could be thrown Issue-ID: MUSIC-111 Change-Id: I4ea473a5e656292ecfd807ab84793f7c4ec233b2 Signed-off-by: Arundathi Patil --- src/main/java/org/onap/music/main/MusicCore.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/onap/music/main/MusicCore.java b/src/main/java/org/onap/music/main/MusicCore.java index b729ba74..aaaeae34 100644 --- a/src/main/java/org/onap/music/main/MusicCore.java +++ b/src/main/java/org/onap/music/main/MusicCore.java @@ -73,7 +73,10 @@ public class MusicCore { public boolean testCondition() throws Exception { // first generate the row ResultSet results = quorumGet(selectQueryForTheRow); - Row row = results.one(); + Row row = null; + if(results != null) { + row = results.one(); + } return getDSHandle().doesRowSatisfyCondition(row, conditions); } } @@ -288,7 +291,8 @@ public class MusicCore { MusicLockState newMls = null; try { currentMls = getMusicLockState(key); - String currentLockHolder = currentMls.getLockHolder(); + String currentLockHolder = null; + if(currentMls != null) { currentLockHolder = currentMls.getLockHolder(); }; if (lockId.equals(currentLockHolder)) { logger.info(EELFLoggerDelegate.applicationLogger,"In acquire lock: You already have the lock!"); return new ReturnType(ResultType.SUCCESS, "You already have the lock!"); -- cgit 1.2.3-korg