From 5697b32134e86442895bbe81831a1cd0cbdcc678 Mon Sep 17 00:00:00 2001 From: Sujit Kumar <60378235+therealsujitk@users.noreply.github.com> Date: Fri, 26 Apr 2024 07:16:48 +0530 Subject: [PATCH] [JENKINS-57125] Trim the value and request parameter options (#112) * fix: trim value and request parameter options * fix: trim value string and include spaces before the comma --- .../ExtendedChoiceParameterDefinition.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/cwctravel/hudson/plugins/extended_choice_parameter/ExtendedChoiceParameterDefinition.java b/src/main/java/com/cwctravel/hudson/plugins/extended_choice_parameter/ExtendedChoiceParameterDefinition.java index e31e6c7e..937ccd36 100644 --- a/src/main/java/com/cwctravel/hudson/plugins/extended_choice_parameter/ExtendedChoiceParameterDefinition.java +++ b/src/main/java/com/cwctravel/hudson/plugins/extended_choice_parameter/ExtendedChoiceParameterDefinition.java @@ -529,12 +529,12 @@ public ParameterValue createValue(CLICommand command, String value) { if (valueStr != null) { List result = new ArrayList<>(); - String[] values = valueStr.split(","); + String[] values = valueStr.trim().split("\\s*,\\s*"); Set valueSet = new HashSet<>(Arrays.asList(values)); for (String requestValue : requestValues) { - if (valueSet.contains(requestValue)) { - result.add(requestValue); + if (valueSet.contains(requestValue.trim())) { + result.add(requestValue.trim()); } }