Fix null pointer warning 56/106556/3
authorRodrigo Lima <rodrigo.lima@yoppworks.com>
Thu, 23 Apr 2020 19:41:02 +0000 (15:41 -0400)
committerOfir Sonsino <ofir.sonsino@intl.att.com>
Mon, 27 Apr 2020 05:53:19 +0000 (05:53 +0000)
- Check name and value in method setToscaPresentationValue

Issue-ID: SDC-2926
Signed-off-by: Rodrigo Lima <rodrigo.lima@yoppworks.com>
Change-Id: I0d66b29c84139afff92065769bf1b79082959333

common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java

index ee985d3..4637231 100644 (file)
@@ -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);
 
     }