Skip to content
Permalink
Browse files
[JENKINS-38532] When the user supplies parameters with equals separat…
…or, rebuild the remaining string
  • Loading branch information
kinow committed Nov 26, 2016
1 parent cc8b2f3 commit cc764d6776b5ad0186f60a13b0f66c90326ecbd2
Showing with 20 additions and 3 deletions.
  1. +15 −2 src/main/java/org/biouno/unochoice/AbstractCascadableParameter.java
  2. +5 −1 src/main/java/org/biouno/unochoice/AbstractScriptableParameter.java
@@ -45,7 +45,7 @@
/*
* Serial UID.
*/
private static final long serialVersionUID = 6992538803651219246L;
private static final long serialVersionUID = 3795727126307053346L;
/**
* Map with parameters in the UI.
*/
@@ -114,7 +114,7 @@ public void doUpdate(String parameters) {
getParameters().clear();
final String[] params = parameters.split(SEPARATOR);
for (String param : params) {
final String[] nameValue = param.split("=");
final String[] nameValue = param.split(EQUALS);
if (nameValue.length == 1) {
final String name = nameValue[0].trim();
if (name.length() > 0)
@@ -123,6 +123,19 @@ public void doUpdate(String parameters) {
final String name = nameValue[0];
final String value = nameValue[1];
getParameters().put(name, value);
} else if (nameValue.length > 2) {
// TBD: we can eliminate this branch by splitting only on the first EQUALS
final String name = nameValue[0];
final StringBuilder sb = new StringBuilder();
// rebuild the rest of the string, skipping the first value
for (int i = 1; i < nameValue.length; ++i) {
sb.append(nameValue[i]);
if (i+1 < nameValue.length) {
sb.append(EQUALS);
}
}
final String value = sb.toString();
getParameters().put(name, value);
}
}
}
@@ -57,11 +57,15 @@
/*
* Serial UID.
*/
private static final long serialVersionUID = -6533352776594510145L;
private static final long serialVersionUID = 1322134413144485771L;
/**
* Used to split values that come from the UI via Ajax POST's
*/
protected static final String SEPARATOR = "__LESEP__";
/**
* Used to split values when scripts return values like A=2, B=3.
*/
protected static final String EQUALS = "=";
/**
* Constant used to add the project in the environment variables map.
*/

0 comments on commit cc764d6

Please sign in to comment.