From: MichaelMorris Date: Thu, 25 May 2023 09:55:59 +0000 (+0100) Subject: Fix NPE using concat TOSCA functions X-Git-Tag: 1.13.0~18 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=b0c11fcb95f4c4d1ba2a9be611ea1453b0d90e85;p=sdc.git Fix NPE using concat TOSCA functions Signed-off-by: MichaelMorris Issue-ID: SDC-4509 Change-Id: I57173758bdb8293ffeb774e4dfac3f18ab4abae8 --- diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaGetFunctionDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaGetFunctionDataDefinition.java index 5bd9fe33db..82958a7532 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaGetFunctionDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaGetFunctionDataDefinition.java @@ -89,7 +89,7 @@ public class ToscaGetFunctionDataDefinition implements ToscaFunction, ToscaFunct ); } if (propertySource == PropertySource.SELF) { - if (toscaIndexList.size() > 0) { + if (CollectionUtils.isNotEmpty(toscaIndexList)) { List parsedIndexList = new ArrayList(); toscaIndexList.forEach((obj) -> { parsedIndexList.add(StringUtils.isNumeric(obj.toString()) ? Integer.parseInt(obj.toString()) : obj); @@ -108,7 +108,7 @@ public class ToscaGetFunctionDataDefinition implements ToscaFunction, ToscaFunct String.format("sourceName is required in order to generate the %s from INSTANCE value", functionType.getFunctionName()) ); } - if (toscaIndexList.size() > 0) { + if (CollectionUtils.isNotEmpty(toscaIndexList)) { List parsedIndexList = new ArrayList(); toscaIndexList.forEach((obj) -> { parsedIndexList.add(StringUtils.isNumeric(obj.toString()) ? Integer.parseInt(obj.toString()) : obj); @@ -129,7 +129,7 @@ public class ToscaGetFunctionDataDefinition implements ToscaFunction, ToscaFunct List propertySourceCopy = new ArrayList(this.propertyPathFromSource); List propertySourceOneCopy = new ArrayList<>(); propertySourceOneCopy.add(this.propertyPathFromSource.get(0)); - if (toscaIndexList.size() > 0) { + if (CollectionUtils.isNotEmpty(toscaIndexList)) { propertySourceCopy.addAll(toscaIndexList); propertySourceOneCopy.addAll(toscaIndexList); }