Program: 9490
Project: 9490
Buggy source:
/** 
 * @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() || (progressListener != null && progressListener.isCancelledRequested())) {
          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;
}

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());
      }
      binarySourcesForTheNextCompile=state.getBinaryFilesToCompile();
      performCompilation(buildConfig.getFiles());
      if (handler.hasErrors()) {
        return false;
      }
    }
 else {
      List files=state.getFilesToCompile(true);
      binarySourcesForTheNextCompile=state.getBinaryFilesToCompile();
      boolean hereWeGoAgain=!(files.isEmpty() && binarySourcesForTheNextCompile.isEmpty());
      for (int i=0; (i < 5) && hereWeGoAgain; i++) {
        performCompilation(files);
        if (handler.hasErrors() || (progressListener != null && progressListener.isCancelledRequested())) {
          return false;
        }
        files=state.getFilesToCompile(false);
        binarySourcesForTheNextCompile=state.getBinaryFilesToCompile();
        hereWeGoAgain=!(files.isEmpty() && binarySourcesForTheNextCompile.isEmpty());
      }
      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;
}