* the sandbox.
*/
public RunResult run(String className, String[] args, final String classpath, boolean useLTW) {
+ if (args != null) {
+ for (int i = 0; i < args.length; i++) {
+ args[i] = substituteSandbox(args[i]);
+ }
+ }
lastRunResult = null;
StringBuffer cp = new StringBuffer();
if (classpath != null) {
Class toRun = sandboxLoader.loadClass(className);
Method mainMethod = toRun.getMethod("main",new Class[] {String[].class});
mainMethod.invoke(null,new Object[] {args});
- lastRunResult = new RunResult(command.toString(),new String(baosOut.toByteArray()),new String(baosErr.toByteArray()));
} catch(ClassNotFoundException cnf) {
fail("Can't find class: " + className);
} catch(NoSuchMethodException nsm) {
} finally {
Thread.currentThread().setContextClassLoader(contexClassLoader);
stopCapture(baosErr,baosOut);
+ lastRunResult = new RunResult(command.toString(),new String(baosOut.toByteArray()),new String(baosErr.toByteArray()));
}
return lastRunResult;
}