Added fix for potential nullpointer exception 99/63399/1
authorChandan Ghosh <cghosh12@in.ibm.com>
Wed, 29 Aug 2018 07:03:48 +0000 (12:33 +0530)
committerChandan Ghosh <cghosh12@in.ibm.com>
Wed, 29 Aug 2018 07:03:56 +0000 (12:33 +0530)
Added fix for potential nullpointerexception reported in sonarqube

Issue-ID: MUSIC-114
Change-Id: I6792a357534880fb85d353e2832b16aca2415c8b
Signed-off-by: Chandan Ghosh <cghosh12@in.ibm.com>
src/main/java/org/onap/music/rest/RestMusicAdminAPI.java

index 48f28f8..f28f236 100755 (executable)
@@ -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);