From 0da7429295146655f0e59edb1d13b7a51893cf8a Mon Sep 17 00:00:00 2001 From: Dave Chen Date: Wed, 19 Jul 2017 12:49:24 +0800 Subject: [SDC-139] Check the validity of input parameter Change-Id: Ib0a5826f7d472b77413360e0161cb3e3ec776431 Signed-off-by: Dave Chen --- .../org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java b/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java index eae0aac..3b87986 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java +++ b/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java @@ -798,8 +798,14 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper { //Assumed to be unique property for the list private NodeTemplate getNodeTemplateByCustomizationUuid(List nodeTemplates, String customizationId) { - Optional findFirst = nodeTemplates.stream().filter(x -> (x.getMetaData() != null && customizationId.equals(x.getMetaData().getValue(PROPERTY_NAME_CUSTOMIZATIONUUID)))).findFirst(); - return findFirst.isPresent() ? findFirst.get() : null; + if (customizationId != null) { + Optional findFirst = nodeTemplates.stream().filter(x -> (x.getMetaData() != null && customizationId.equals(x.getMetaData().getValue(PROPERTY_NAME_CUSTOMIZATIONUUID)))).findFirst(); + return findFirst.isPresent() ? findFirst.get() : null; + } + else { + log.error("getNodeTemplateByCustomizationUuid - customizationId is null"); + return null; + } } private Object processProperties(String[] split, LinkedHashMap properties) { -- cgit 1.2.3-korg