From: Rodrigo Lima Date: Thu, 23 Apr 2020 19:41:02 +0000 (-0400) Subject: Fix null pointer warning X-Git-Tag: 1.7.0~197 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=bebff57a6a661825d26a17813fe4a3230ac6f9db;p=sdc.git Fix null pointer warning - Check name and value in method setToscaPresentationValue Issue-ID: SDC-2926 Signed-off-by: Rodrigo Lima Change-Id: I0d66b29c84139afff92065769bf1b79082959333 --- diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java index ee985d3fa1..4637231de6 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java @@ -54,10 +54,12 @@ public abstract class ToscaDataDefinition { } public void setToscaPresentationValue(JsonPresentationFields name, Object value) { - if (toscaPresentation == null && value != null) { - toscaPresentation = new HashMap<>(); + if(name !=null) { + if (toscaPresentation == null) { + toscaPresentation = new HashMap<>(); + } + toscaPresentation.put(name.getPresentation(), value); } - toscaPresentation.put(name.getPresentation(), value); }