Program: 110655
Project: 110655
Buggy source:
/** 
 * The crux of the build system. Builds the targets specified in the request using the specified Executor. <p>Performs loading, analysis and execution for the specified set of targets, honoring the configuration options in the BuildRequest. Returns normally iff successful, throws an exception otherwise. <p>The caller is responsible for setting up and syncing the package cache. <p>During this function's execution, the actualTargets and successfulTargets fields of the request object are set.
 * @param request the build request that this build tool is servicing, which specifies variousoptions; during this method's execution, the actualTargets and successfulTargets fields of the request object are populated
 * @param validator target validator
 * @return the result as a {@link BuildResult} object
 */
public BuildResult processRequest(BuildRequest request,TargetValidator validator){
  BuildResult result=new BuildResult(request.getStartTime());
  env.getEventBus().register(result);
  maybeSetStopOnFirstFailure(request,result);
  Throwable catastrophe=null;
  ExitCode exitCode=ExitCode.BLAZE_INTERNAL_ERROR;
  try {
    buildTargets(request,result,validator);
    exitCode=ExitCode.SUCCESS;
  }
 catch (  BuildFailedException e) {
    if (e.isErrorAlreadyShown()) {
    }
 else {
      reportExceptionError(e);
    }
    if (e.isCatastrophic()) {
      result.setCatastrophe();
    }
    exitCode=e.getExitCode() != null ? e.getExitCode() : ExitCode.BUILD_FAILURE;
  }
catch (  InterruptedException e) {
    exitCode=env.getPendingExitCode();
    if (exitCode == null) {
      exitCode=ExitCode.INTERRUPTED;
      env.getReporter().handle(Event.error("String_Node_Str"));
      env.getEventBus().post(new BuildInterruptedEvent());
    }
 else {
      reportExceptionError(env.getPendingException());
      result.setCatastrophe();
    }
  }
catch (  TargetParsingException|LoadingFailedException|ViewCreationFailedException e) {
    exitCode=ExitCode.PARSING_FAILURE;
    reportExceptionError(e);
  }
catch (  TestExecException e) {
    exitCode=ExitCode.SUCCESS;
    reportExceptionError(e);
  }
catch (  InvalidConfigurationException e) {
    exitCode=ExitCode.COMMAND_LINE_ERROR;
    reportExceptionError(e);
    result.setCatastrophe();
  }
catch (  AbruptExitException e) {
    exitCode=e.getExitCode();
    reportExceptionError(e);
    result.setCatastrophe();
  }
catch (  Throwable throwable) {
    catastrophe=throwable;
    Throwables.propagate(throwable);
  }
 finally {
    stopRequest(result,catastrophe,exitCode);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * The crux of the build system. Builds the targets specified in the request using the specified Executor. <p>Performs loading, analysis and execution for the specified set of targets, honoring the configuration options in the BuildRequest. Returns normally iff successful, throws an exception otherwise. <p>The caller is responsible for setting up and syncing the package cache. <p>During this function's execution, the actualTargets and successfulTargets fields of the request object are set.
 * @param request the build request that this build tool is servicing, which specifies variousoptions; during this method's execution, the actualTargets and successfulTargets fields of the request object are populated
 * @param validator target validator
 * @return the result as a {@link BuildResult} object
 */
public BuildResult processRequest(BuildRequest request,TargetValidator validator){
  BuildResult result=new BuildResult(request.getStartTime());
  env.getEventBus().register(result);
  maybeSetStopOnFirstFailure(request,result);
  Throwable catastrophe=null;
  ExitCode exitCode=ExitCode.BLAZE_INTERNAL_ERROR;
  try {
    buildTargets(request,result,validator);
    exitCode=ExitCode.SUCCESS;
  }
 catch (  BuildFailedException e) {
    if (e.isErrorAlreadyShown()) {
    }
 else {
      reportExceptionError(e);
    }
    if (e.isCatastrophic()) {
      result.setCatastrophe();
    }
    exitCode=e.getExitCode() != null ? e.getExitCode() : ExitCode.BUILD_FAILURE;
  }
catch (  InterruptedException e) {
    exitCode=env.getPendingExitCode();
    if (exitCode == null) {
      exitCode=ExitCode.INTERRUPTED;
      env.getReporter().handle(Event.error("String_Node_Str"));
      env.getEventBus().post(new BuildInterruptedEvent());
    }
 else {
      reportExceptionError(env.getPendingException());
      result.setCatastrophe();
    }
  }
catch (  TargetParsingException|LoadingFailedException|ViewCreationFailedException e) {
    exitCode=ExitCode.PARSING_FAILURE;
    reportExceptionError(e);
  }
catch (  ConfiguredTargetQueryCommandLineException e) {
    exitCode=ExitCode.COMMAND_LINE_ERROR;
    reportExceptionError(e);
  }
catch (  TestExecException e) {
    exitCode=ExitCode.SUCCESS;
    reportExceptionError(e);
  }
catch (  InvalidConfigurationException e) {
    exitCode=ExitCode.COMMAND_LINE_ERROR;
    reportExceptionError(e);
    result.setCatastrophe();
  }
catch (  AbruptExitException e) {
    exitCode=e.getExitCode();
    reportExceptionError(e);
    result.setCatastrophe();
  }
catch (  Throwable throwable) {
    catastrophe=throwable;
    Throwables.propagate(throwable);
  }
 finally {
    stopRequest(result,catastrophe,exitCode);
  }
  return result;
}