Fix 'raw type' warnings. No significant API changes.

This commit is contained in:
Chris Beams
2010-07-29 17:51:35 +02:00
parent be3904109e
commit ba50092b37
10 changed files with 33 additions and 32 deletions

View File

@@ -109,6 +109,7 @@ public class Background {
String[] execCmd;
ArrayList tmpCmd = new ArrayList();
Runtime r;
ArrayList<String> tmpCmd = new ArrayList<String>();
tmpCmd.add("cmd");
tmpCmd.add("/c");

View File

@@ -51,15 +51,15 @@ public class Execute {
private File workingDirectory = null;
private boolean newEnvironment = false;
private static Vector procEnvironment = null;
private static Vector<String> procEnvironment = null;
/**
* Find the list of environment variables for this process.
*/
public static synchronized Vector getProcEnvironment() {
public static synchronized Vector<String> getProcEnvironment() {
if (procEnvironment != null) return procEnvironment;
procEnvironment = new Vector();
procEnvironment = new Vector<String>();
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
Execute exe = new Execute(new PumpStreamHandler(out));
@@ -321,7 +321,8 @@ public class Execute {
* @return the patched environment
*/
private String[] patchEnvironment() {
Vector osEnv = (Vector) getProcEnvironment().clone();
@SuppressWarnings("unchecked")
Vector<String> osEnv = (Vector<String>) getProcEnvironment().clone();
for (int i = 0; i < env.length; i++) {
int pos = env[i].indexOf('=');
// Get key including "="
@@ -340,18 +341,18 @@ public class Execute {
return result;
}
public static int execute( Vector envVars, String cmd, File baseDir ) {
Vector v=new Vector();
public static int execute(Vector<String> envVars, String cmd, File baseDir ) {
Vector<String> v = new Vector<String>();
StringTokenizer st=new StringTokenizer( cmd, " " );
while( st.hasMoreTokens() ) {
v.addElement( st.nextElement() );
v.addElement( st.nextToken() );
}
return execute( envVars, v, baseDir );
}
public static int execute( Vector envVars, Vector cmd, File baseDir) {
return execute( envVars, cmd, baseDir, 10000 /* default time to wait */);
public static int execute(Vector<String> envVars, Vector<String> cmd, File baseDir) {
return execute( envVars, cmd, baseDir, 10000 /* default time to wait */);
}
/** Wrapper for common execution patterns
@@ -360,7 +361,7 @@ public class Execute {
* @param baseDir the base directory to run from (optional)
* @param timeToWait milliseconds to wait for completion
*/
public static int execute( Vector envVars, Vector cmd, File baseDir, int timeToWait) {
public static int execute(Vector<String> envVars, Vector<String> cmd, File baseDir, int timeToWait) {
try {
// We can collect the out or provide in if needed
ExecuteWatchdog watchdog=new ExecuteWatchdog( timeToWait );