diff options
author | sarada prasad sahoo <sarada.prasad.sahoo@huawei.com> | 2019-08-09 18:28:54 +0530 |
---|---|---|
committer | sarada prasad sahoo <sarada.prasad.sahoo@huawei.com> | 2019-08-09 18:28:54 +0530 |
commit | 1a654cb8eec332bd4f56402297622bc11d06e841 (patch) | |
tree | f29cb3be3eb06969b4fc3b8c25e48a540e26f5d4 /bpmn/so-bpmn-tasks | |
parent | c424831fb25b1915656d8b55ab292338561f2a71 (diff) |
fix sonar issue
fix sonar issues
Issue-ID: SO-1811
Signed-off-by: sarada prasad sahoo <sarada.prasad.sahoo@huawei.com>
Change-Id: I841a50876aaf22e1fbc597029f270d243adf2613
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index f23e5cdb5a..5c69987a54 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -33,6 +33,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Optional; import javax.annotation.PostConstruct; import org.apache.commons.lang3.StringUtils; @@ -210,23 +211,25 @@ public class VnfAdapterVfModuleObjectMapper { protected void buildDirectivesParamFromMap(Map<String, Object> paramsMap, String directive, Map<String, Object> srcMap) throws MissingValueTagException { StringBuilder directives = new StringBuilder(); - int no_directives_size = 0; + int noOfDirectivesSize = 0; if (directive.equals(MsoMulticloudUtils.USER_DIRECTIVES) && srcMap.containsKey(MsoMulticloudUtils.OOF_DIRECTIVES)) { - no_directives_size = 1; + noOfDirectivesSize = 1; } - if (srcMap.size() > no_directives_size) { + if (srcMap.size() > noOfDirectivesSize) { directives.append("{ \"attributes\": [ "); int i = 0; - for (String attributeName : srcMap.keySet()) { + for (Map.Entry<String, Object> attributeEntry : srcMap.entrySet()) { + String attributeName = attributeEntry.getKey(); + Object attributeValue = attributeEntry.getValue(); if (!(MsoMulticloudUtils.USER_DIRECTIVES.equals(directive) && attributeName.equals(MsoMulticloudUtils.OOF_DIRECTIVES))) { - if (srcMap.get(attributeName) == null) { + if (attributeValue == null) { logger.error("No value tag found for attribute: {}", attributeName); throw new MissingValueTagException("No value tag found for " + attributeName); } - directives.append(new AttributeNameValue(attributeName, srcMap.get(attributeName).toString())); - if (i < (srcMap.size() - 1 + no_directives_size)) + directives.append(new AttributeNameValue(attributeName, attributeValue.toString())); + if (i < (srcMap.size() - 1 + noOfDirectivesSize)) directives.append(", "); i++; } |