summaryrefslogtreecommitdiffstats
path: root/common-be
diff options
context:
space:
mode:
authorimamSidero <imam.hussain@est.tech>2023-06-15 12:32:37 +0100
committerMichael Morris <michael.morris@est.tech>2023-06-16 14:55:01 +0000
commitdee57e7e416bbcbd1fcbcf5acc905a679666af28 (patch)
tree1b352c154ec815ad020dbbcc00569929c68206a4 /common-be
parent6843db5fbca71b3a30fabb4dd97f818dc4d6b72d (diff)
Bug fix for the get input tosca function of list of nested complex type
Fixed bug regarding tosca function for list of nested complex type Issue-ID: SDC-4538 Signed-off-by: Imam hussain <imam.hussain@est.tech> Change-Id: I41adff984d7b7bb0f968c4ed3a24c895a546a7b9
Diffstat (limited to 'common-be')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaFunctionJsonDeserializer.java22
1 files changed, 7 insertions, 15 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaFunctionJsonDeserializer.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaFunctionJsonDeserializer.java
index e234a4666f..9671eee217 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaFunctionJsonDeserializer.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaFunctionJsonDeserializer.java
@@ -159,23 +159,15 @@ public class ToscaFunctionJsonDeserializer extends StdDeserializer<ToscaFunction
if (!jsonNode.isArray()) {
throw context.instantiationException(ToscaGetFunctionDataDefinition.class, "Expecting an array for toscaIndexList attribute");
}
- for (int index = 0; index < jsonNode.size(); index++) {
- String textValue = jsonNode.get(index).asText();
- if (index % 2 == 0) {
- if (textValue.equalsIgnoreCase("INDEX")) {
- toscaIndexList.add(textValue);
- } else {
- try {
- toscaIndexList.add(Integer.parseInt(textValue));
- } catch (Exception e) {
- throw context.instantiationException(ToscaGetFunctionDataDefinition.class,
- "Expecting a valid value for toscaIndex attribute");
- }
- }
+
+ jsonNode.forEach(nodeValue -> {
+ String indexValue = nodeValue.asText();
+ if (StringUtils.isNumeric(indexValue)) {
+ toscaIndexList.add(Integer.parseInt(indexValue));
} else {
- toscaIndexList.add(textValue);
+ toscaIndexList.add(indexValue);
}
- }
+ });
}
return toscaIndexList;
}