mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-18 06:22:29 +00:00
prefer better static typing
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15710 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
5baac35748
commit
0c80771feb
5 files changed
+17
-12
No files matched your search
@@ -32,6 +32,7 @@ import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Environment variables.
|
||||
@@ -53,10 +54,18 @@ public class EnvVars extends TreeMap<String,String> {
|
||||
}
|
||||
|
||||
public EnvVars(Map<String,String> m) {
|
||||
super(CaseInsensitiveComparator.INSTANCE);
|
||||
this();
|
||||
putAll(m);
|
||||
}
|
||||
|
||||
public EnvVars(String... keyValuePairs) {
|
||||
this();
|
||||
if(keyValuePairs.length%2!=0)
|
||||
throw new IllegalArgumentException(Arrays.asList(keyValuePairs).toString());
|
||||
for( int i=0; i<keyValuePairs.length; i+=2 )
|
||||
put(keyValuePairs[i],keyValuePairs[i+1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the current entry by the given entry.
|
||||
*
|
||||
|
||||
@@ -35,7 +35,6 @@ import hudson.util.StreamTaskListener;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -61,16 +60,16 @@ public class CommandLauncher extends ComputerLauncher {
|
||||
private final String agentCommand;
|
||||
|
||||
/**
|
||||
* Optional environment variables to add to the current environment
|
||||
* Optional environment variables to add to the current environment. Can be null.
|
||||
*/
|
||||
private final Map<String, String> env;
|
||||
private final EnvVars env;
|
||||
|
||||
@DataBoundConstructor
|
||||
public CommandLauncher(String command) {
|
||||
this(command, null);
|
||||
}
|
||||
|
||||
public CommandLauncher(String command, Map<String,String> env) {
|
||||
public CommandLauncher(String command, EnvVars env) {
|
||||
this.agentCommand = command;
|
||||
this.env = env;
|
||||
}
|
||||
|
||||
@@ -114,9 +114,7 @@ public abstract class ProcessTreeKiller {
|
||||
* when we later kill the processes.
|
||||
*/
|
||||
public static EnvVars createCookie() {
|
||||
EnvVars r = new EnvVars();
|
||||
r.put("HUDSON_COOKIE",UUID.randomUUID().toString());
|
||||
return r;
|
||||
return new EnvVars("HUDSON_COOKIE",UUID.randomUUID().toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user