Program: 53166
Project: 53166
Buggy source:
/** 
 * If   {@code isKeepGoing} is false, then this returns a future that succeeds only if all of{@code rulesToBuild} build successfully. Otherwise, this returns a future that should alwayssucceed, even if individual rules fail to build. In that case, a failed build rule is indicated by a  {@code null} value in the corresponding position in the iteration order of{@code rulesToBuild}.
 * @param targetish The targets to build. All targets in this iterable must be unique.
 */
@SuppressWarnings("String_Node_Str") public LinkedHashMap<BuildRule,Optional<BuildResult>> executeBuild(Iterable<? extends HasBuildTarget> targetish,boolean isKeepGoing) throws IOException, StepFailedException, ExecutionException, InterruptedException {
  buildContext=ImmutableBuildContext.builder().setActionGraph(actionGraph).setStepRunner(stepRunner).setProjectFilesystem(executionContext.getProjectFilesystem()).setClock(clock).setArtifactCache(artifactCache).setJavaPackageFinder(javaPackageFinder).setEventBus(executionContext.getBuckEventBus()).setAndroidBootclasspathSupplier(BuildContext.createBootclasspathSupplier(executionContext.getAndroidPlatformTargetSupplier())).setBuildId(executionContext.getBuildId()).putAllEnvironment(executionContext.getEnvironment()).build();
  ImmutableSet<BuildTarget> targetsToBuild=FluentIterable.from(targetish).transform(HasBuildTarget.TO_TARGET).toSet();
  ImmutableList<BuildRule> rulesToBuild=ImmutableList.copyOf(FluentIterable.from(targetsToBuild).transform(new Function<HasBuildTarget,BuildRule>(){
    @Override public BuildRule apply(    HasBuildTarget hasBuildTarget){
      return Preconditions.checkNotNull(actionGraph.findBuildRuleByTarget(hasBuildTarget.getBuildTarget()));
    }
  }
).toSet());
  int numRules=getNumRulesToBuild(targetsToBuild,actionGraph);
  getExecutionContext().getBuckEventBus().post(BuildEvent.ruleCountCalculated(targetsToBuild,numRules));
  final BuildContext currentBuildContext=buildContext;
  List<ListenableFuture<BuildResult>> futures=FluentIterable.from(rulesToBuild).transform(new Function<BuildRule,ListenableFuture<BuildResult>>(){
    @Override public ListenableFuture<BuildResult> apply(    BuildRule rule){
      return buildEngine.build(currentBuildContext,rule);
    }
  }
).toList();
  ListenableFuture<List<BuildResult>> buildFuture;
  if (isKeepGoing) {
    buildFuture=Futures.successfulAsList(futures);
  }
 else {
    buildFuture=Futures.allAsList(futures);
  }
  List<BuildResult> results;
  try {
    results=buildFuture.get();
  }
 catch (  InterruptedException e) {
    try {
      buildFuture.cancel(true);
    }
 catch (    CancellationException ignored) {
    }
    Thread.currentThread().interrupt();
    throw e;
  }
  LinkedHashMap<BuildRule,Optional<BuildResult>> resultBuilder=new LinkedHashMap<>();
  Preconditions.checkState(rulesToBuild.size() == results.size());
  for (int i=0, len=rulesToBuild.size(); i < len; i++) {
    BuildRule rule=rulesToBuild.get(i);
    resultBuilder.put(rule,Optional.fromNullable(results.get(i)));
  }
  return resultBuilder;
}

Fixed version (ground truth):
/** 
 * If   {@code isKeepGoing} is false, then this returns a future that succeeds only if all of{@code rulesToBuild} build successfully. Otherwise, this returns a future that should alwayssucceed, even if individual rules fail to build. In that case, a failed build rule is indicated by a  {@code null} value in the corresponding position in the iteration order of{@code rulesToBuild}.
 * @param targetish The targets to build. All targets in this iterable must be unique.
 */
@SuppressWarnings("String_Node_Str") public LinkedHashMap<BuildRule,Optional<BuildResult>> executeBuild(Iterable<? extends HasBuildTarget> targetish,boolean isKeepGoing) throws IOException, StepFailedException, ExecutionException, InterruptedException {
  buildContext=ImmutableBuildContext.builder().setActionGraph(actionGraph).setStepRunner(stepRunner).setProjectFilesystem(executionContext.getProjectFilesystem()).setClock(clock).setArtifactCache(artifactCache).setJavaPackageFinder(javaPackageFinder).setEventBus(executionContext.getBuckEventBus()).setAndroidBootclasspathSupplier(BuildContext.createBootclasspathSupplier(executionContext.getAndroidPlatformTargetSupplier())).setBuildId(executionContext.getBuildId()).putAllEnvironment(executionContext.getEnvironment()).setKeepGoing(isKeepGoing).build();
  ImmutableSet<BuildTarget> targetsToBuild=FluentIterable.from(targetish).transform(HasBuildTarget.TO_TARGET).toSet();
  ImmutableList<BuildRule> rulesToBuild=ImmutableList.copyOf(FluentIterable.from(targetsToBuild).transform(new Function<HasBuildTarget,BuildRule>(){
    @Override public BuildRule apply(    HasBuildTarget hasBuildTarget){
      return Preconditions.checkNotNull(actionGraph.findBuildRuleByTarget(hasBuildTarget.getBuildTarget()));
    }
  }
).toSet());
  int numRules=getNumRulesToBuild(targetsToBuild,actionGraph);
  getExecutionContext().getBuckEventBus().post(BuildEvent.ruleCountCalculated(targetsToBuild,numRules));
  final BuildContext currentBuildContext=buildContext;
  List<ListenableFuture<BuildResult>> futures=FluentIterable.from(rulesToBuild).transform(new Function<BuildRule,ListenableFuture<BuildResult>>(){
    @Override public ListenableFuture<BuildResult> apply(    BuildRule rule){
      return buildEngine.build(currentBuildContext,rule);
    }
  }
).toList();
  ListenableFuture<List<BuildResult>> buildFuture=Futures.allAsList(futures);
  List<BuildResult> results;
  try {
    results=buildFuture.get();
    if (!isKeepGoing) {
      for (      BuildResult result : results) {
        Throwable thrown=result.getFailure();
        if (thrown != null) {
          throw new ExecutionException(thrown);
        }
      }
    }
  }
 catch (  InterruptedException e) {
    try {
      buildFuture.cancel(true);
    }
 catch (    CancellationException ignored) {
    }
    Thread.currentThread().interrupt();
    throw e;
  }
  LinkedHashMap<BuildRule,Optional<BuildResult>> resultBuilder=new LinkedHashMap<>();
  Preconditions.checkState(rulesToBuild.size() == results.size());
  for (int i=0, len=rulesToBuild.size(); i < len; i++) {
    BuildRule rule=rulesToBuild.get(i);
    resultBuilder.put(rule,Optional.fromNullable(results.get(i)));
  }
  return resultBuilder;
}