Skip to content

Commit

Permalink
Merge branch 'master' into handle_prompt_value_sensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaliiShevchuk committed Jul 6, 2020
2 parents 9595867 + 4c5833e commit 5ae1458
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.hp.oo.sdk.content.plugin.SessionObject;
import com.hp.oo.sdk.content.plugin.StepSerializableSessionObject;
import io.cloudslang.runtime.api.java.JavaExecutionParametersProvider;
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;
import java.lang.annotation.Annotation;
Expand Down Expand Up @@ -146,15 +147,19 @@ private void handleStepSessionContextArgument(Map sessionData, List<Object> args

private void handleSessionContextArgument(Map sessionData, String objectClassName, List<Object> args,
String parameterName, ClassLoader classLoader) {
Object sessionContextObject = sessionData.get(parameterName);
// cloudslang list iterator fix
final String parameter = StringUtils.startsWith(this.nodeNameWithDepth, "list_iterator") ?
this.nodeNameWithDepth : parameterName;

Object sessionContextObject = sessionData.get(parameter);
if (sessionContextObject == null) {
try {
sessionContextObject = Class.forName(objectClassName, true, classLoader).newInstance();
} catch (Exception e) {
throw new RuntimeException("Failed to create instance of [" + objectClassName + "] class", e);
}
//noinspection unchecked
sessionData.put(parameterName, sessionContextObject);
sessionData.put(parameter, sessionContextObject);
}
args.add(sessionContextObject);
}
Expand Down

0 comments on commit 5ae1458

Please sign in to comment.