Program: 9148
Project: 9148
Buggy source:
/** 
 * Run in another VM by grabbing Java, bootclasspath, classpath, etc. This assumes any exception or output to System.err is a failure, and any normal completion is a pass.
 * @param status
 * @param libs
 * @param dirs
 * @return
 */
protected boolean runInOtherVM(IRunStatus status,File[] libs,File[] dirs){
  ArrayList cmd=new ArrayList();
  cmd.add(FileUtil.getBestPath(spec.forkSpec.java));
  if (!LangUtil.isEmpty(spec.forkSpec.vmargs)) {
    cmd.addAll(Arrays.asList(spec.forkSpec.vmargs));
  }
  final String classpath;
{
    StringBuffer cp=new StringBuffer();
    appendClasspath(cp,spec.forkSpec.bootclasspath);
    appendClasspath(cp,dirs);
    appendClasspath(cp,libs);
    File[] classpathFiles=sandbox.findFiles(spec.classpath);
    int cpLength=(null == classpathFiles ? 0 : classpathFiles.length);
    int spLength=(null == spec.classpath ? 0 : spec.classpath.length);
    if (cpLength != spLength) {
      throw new Error("String_Node_Str" + Arrays.asList(spec.classpath) + "String_Node_Str"+ Arrays.asList(classpathFiles));
    }
    appendClasspath(cp,classpathFiles);
    File[] stdlibs={Globals.F_aspectjrt_jar,Globals.F_testingclient_jar};
    appendClasspath(cp,stdlibs);
    classpath=cp.toString();
  }
  if (!spec.isLTW()) {
    cmd.add("String_Node_Str");
    cmd.add(classpath);
  }
 else {
    if (!LangUtil.supportsJava("String_Node_Str")) {
      throw new Error("String_Node_Str");
    }
    cmd.add("String_Node_Str");
    cmd.add("String_Node_Str");
    cmd.add(System.getProperty("String_Node_Str"));
    File[] aspectJars=sandbox.findFiles(spec.aspectpath);
    if (aspectJars.length != spec.aspectpath.length) {
      throw new Error("String_Node_Str" + Arrays.asList(spec.aspectpath));
    }
    StringBuffer cp=new StringBuffer();
    appendClasspath(cp,aspectJars);
    cmd.add("String_Node_Str" + cp.toString());
    cp.append(classpath);
    cmd.add("String_Node_Str" + cp.toString());
  }
  cmd.add(spec.className);
  cmd.addAll(spec.options);
  String[] command=(String[])cmd.toArray(new String[0]);
  final IMessageHandler handler=status;
class DoneFlag {
    boolean done;
    boolean failed;
    int code;
  }
  final StringBuffer commandLabel=new StringBuffer();
  final DoneFlag doneFlag=new DoneFlag();
  LangUtil.ProcessController controller=new LangUtil.ProcessController(){
    protected void doCompleting(    Thrown ex,    int result){
      if (!ex.thrown && (0 == result)) {
        doneFlag.done=true;
        return;
      }
      String context=spec.className + "String_Node_Str" + commandLabel+ "String_Node_Str";
      if (null != ex.fromProcess) {
        if (!expectedException(ex.fromProcess)) {
          String m="String_Node_Str" + context;
          MessageUtil.abort(handler,m,ex.fromProcess);
          doneFlag.failed=true;
        }
      }
 else       if (0 != result) {
        doneFlag.code=result;
      }
      if (null != ex.fromInPipe) {
        String m="String_Node_Str" + context;
        MessageUtil.abort(handler,m,ex.fromInPipe);
        doneFlag.failed=true;
      }
      if (null != ex.fromOutPipe) {
        String m="String_Node_Str" + context;
        MessageUtil.abort(handler,m,ex.fromOutPipe);
        doneFlag.failed=true;
      }
      if (null != ex.fromErrPipe) {
        String m="String_Node_Str" + context;
        MessageUtil.abort(handler,m,ex.fromErrPipe);
        doneFlag.failed=true;
      }
      doneFlag.done=true;
    }
  }
;
  controller.init(command,spec.className);
  if (null != spec.forkSpec.javaHome) {
    controller.setEnvp(new String[]{"String_Node_Str" + spec.forkSpec.javaHome});
  }
  commandLabel.append(Arrays.asList(controller.getCommand()).toString());
  final ByteArrayOutputStream errSnoop=new ByteArrayOutputStream();
  final ByteArrayOutputStream outSnoop=new ByteArrayOutputStream();
  controller.setErrSnoop(errSnoop);
  controller.setOutSnoop(outSnoop);
  controller.start();
  long maxTime=System.currentTimeMillis() + 3 * 60 * 1000;
  boolean waitingForStop=false;
  while (!doneFlag.done) {
    if (maxTime < System.currentTimeMillis()) {
      if (waitingForStop) {
        break;
      }
      MessageUtil.fail(status,"String_Node_Str");
      doneFlag.failed=true;
      controller.stop();
      waitingForStop=true;
      maxTime=System.currentTimeMillis() + 1 * 60 * 1000;
    }
    try {
      Thread.sleep(300);
    }
 catch (    InterruptedException e) {
    }
  }
  boolean foundException=false;
  if (0 < errSnoop.size()) {
    if (expectedException(errSnoop)) {
      foundException=true;
    }
 else     if (spec.errStreamIsError) {
      MessageUtil.error(handler,errSnoop.toString());
      if (!doneFlag.failed) {
        doneFlag.failed=true;
      }
    }
 else {
      MessageUtil.info(handler,"String_Node_Str" + errSnoop.toString());
    }
  }
  if (0 < outSnoop.size()) {
    if (expectedException(outSnoop)) {
      foundException=true;
    }
 else     if (spec.outStreamIsError) {
      MessageUtil.error(handler,outSnoop.toString());
      if (!doneFlag.failed) {
        doneFlag.failed=true;
      }
    }
 else {
      MessageUtil.info(handler,"String_Node_Str" + outSnoop.toString());
    }
  }
  if (!foundException) {
    if (null != spec.expectedException) {
      String m="String_Node_Str" + spec.expectedException;
      MessageUtil.fail(handler,m);
      doneFlag.failed=true;
    }
 else     if (0 != doneFlag.code) {
      String m=doneFlag.code + "String_Node_Str" + commandLabel;
      MessageUtil.fail(handler,m);
      doneFlag.failed=true;
    }
  }
  if (doneFlag.failed) {
    MessageUtil.info(handler,"String_Node_Str" + commandLabel);
  }
  return !doneFlag.failed;
}

