summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Lima <rodrigo.lima@yoppworks.com>2020-04-23 15:41:02 -0400
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-04-27 05:53:19 +0000
commitbebff57a6a661825d26a17813fe4a3230ac6f9db (patch)
tree6149118c8d5efe2e5e64709983ad80a742decc84
parent3c80616437c89c14b3734a3876b48faafd2129e9 (diff)
Fix null pointer warning
- Check name and value in method setToscaPresentationValue Issue-ID: SDC-2926 Signed-off-by: Rodrigo Lima <rodrigo.lima@yoppworks.com> Change-Id: I0d66b29c84139afff92065769bf1b79082959333
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java8
1 files changed, 5 insertions, 3 deletions
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);
}