Program: 110654
Project: 110654
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>Callers must ensure that   {@link #stopRequest} is called after this method, even if itthrows. <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 result the build result that is the mutable result of this build
 * @param validator target validator
 */
public void buildTargets(BuildRequest request,BuildResult result,TargetValidator validator) throws BuildFailedException, InterruptedException, ViewCreationFailedException, TargetParsingException, LoadingFailedException, AbruptExitException, InvalidConfigurationException, TestExecException {
  validateOptions(request);
  BuildOptions buildOptions=runtime.createBuildOptions(request);
  env.setupPackageCache(request,DefaultsPackage.getDefaultsPackageContent(buildOptions));
  ExecutionTool executionTool=null;
  boolean catastrophe=false;
  try {
    env.getEventBus().post(new BuildStartingEvent(env,request));
    logger.info("String_Node_Str" + request.getId());
    if (!request.getMultiCpus().isEmpty()) {
      getReporter().handle(Event.warn("String_Node_Str" + "String_Node_Str" + "String_Node_Str"));
      if (!"String_Node_Str".equals(request.getCommandName()) && !"String_Node_Str".equals(request.getCommandName())) {
        throw new InvalidConfigurationException("String_Node_Str" + "String_Node_Str");
      }
    }
    env.throwPendingException();
    LoadingResult loadingResult=evaluateTargetPatterns(request,validator);
    env.setWorkspaceName(loadingResult.getWorkspaceName());
    executionTool=new ExecutionTool(env,request);
    if (needsExecutionPhase(request.getBuildOptions())) {
      executionTool.init();
    }
    if (request.needsInstrumentationFilter()) {
      String instrumentationFilter=InstrumentationFilterSupport.computeInstrumentationFilter(env.getReporter(),loadingResult.getTestsToRun());
      try {
        buildOptions.get(BuildConfiguration.Options.class).instrumentationFilter=new RegexFilter.RegexFilterConverter().convert(instrumentationFilter);
      }
 catch (      OptionsParsingException e) {
        throw new InvalidConfigurationException(e);
      }
    }
    env.throwPendingException();
    BuildConfigurationCollection configurations=env.getSkyframeExecutor().createConfigurations(env.getReporter(),runtime.getConfigurationFragmentFactories(),buildOptions,request.getMultiCpus(),request.getViewOptions().keepGoing);
    env.throwPendingException();
    if (configurations.getTargetConfigurations().size() == 1) {
      env.getEventBus().post(new MakeEnvironmentEvent(configurations.getTargetConfigurations().get(0).getMakeEnvironment()));
    }
    logger.info("String_Node_Str");
    if (request.getBuildOptions().performAnalysisPhase) {
      AnalysisResult analysisResult=runAnalysisPhase(request,loadingResult,configurations);
      result.setBuildConfigurationCollection(configurations);
      result.setActualTargets(analysisResult.getTargetsToBuild());
      result.setTestTargets(analysisResult.getTargetsToTest());
      reportTargets(analysisResult);
      for (      ConfiguredTarget target : analysisResult.getTargetsToSkip()) {
        BuildConfiguration config=target.getConfiguration();
        Label label=target.getLabel();
        env.getEventBus().post(new AbortedEvent(BuildEventId.targetCompleted(label,config.getEventId()),AbortReason.SKIPPED,String.format("String_Node_Str",label),label));
      }
      if (request.getBuildOptions().queryExpression != null) {
        try {
          doConfiguredTargetQuery(request,configurations,loadingResult);
        }
 catch (        QueryException|IOException e) {
          if (!request.getViewOptions().keepGoing) {
            throw new ViewCreationFailedException("String_Node_Str",e);
          }
          env.getReporter().error(null,"String_Node_Str",e);
        }
      }
      if (needsExecutionPhase(request.getBuildOptions())) {
        executionTool.executeBuild(request.getId(),analysisResult,result,configurations,analysisResult.getPackageRoots(),request.getTopLevelArtifactContext());
      }
 else {
        getReporter().post(new NoExecutionEvent());
      }
      String delayedErrorMsg=analysisResult.getError();
      if (delayedErrorMsg != null) {
        throw new BuildFailedException(delayedErrorMsg);
      }
    }
 else {
      getReporter().handle(Event.progress("String_Node_Str"));
      getReporter().post(new NoAnalyzeEvent());
      logger.info("String_Node_Str");
      String errorMessage=BuildView.createErrorMessage(loadingResult,null);
      if (errorMessage != null) {
        throw new BuildFailedException(errorMessage);
      }
    }
  }
 catch (  RuntimeException e) {
    request.getOutErr().printErrLn("String_Node_Str" + e.getMessage());
    catastrophe=true;
    throw e;
  }
catch (  Error e) {
    catastrophe=true;
    throw e;
  }
catch (  InvalidConfigurationException e) {
    catastrophe=true;
    throw e;
  }
 finally {
    if (executionTool != null) {
      executionTool.shutdown();
    }
    if (!catastrophe) {
      long versionWindow=request.getViewOptions().versionWindowForDirtyNodeGc;
      if (versionWindow != -1) {
        env.getSkyframeExecutor().deleteOldNodes(versionWindow);
      }
      env.getEventBus().post(new BuildInfoEvent(env.getBlazeWorkspace().getWorkspaceStatusActionFactory().createDummyWorkspaceStatus()));
    }
  }
}

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>Callers must ensure that   {@link #stopRequest} is called after this method, even if itthrows. <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 result the build result that is the mutable result of this build
 * @param validator target validator
 */
public void buildTargets(BuildRequest request,BuildResult result,TargetValidator validator) throws BuildFailedException, InterruptedException, ViewCreationFailedException, TargetParsingException, LoadingFailedException, AbruptExitException, InvalidConfigurationException, TestExecException, ConfiguredTargetQueryCommandLineException {
  validateOptions(request);
  BuildOptions buildOptions=runtime.createBuildOptions(request);
  env.setupPackageCache(request,DefaultsPackage.getDefaultsPackageContent(buildOptions));
  ExecutionTool executionTool=null;
  boolean catastrophe=false;
  try {
    env.getEventBus().post(new BuildStartingEvent(env,request));
    logger.info("String_Node_Str" + request.getId());
    if (!request.getMultiCpus().isEmpty()) {
      getReporter().handle(Event.warn("String_Node_Str" + "String_Node_Str" + "String_Node_Str"));
      if (!"String_Node_Str".equals(request.getCommandName()) && !"String_Node_Str".equals(request.getCommandName())) {
        throw new InvalidConfigurationException("String_Node_Str" + "String_Node_Str");
      }
    }
    env.throwPendingException();
    LoadingResult loadingResult=evaluateTargetPatterns(request,validator);
    env.setWorkspaceName(loadingResult.getWorkspaceName());
    executionTool=new ExecutionTool(env,request);
    if (needsExecutionPhase(request.getBuildOptions())) {
      executionTool.init();
    }
    if (request.needsInstrumentationFilter()) {
      String instrumentationFilter=InstrumentationFilterSupport.computeInstrumentationFilter(env.getReporter(),loadingResult.getTestsToRun());
      try {
        buildOptions.get(BuildConfiguration.Options.class).instrumentationFilter=new RegexFilter.RegexFilterConverter().convert(instrumentationFilter);
      }
 catch (      OptionsParsingException e) {
        throw new InvalidConfigurationException(e);
      }
    }
    env.throwPendingException();
    BuildConfigurationCollection configurations=env.getSkyframeExecutor().createConfigurations(env.getReporter(),runtime.getConfigurationFragmentFactories(),buildOptions,request.getMultiCpus(),request.getViewOptions().keepGoing);
    env.throwPendingException();
    if (configurations.getTargetConfigurations().size() == 1) {
      env.getEventBus().post(new MakeEnvironmentEvent(configurations.getTargetConfigurations().get(0).getMakeEnvironment()));
    }
    logger.info("String_Node_Str");
    if (request.getBuildOptions().performAnalysisPhase) {
      AnalysisResult analysisResult=runAnalysisPhase(request,loadingResult,configurations);
      result.setBuildConfigurationCollection(configurations);
      result.setActualTargets(analysisResult.getTargetsToBuild());
      result.setTestTargets(analysisResult.getTargetsToTest());
      reportTargets(analysisResult);
      for (      ConfiguredTarget target : analysisResult.getTargetsToSkip()) {
        BuildConfiguration config=target.getConfiguration();
        Label label=target.getLabel();
        env.getEventBus().post(new AbortedEvent(BuildEventId.targetCompleted(label,config.getEventId()),AbortReason.SKIPPED,String.format("String_Node_Str",label),label));
      }
      if (request.getBuildOptions().queryExpression != null) {
        if (!env.getSkyframeExecutor().hasIncrementalState()) {
          throw new ConfiguredTargetQueryCommandLineException("String_Node_Str");
        }
        try {
          doConfiguredTargetQuery(request,configurations,loadingResult);
        }
 catch (        QueryException|IOException e) {
          if (!request.getViewOptions().keepGoing) {
            throw new ViewCreationFailedException("String_Node_Str",e);
          }
          env.getReporter().error(null,"String_Node_Str",e);
        }
      }
      if (needsExecutionPhase(request.getBuildOptions())) {
        executionTool.executeBuild(request.getId(),analysisResult,result,configurations,analysisResult.getPackageRoots(),request.getTopLevelArtifactContext());
      }
 else {
        getReporter().post(new NoExecutionEvent());
      }
      String delayedErrorMsg=analysisResult.getError();
      if (delayedErrorMsg != null) {
        throw new BuildFailedException(delayedErrorMsg);
      }
    }
 else {
      getReporter().handle(Event.progress("String_Node_Str"));
      getReporter().post(new NoAnalyzeEvent());
      logger.info("String_Node_Str");
      String errorMessage=BuildView.createErrorMessage(loadingResult,null);
      if (errorMessage != null) {
        throw new BuildFailedException(errorMessage);
      }
    }
  }
 catch (  RuntimeException e) {
    request.getOutErr().printErrLn("String_Node_Str" + e.getMessage());
    catastrophe=true;
    throw e;
  }
catch (  Error e) {
    catastrophe=true;
    throw e;
  }
catch (  InvalidConfigurationException e) {
    catastrophe=true;
    throw e;
  }
 finally {
    if (executionTool != null) {
      executionTool.shutdown();
    }
    if (!catastrophe) {
      long versionWindow=request.getViewOptions().versionWindowForDirtyNodeGc;
      if (versionWindow != -1) {
        env.getSkyframeExecutor().deleteOldNodes(versionWindow);
      }
      env.getEventBus().post(new BuildInfoEvent(env.getBlazeWorkspace().getWorkspaceStatusActionFactory().createDummyWorkspaceStatus()));
    }
  }
}