From 3a3b9a240974189766a7a72b026cb85cc9cbadc2 Mon Sep 17 00:00:00 2001 From: Murali-P Date: Tue, 18 Apr 2017 12:16:07 +0530 Subject: 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 --- .../openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java | 12 ++++++++---- 1 file 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 getAllottedResources() { List 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 -- cgit 1.2.3-korg