Program: 9463
Project: 9463
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());
      }
      binarySourcesForTheNextCompile=state.getBinaryFilesToCompile(true);
      performCompilation(buildConfig.getFiles());
      if (handler.hasErrors()) {
        return false;
      }
    }
 else {
      binarySourcesForTheNextCompile=state.getBinaryFilesToCompile(true);
      List files=state.getFilesToCompile(true);
      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;
        }
        binarySourcesForTheNextCompile=state.getBinaryFilesToCompile(false);
        files=state.getFilesToCompile(false);
        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;
}

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(true);
      performCompilation(buildConfig.getFiles());
      if (handler.hasErrors()) {
        return false;
      }
    }
 else {
      binarySourcesForTheNextCompile=state.getBinaryFilesToCompile(true);
      List files=state.getFilesToCompile(true);
      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;
        }
        binarySourcesForTheNextCompile=state.getBinaryFilesToCompile(false);
        files=state.getFilesToCompile(false);
        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();
  }
  return ret;
}