diff options
author | Oleksandr Moliavko <o.moliavko@samsung.com> | 2019-09-26 15:10:51 +0300 |
---|---|---|
committer | Oleksandr Moliavko <o.moliavko@samsung.com> | 2019-09-26 15:10:51 +0300 |
commit | 45fd1ff76bfb9284136cf38734e6369a0d47a6e0 (patch) | |
tree | eb9e7d6c5fbfa237ca0dcdb840dbc4ee78b1ef75 | |
parent | 5323b7150d0c4df4b0c38e0537c78fc011c0fb9b (diff) |
Added null check for vMap to prevent static
analyzer warning about potential crash at
vMap.entrySet() call
Issue-ID: SO-1841
Signed-off-by: Oleksandr Moliavko <o.moliavko@samsung.com>
Change-Id: I6eacb28c6720b7432fd31faabacd9dc52f0abe60
-rw-r--r-- | bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java index d33e7aed0c..70365b744c 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java @@ -85,12 +85,14 @@ public class WorkflowProcessor extends ProcessEngineAwareService { Map<String, Object> inputVariables = new HashMap<>(); @SuppressWarnings("unchecked") Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables"); - for (Map.Entry<String, Object> entry : vMap.entrySet()) { - String vName = entry.getKey(); - Object value = entry.getValue(); - @SuppressWarnings("unchecked") - Map<String, Object> valueMap = (Map<String, Object>) value; // value, type - inputVariables.put(vName, valueMap.get("value")); + if (vMap != null) { + for (Map.Entry<String, Object> entry : vMap.entrySet()) { + String vName = entry.getKey(); + Object value = entry.getValue(); + @SuppressWarnings("unchecked") + Map<String, Object> valueMap = (Map<String, Object>) value; // value, type + inputVariables.put(vName, valueMap.get("value")); + } } return inputVariables; } |