aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChandan Ghosh <cghosh12@in.ibm.com>2018-09-03 12:36:28 +0530
committerChandan Ghosh <cghosh12@in.ibm.com>2018-09-03 13:11:39 +0530
commit84ca0daa195dc3aa7ed6f31a56863ae9f92eac1a (patch)
tree2c5855e980d57861c143adde2f761fb877031a3b /src
parent60a215503f38974c409c963d3f3a8154be01bdd5 (diff)
Added fix for potential nullpointerexception
Added fix for potential nullpointerexception and added error log reported in sonarqube Issue-ID: MUSIC-119 Change-Id: I13b3b13b1caa209c0f9ff9f19b38a62c4486c2fe Signed-off-by: Chandan Ghosh <cghosh12@in.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java4
-rwxr-xr-xsrc/main/java/org/onap/music/rest/RestMusicAdminAPI.java19
2 files changed, 14 insertions, 9 deletions
diff --git a/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java b/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java
index 5f9c07ee..b09668b7 100644
--- a/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java
+++ b/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java
@@ -298,7 +298,7 @@ public class ZkStatelessLockService extends ProtocolSupport {
try {
stat = zookeeper.exists(id, false);
} catch (KeeperException | InterruptedException e1) {
- e1.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger, "Error in execute: " + e1);
}
Long ctime = stat.getCtime();
MusicUtil.zkNodeMap.put(id, ctime);
@@ -310,7 +310,7 @@ public class ZkStatelessLockService extends ProtocolSupport {
pQuery.addValue(MusicUtil.convertToActualDataType(DataType.text(), ctime));
MusicCore.eventualPut(pQuery);
} catch (Exception e) {
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger, "Error in execute: " + e);
}
break;
}
diff --git a/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java b/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java
index 48f28f8c..937ec77a 100755
--- a/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java
+++ b/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java
@@ -506,19 +506,24 @@ public class RestMusicAdminAPI {
logger.info(operation+ ": Operation :: changeValue: "+changeValueMap);
if(operation.equals("update")) {
String notifyWhenChangeIn = baseRequestObj.getNotifyWhenChangeIn(); // conductor.plans.status
- if(field_value.equals(notifyWhenChangeIn)) {
- notifyCallBackAppl(jsonResponse, baseRequestObj);
+ if(null!=field_value) {
+ if(field_value.equals(notifyWhenChangeIn)) {
+ notifyCallBackAppl(jsonResponse, baseRequestObj);
+ }
}
-
} else if(operation.equals("delete")) {
String notifyWhenDeletesIn = baseRequestObj.getNotifyWhenDeletesIn(); // conductor.plans.status
- if(field_value.equals(notifyWhenDeletesIn)) {
- notifyCallBackAppl(jsonResponse, baseRequestObj);
+ if(null!=field_value) {
+ if(field_value.equals(notifyWhenDeletesIn)) {
+ notifyCallBackAppl(jsonResponse, baseRequestObj);
+ }
}
} else if(operation.equals("insert")) {
String notifyWhenInsertsIn = baseRequestObj.getNotifyWhenInsertsIn(); // conductor.plans.status
- if(field_value.equals(notifyWhenInsertsIn)) {
- notifyCallBackAppl(jsonResponse, baseRequestObj);
+ if(null!=field_value) {
+ if(field_value.equals(notifyWhenInsertsIn)) {
+ notifyCallBackAppl(jsonResponse, baseRequestObj);
+ }
}
}
MusicCore.releaseLock(lockId, true);