Program: 9485
Project: 9485
Buggy source:
/** 
 * @throws AbortException if check for runtime fails 
 */
protected boolean doBuild(AjBuildConfig buildConfig,IMessageHandler baseHandler,boolean batch) throws IOException, AbortException {
  batchCompile=batch;
  try {
    if (batch) {
      this.state=new AjState(this);
    }
    boolean canIncremental=state.prepareForNextBuild(buildConfig);
    if (!canIncremental && !batch) {
      return doBuild(buildConfig,baseHandler,true);
    }
    this.handler=CountingMessageHandler.makeCountingMessageHandler(baseHandler);
    String check=checkRtJar(buildConfig);
    if (check != null) {
      if (FAIL_IF_RUNTIME_NOT_FOUND) {
        MessageUtil.error(handler,check);
        return false;
      }
 else {
        MessageUtil.warn(handler,check);
      }
    }
    setBuildConfig(buildConfig);
    setupModel();
    if (batch) {
      initBcelWorld(handler);
    }
    if (handler.hasErrors()) {
      return false;
    }
    if (buildConfig.getOutputJar() != null) {
      OutputStream os=FileUtil.makeOutputStream(buildConfig.getOutputJar());
      zos=new ZipOutputStream(os);
    }
    if (batch) {
      if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) {
        bcelWorld.setModel(AsmManager.getDefault().getHierarchy());
      }
      performCompilation(buildConfig.getFiles());
      if (handler.hasErrors()) {
        return false;
      }
    }
 else {
      List files=state.getFilesToCompile(true);
      for (int i=0; (i < 5) && !files.isEmpty(); i++) {
        performCompilation(files);
        if (handler.hasErrors()) {
          return false;
        }
        files=state.getFilesToCompile(false);
      }
      if (!files.isEmpty()) {
        return batchBuild(buildConfig,baseHandler);
      }
    }
    if (buildConfig.isEmacsSymMode()) {
      new org.aspectj.ajdt.internal.core.builder.EmacsStructureModelManager().externalizeModel();
    }
    state.successfulCompile(buildConfig);
    copyResourcesToDestination();
    if (buildConfig.isGenerateModelMode()) {
      AsmManager.getDefault().fireModelUpdated();
    }
    return !handler.hasErrors();
  }
  finally {
    if (zos != null) {
      zos.close();
    }
    handler=null;
  }
}

Fixed version (ground truth):
/** 
 * @throws AbortException if check for runtime fails 
 */
protected boolean doBuild(AjBuildConfig buildConfig,IMessageHandler baseHandler,boolean batch) throws IOException, AbortException {
  boolean ret=true;
  batchCompile=batch;
  try {
    if (batch) {
      this.state=new AjState(this);
    }
    boolean canIncremental=state.prepareForNextBuild(buildConfig);
    if (!canIncremental && !batch) {
      return doBuild(buildConfig,baseHandler,true);
    }
    this.handler=CountingMessageHandler.makeCountingMessageHandler(baseHandler);
    String check=checkRtJar(buildConfig);
    if (check != null) {
      if (FAIL_IF_RUNTIME_NOT_FOUND) {
        MessageUtil.error(handler,check);
        return false;
      }
 else {
        MessageUtil.warn(handler,check);
      }
    }
    setBuildConfig(buildConfig);
    setupModel();
    if (batch) {
      initBcelWorld(handler);
    }
    if (handler.hasErrors()) {
      return false;
    }
    if (buildConfig.getOutputJar() != null) {
      if (!openOutputStream(buildConfig.getOutputJar()))       return false;
    }
    if (batch) {
      if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) {
        bcelWorld.setModel(AsmManager.getDefault().getHierarchy());
      }
      performCompilation(buildConfig.getFiles());
      if (handler.hasErrors()) {
        return false;
      }
    }
 else {
      List files=state.getFilesToCompile(true);
      for (int i=0; (i < 5) && !files.isEmpty(); i++) {
        performCompilation(files);
        if (handler.hasErrors()) {
          return false;
        }
        files=state.getFilesToCompile(false);
      }
      if (!files.isEmpty()) {
        return batchBuild(buildConfig,baseHandler);
      }
    }
    if (buildConfig.isEmacsSymMode()) {
      new org.aspectj.ajdt.internal.core.builder.EmacsStructureModelManager().externalizeModel();
    }
    state.successfulCompile(buildConfig);
    copyResourcesToDestination();
    if (buildConfig.isGenerateModelMode()) {
      AsmManager.getDefault().fireModelUpdated();
    }
  }
  finally {
    if (zos != null) {
      closeOutputStream();
    }
    ret=!handler.hasErrors();
    handler=null;
  }
  return ret;
}