Fix Blocker/Critical sonar issues 01/13701/1
authorshashikanth <shashikanth.vh@huawei.com>
Wed, 20 Sep 2017 06:15:07 +0000 (11:45 +0530)
committershashikanth <shashikanth.vh@huawei.com>
Wed, 20 Sep 2017 06:15:08 +0000 (11:45 +0530)
Fix Blocker/Critical sonar issues in aai/sparky-be module
https://sonar.onap.org/component_issues?id=org.openecomp.aai.sparky-be%3Asparky-be#resolved=false|severities=BLOCKER

Fixed: NullPointerException might be thrown as 'aaiQueryResult' is nullable here
NullPointerException might be thrown as 'rootNode' is nullable here

Issue-Id:AAI-342
Change-Id: Ie91d695ada7159ca002385407cf1c8e0f0d59d6d
Signed-off-by: shashikanth.vh <shashikanth.vh@huawei.com>
src/main/java/org/openecomp/sparky/synchronizer/CrossEntityReferenceSynchronizer.java

index c825040..1e3e85c 100644 (file)
@@ -338,7 +338,10 @@ public class CrossEntityReferenceSynchronizer extends AbstractEntitySynchronizer
       try {
         rootNode = mapper.readTree(jsonResult);
       } catch (IOException exc) {
-        // TODO // TODO -> LOG, waht should be logged here?
+        String message = "Could not deserialize JSON (representing operation result) as node tree. "
+                + "Operation result = " + jsonResult + ". " + exc.getLocalizedMessage();
+        LOG.error(AaiUiMsgs.JSON_PROCESSING_ERROR, message);
+        return;
       }
 
       JsonNode resultData = rootNode.get("result-data");
@@ -576,7 +579,7 @@ public class CrossEntityReferenceSynchronizer extends AbstractEntitySynchronizer
                         }
                         
                       } else {
-                        String message = "Entity sync failed because AAI query failed with error " + aaiQueryResult.getResult(); 
+                        String message = "Entity sync failed because AAI query failed with error ";
                         LOG.error(AaiUiMsgs.ENTITY_SYNC_FAILED_QUERY_ERROR, message);
                       }