diff options
author | Dave Chen <wei.d.chen@intel.com> | 2017-07-19 12:49:24 +0800 |
---|---|---|
committer | Dave Chen <wei.d.chen@intel.com> | 2017-07-24 12:22:13 +0800 |
commit | 0da7429295146655f0e59edb1d13b7a51893cf8a (patch) | |
tree | c3e45082b7fdcbb9a754de05d3fbe43d9867fd55 | |
parent | 56c5f082b7ff6861f53ca974574ee9ddce73a6f4 (diff) |
[SDC-139] Check the validity of input parameter
Change-Id: Ib0a5826f7d472b77413360e0161cb3e3ec776431
Signed-off-by: Dave Chen <wei.d.chen@intel.com>
-rw-r--r-- | src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java | 10 |
1 files changed, 8 insertions, 2 deletions
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<NodeTemplate> nodeTemplates, String customizationId) { - Optional<NodeTemplate> 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<NodeTemplate> 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<String, Property> properties) { |