From c50e7b31496bb244ec627602f5ec368c0f9636fa Mon Sep 17 00:00:00 2001 From: Chandan Ghosh Date: Wed, 29 Aug 2018 12:33:48 +0530 Subject: Added fix for potential nullpointer exception Added fix for potential nullpointerexception reported in sonarqube Issue-ID: MUSIC-114 Change-Id: I6792a357534880fb85d353e2832b16aca2415c8b Signed-off-by: Chandan Ghosh --- .../java/org/onap/music/rest/RestMusicAdminAPI.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java b/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java index 48f28f8c..f28f236f 100755 --- a/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java +++ b/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java @@ -22,7 +22,6 @@ package org.onap.music.rest; -import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -506,19 +505,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); -- cgit 1.2.3-korg