|
|
@@ -566,6 +566,11 @@ public class AjcTestCase extends TestCase { |
|
|
|
* 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) { |
|
|
@@ -636,7 +641,6 @@ public class AjcTestCase extends TestCase { |
|
|
|
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) { |
|
|
@@ -649,6 +653,7 @@ public class AjcTestCase extends TestCase { |
|
|
|
} finally { |
|
|
|
Thread.currentThread().setContextClassLoader(contexClassLoader); |
|
|
|
stopCapture(baosErr,baosOut); |
|
|
|
lastRunResult = new RunResult(command.toString(),new String(baosOut.toByteArray()),new String(baosErr.toByteArray())); |
|
|
|
} |
|
|
|
return lastRunResult; |
|
|
|
} |