From 30382d5b97ede560a8d97f551006669510b72cdd Mon Sep 17 00:00:00 2001 From: adriana-corui <54841592+adriana-corui@users.noreply.github.com> Date: Tue, 2 Aug 2022 14:02:19 +0300 Subject: [PATCH] list iterator parameters fix (#1365) * list iterator parameters fix * remove space --- .../CloudSlangJavaExecutionParameterProvider.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cloudslang-runtime/src/main/java/io/cloudslang/lang/runtime/steps/CloudSlangJavaExecutionParameterProvider.java b/cloudslang-runtime/src/main/java/io/cloudslang/lang/runtime/steps/CloudSlangJavaExecutionParameterProvider.java index 7435a55144..209bcedac1 100644 --- a/cloudslang-runtime/src/main/java/io/cloudslang/lang/runtime/steps/CloudSlangJavaExecutionParameterProvider.java +++ b/cloudslang-runtime/src/main/java/io/cloudslang/lang/runtime/steps/CloudSlangJavaExecutionParameterProvider.java @@ -38,6 +38,8 @@ public class CloudSlangJavaExecutionParameterProvider implements JavaExecutionPa private static final String SERIALIZABLE_SESSION_OBJECT = SerializableSessionObject.class.getCanonicalName(); private static final String STEP_SERIALIZABLE_SESSION_OBJECT = StepSerializableSessionObject.class.getCanonicalName(); + private static final String LIST_ITERATOR_ACTION = "io.cloudslang.content.actions.ListIteratorAction"; + private final Map serializableSessionData; private final Map currentContext; private final Map globalSessionObjectData; @@ -69,18 +71,19 @@ public Object[] getExecutionParameters(Method executionMethod) { for (Annotation annotation : annotations) { String parameterName = getValueIfParamAnnotation(annotation); if (parameterName != null) { + final String methodName = executionMethod.getDeclaringClass().getName(); String paramClassName = parameterTypes[index].getCanonicalName(); if (paramClassName.equals(GLOBAL_SESSION_OBJECT_CLASS_NAME)) { handleSessionContextArgument(globalSessionObjectData, GLOBAL_SESSION_OBJECT_CLASS_NAME, - args, parameterName, + args, parameterName, methodName, annotation.getClass().getClassLoader()); } else if (paramClassName.equals(SESSION_OBJECT_CLASS_NAME)) { handleSessionContextArgument(sessionObjectData, SESSION_OBJECT_CLASS_NAME, - args, parameterName + "_" + (depth - 1), + args, parameterName + "_" + (depth - 1), methodName, annotation.getClass().getClassLoader()); } else if (paramClassName.equals(SERIALIZABLE_SESSION_OBJECT)) { handleSessionContextArgument(serializableSessionData, SERIALIZABLE_SESSION_OBJECT, - args, parameterName, + args, parameterName, methodName, annotation.getClass().getClassLoader()); } else if (paramClassName.equals(STEP_SERIALIZABLE_SESSION_OBJECT)) { handleStepSessionContextArgument(serializableSessionData, args, parameterName, @@ -146,9 +149,9 @@ private void handleStepSessionContextArgument(Map sessionData, List args } private void handleSessionContextArgument(Map sessionData, String objectClassName, List args, - String parameterName, ClassLoader classLoader) { - // cloudslang list iterator fix - final String parameter = StringUtils.startsWith(this.nodeNameWithDepth, "list_iterator") ? + String parameterName, String methodName, ClassLoader classLoader) { + // cloudSlang list iterator fix + final String parameter = StringUtils.equals(methodName, LIST_ITERATOR_ACTION) ? this.nodeNameWithDepth : parameterName; Object sessionContextObject = sessionData.get(parameter);