From 3a9c8f13ac7b9a3a6ab90166b23f965fe9f64a5b Mon Sep 17 00:00:00 2001 From: Sujit Kumar <60378235+therealsujitk@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:55:54 +0530 Subject: [PATCH 1/2] fix: trim value and request parameter options --- .../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..3010719f 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.split(",\\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()); } } From a20b3b642c418891bf070b38c73878fbc4412c9e Mon Sep 17 00:00:00 2001 From: Sujit Kumar <60378235+therealsujitk@users.noreply.github.com> Date: Thu, 25 Apr 2024 16:49:17 +0530 Subject: [PATCH 2/2] fix: trim value string and include spaces before the comma --- .../ExtendedChoiceParameterDefinition.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3010719f..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,7 +529,7 @@ public ParameterValue createValue(CLICommand command, String value) { if (valueStr != null) { List result = new ArrayList<>(); - String[] values = valueStr.split(",\\s*"); + String[] values = valueStr.trim().split("\\s*,\\s*"); Set valueSet = new HashSet<>(Arrays.asList(values)); for (String requestValue : requestValues) {