aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-tosca-parser
diff options
context:
space:
mode:
authorMurali-P <murali.p@huawei.com>2017-04-18 12:16:07 +0530
committerMurali-P <murali.p@huawei.com>2017-04-18 12:16:07 +0530
commit3a3b9a240974189766a7a72b026cb85cc9cbadc2 (patch)
treea9a7f4d75d65e67e964414c23958b8b1d8480697 /sdc-tosca-parser
parent429b875ade17cf4fbd5d6fb9a9ff8e4abe34973e (diff)
Remove un-necessary null check
1) getNodeTemplates function do not return null value 2) sonar blocker issue Change-Id: Ifaa683819b0fed0d7910b33f9c979320afa58814 Signed-off-by: Murali-P <murali.p@huawei.com>
Diffstat (limited to 'sdc-tosca-parser')
-rw-r--r--sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
index 156b912..9ee3132 100644
--- a/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
+++ b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
@@ -372,14 +372,18 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
public List<NodeTemplate> getAllottedResources() {
List<NodeTemplate> nodeTemplates = null;
nodeTemplates = toscaTemplate.getTopologyTemplate().getNodeTemplates();
- if(nodeTemplates==null || nodeTemplates.size()==0 ){
+ if (nodeTemplates.isEmpty()) {
log.error("getAllottedResources nodeTemplates not exist");
}
- nodeTemplates = nodeTemplates.stream().filter(x -> x.getMetadata() != null && x.getMetadata().getValue("category").equals("Allotted Resources")).collect(Collectors.toList());
- if(nodeTemplates==null || nodeTemplates.size()==0 ){
+ nodeTemplates = nodeTemplates.stream().filter(
+ x -> x.getMetadata() != null && x.getMetadata().getValue("category").equals("Allotted Resources"))
+ .collect(Collectors.toList());
+ if (nodeTemplates.isEmpty()) {
log.trace("getAllottedResources - allotted resources not exist");
- }else
+ } else {
log.trace("getAllottedResources - the allotted resources list is {}", nodeTemplates);
+ }
+
return nodeTemplates;
}
@Override