From: Steven Blimkie Date: Wed, 25 Jul 2018 14:51:11 +0000 (+0000) Subject: Merge "Fix potential null pointer places" X-Git-Tag: 1.3.0~22 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=adb1e19bc2103f0a444e6dd82795a7b79225a802;hp=-c;p=aai%2Fsparky-be.git Merge "Fix potential null pointer places" --- adb1e19bc2103f0a444e6dd82795a7b79225a802 diff --combined sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/services/BaseVisualizationContext.java index aa4508c,5dd5aca..0cbd52e --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/services/BaseVisualizationContext.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/services/BaseVisualizationContext.java @@@ -538,38 -538,15 +538,15 @@@ public class BaseVisualizationContext i JsonNode nodeValue = field.getValue(); - if (nodeValue != null && nodeValue.isValueNode()) { - - if (oxmEntityLookup.getEntityDescriptors().get(fieldName) == null) { - - /* - * entity property name is not an entity, thus we can add this property name and value - * to our property set - */ - - ain.addProperty(fieldName, nodeValue.asText()); - - } - - } else { - - if (nodeValue.isArray()) { - - if (oxmEntityLookup.getEntityDescriptors().get(fieldName) == null) { - - /* - * entity property name is not an entity, thus we can add this property name and value - * to our property set - */ - - ain.addProperty(field.getKey(), nodeValue.toString()); - - } - + if(nodeValue!=null) { + if (nodeValue.isValueNode()) { + String key = fieldName; + handleNodeValue(ain, fieldName, key, nodeValue.asText()); + } else if (nodeValue.isArray()) { + String key = field.getKey(); + handleNodeValue(ain, fieldName, key, nodeValue.toString()); } else { - - ain.addComplexGroup(nodeValue); - + ain.addComplexGroup(nodeValue); } } @@@ -628,6 -605,19 +605,19 @@@ } + private void handleNodeValue(ActiveInventoryNode ain, String fieldName, String key, String value) { + if (oxmEntityLookup.getEntityDescriptors().get(fieldName) == null) { + + /* + * entity property name is not an entity, thus we can add this property name and value + * to our property set + */ + + ain.addProperty(key, value); + + } + } + /** * Perform self link resolve. * @@@ -826,7 -816,6 +816,6 @@@ /** * Process current node states. * - * @param rootNodeDiscovered the root node discovered */ private void processCurrentNodeStates(QueryParams queryParams) { /* @@@ -1445,7 -1434,6 +1434,7 @@@ Thread.sleep(10); } catch (InterruptedException exc) { LOG.error(AaiUiMsgs.PROCESSING_LOOP_INTERUPTED, exc.getMessage()); + Thread.currentThread().interrupt(); return; }