Fixed version (ground truth):
/** 
 * Run in another VM by grabbing Java, bootclasspath, classpath, etc. This assumes any exception or output to System.err is a failure, and any normal completion is a pass.
 * @param status
 * @param libs
 * @param dirs
 * @return
 */
protected boolean runInOtherVM(IRunStatus status,File[] libs,File[] dirs){
  ArrayList cmd=new ArrayList();
  cmd.add(FileUtil.getBestPath(spec.forkSpec.java));
  if (!LangUtil.isEmpty(spec.forkSpec.vmargs)) {
    cmd.addAll(Arrays.asList(spec.forkSpec.vmargs));
  }
  final String classpath;
{
    StringBuffer cp=new StringBuffer();
    appendClasspath(cp,spec.forkSpec.bootclasspath);
    appendClasspath(cp,dirs);
    appendClasspath(cp,libs);
    File[] classpathFiles=sandbox.findFiles(spec.classpath);
    int cpLength=(null == classpathFiles ? 0 : classpathFiles.length);
    int spLength=(null == spec.classpath ? 0 : spec.classpath.length);
    if (cpLength != spLength) {
      throw new Error("String_Node_Str" + Arrays.asList(spec.classpath) + "String_Node_Str"+ Arrays.asList(classpathFiles));
    }
    appendClasspath(cp,classpathFiles);
    File[] stdlibs={Globals.F_aspectjrt_jar,Globals.F_testingclient_jar};
    appendClasspath(cp,stdlibs);
    classpath=cp.toString();
  }
  if (!spec.isLTW()) {
    cmd.add("String_Node_Str");
    cmd.add(classpath);
  }
 else {
    if (!Globals.supportsJava("String_Node_Str")) {
      throw new Error("String_Node_Str");
    }
    cmd.add("String_Node_Str");
    cmd.add("String_Node_Str");
    cmd.add(System.getProperty("String_Node_Str"));
    File[] aspectJars=sandbox.findFiles(spec.aspectpath);
    if (aspectJars.length != spec.aspectpath.length) {
      throw new Error("String_Node_Str" + Arrays.asList(spec.aspectpath));
    }
    StringBuffer cp=new StringBuffer();
    appendClasspath(cp,aspectJars);
    cmd.add("String_Node_Str" + cp.toString());
    cp.append(classpath);
    cmd.add("String_Node_Str" + cp.toString());
  }
  cmd.add(spec.className);
  cmd.addAll(spec.options);
  String[] command=(String[])cmd.toArray(new String[0]);
  final IMessageHandler handler=status;
class DoneFlag {
    boolean done;
    boolean failed;
    int code;
  }
  final StringBuffer commandLabel=new StringBuffer();
  final DoneFlag doneFlag=new DoneFlag();
  LangUtil.ProcessController controller=new LangUtil.ProcessController(){
    protected void doCompleting(    Thrown ex,    int result){
      if (!ex.thrown && (0 == result)) {
        doneFlag.done=true;
        return;
      }
      String context=spec.className + "String_Node_Str" + commandLabel+ "String_Node_Str";
      if (null != ex.fromProcess) {
        if (!expectedException(ex.fromProcess)) {
          String m="String_Node_Str" + context;
          MessageUtil.abort(handler,m,ex.fromProcess);
          doneFlag.failed=true;
        }
      }
 else       if (0 != result) {
        doneFlag.code=result;
      }
      if (null != ex.fromInPipe) {
        String m="String_Node_Str" + context;
        MessageUtil.abort(handler,m,ex.fromInPipe);
        doneFlag.failed=true;
      }
      if (null != ex.fromOutPipe) {
        String m="String_Node_Str" + context;
        MessageUtil.abort(handler,m,ex.fromOutPipe);
        doneFlag.failed=true;
      }
      if (null != ex.fromErrPipe) {
        String m="String_Node_Str" + context;
        MessageUtil.abort(handler,m,ex.fromErrPipe);
        doneFlag.failed=true;
      }
      doneFlag.done=true;
    }
  }
;
  controller.init(command,spec.className);
  if (null != spec.forkSpec.javaHome) {
    controller.setEnvp(new String[]{"String_Node_Str" + spec.forkSpec.javaHome});
  }
  commandLabel.append(Arrays.asList(controller.getCommand()).toString());
  final ByteArrayOutputStream errSnoop=new ByteArrayOutputStream();
  final ByteArrayOutputStream outSnoop=new ByteArrayOutputStream();
  controller.setErrSnoop(errSnoop);
  controller.setOutSnoop(outSnoop);
  controller.start();
  long maxTime=System.currentTimeMillis() + 3 * 60 * 1000;
  boolean waitingForStop=false;
  while (!doneFlag.done) {
    if (maxTime < System.currentTimeMillis()) {
      if (waitingForStop) {
        break;
      }
      MessageUtil.fail(status,"String_Node_Str");
      doneFlag.failed=true;
      controller.stop();
      waitingForStop=true;
      maxTime=System.currentTimeMillis() + 1 * 60 * 1000;
    }
    try {
      Thread.sleep(300);
    }
 catch (    InterruptedException e) {
    }
  }
  boolean foundException=false;
  if (0 < errSnoop.size()) {
    if (expectedException(errSnoop)) {
      foundException=true;
    }
 else     if (spec.errStreamIsError) {
      MessageUtil.error(handler,errSnoop.toString());
      if (!doneFlag.failed) {
        doneFlag.failed=true;
      }
    }
 else {
      MessageUtil.info(handler,"String_Node_Str" + errSnoop.toString());
    }
  }
  if (0 < outSnoop.size()) {
    if (expectedException(outSnoop)) {
      foundException=true;
    }
 else     if (spec.outStreamIsError) {
      MessageUtil.error(handler,outSnoop.toString());
      if (!doneFlag.failed) {
        doneFlag.failed=true;
      }
    }
 else {
      MessageUtil.info(handler,"String_Node_Str" + outSnoop.toString());
    }
  }
  if (!foundException) {
    if (null != spec.expectedException) {
      String m="String_Node_Str" + spec.expectedException;
      MessageUtil.fail(handler,m);
      doneFlag.failed=true;
    }
 else     if (0 != doneFlag.code) {
      String m=doneFlag.code + "String_Node_Str" + commandLabel;
      MessageUtil.fail(handler,m);
      doneFlag.failed=true;
    }
  }
  if (doneFlag.failed) {
    MessageUtil.info(handler,"String_Node_Str" + commandLabel);
  }
  return !doneFlag.failed;
}