Skip to content
Permalink
Browse files

[FIXED JENKINS-24757] Allow spaces in script parameters

  • Loading branch information...
vjuranek committed Sep 18, 2014
1 parent e164d48 commit c9c33b17fe9099d64b21b7d4976f0ebf1fb15e44
Showing with 8 additions and 9 deletions.
  1. +8 −9 src/main/java/hudson/plugins/groovy/Groovy.java
@@ -284,7 +284,7 @@ public String getName() {

//Add groovy parameters
if(parameters != null && !parameters.isEmpty()) {
String[] args = parseGroovyCmdLine(parameters);
String[] args = parseParams(parameters);
for(String arg : args) {
list.add(Util.replaceMacro(arg, vr));
}
@@ -293,18 +293,17 @@ public String getName() {
list.add(script.getRemote());

//Add script parameters
if(scriptParameters != null) {
StringTokenizer tokens = new StringTokenizer(scriptParameters);
if(scriptParameters != null && !scriptParameters.isEmpty()) {
String[] params = parseParams(scriptParameters);
ParametersAction parameters = build.getAction(ParametersAction.class);
while(tokens.hasMoreTokens()) {
String token = tokens.nextToken();
for(String param : params) {
//first replace parameter from parameterized build
if (parameters != null) {
token = parameters.substitute(build, token);
param = parameters.substitute(build, param);
}
//then replace evn vars
token = Util.replaceMacro(token,vr);
list.add(token);
param = Util.replaceMacro(param,vr);
list.add(param);
}
}

@@ -316,7 +315,7 @@ public String getName() {
* Parse parameters to be passed as arguments to the groovy binary
*
*/
private String[] parseGroovyCmdLine(String line) {
private String[] parseParams(String line) {
CommandLine cmdLine = CommandLine.parse(line);
String[] parsedArgs = cmdLine.getArguments();
String[] args = new String[parsedArgs.length + 1];

0 comments on commit c9c33b1

Please sign in to comment.
You can’t perform that action at this time.