nus-yam/ex-repair huggingface dataset:
Program: 52848
Project: 52848
Buggy source:
private ImmutableMap<BuildTarget,Version> selectVersions(BuildTarget root,ImmutableMap<BuildTarget,ImmutableSet<Version>> domain) throws VersionException {
  TargetNode<?,?> node=targetGraph.get(root);
  ImmutableMap.Builder<BuildTarget,Version> selectedVersions=ImmutableMap.builder();
  Optional<Map.Entry<String,VersionUniverse>> universe=getVersionUniverse(node);
  LOG.verbose("String_Node_Str",root,universe);
  for (  Map.Entry<BuildTarget,ImmutableSet<Version>> ent : domain.entrySet()) {
    Version version;
    if (universe.isPresent() && ((version=universe.get().getValue().getVersions().get(ent.getKey())) != null)) {
      if (!ent.getValue().contains(version)) {
        throw new VersionException(root,String.format("String_Node_Str",version,ent.getKey(),universe.get().getKey(),Joiner.on("String_Node_Str").join(ent.getValue())));
      }
    }
 else {
      version=Iterables.get(ent.getValue(),0);
    }
    selectedVersions.put(ent.getKey(),version);
  }
  return selectedVersions.build();
}

Fixed version (ground truth):
private ImmutableMap<BuildTarget,Version> selectVersions(BuildTarget root,ImmutableMap<BuildTarget,ImmutableSet<Version>> domain) throws VersionException {
  TargetNode<?,?> node=targetGraph.get(root);
  ImmutableMap.Builder<BuildTarget,Version> selectedVersions=ImmutableMap.builder();
  Optional<Map.Entry<String,VersionUniverse>> universe=getVersionUniverse(node);
  LOG.verbose("String_Node_Str",root,universe);
  for (  Map.Entry<BuildTarget,ImmutableSet<Version>> ent : domain.entrySet()) {
    Version version;
    if (universe.isPresent() && ((version=universe.get().getValue().getVersions().get(ent.getKey())) != null)) {
      if (!ent.getValue().contains(version)) {
        throw new VersionException(root,String.format("String_Node_Str",ent.getKey(),version,universe.get().getKey(),Joiner.on("String_Node_Str").join(ent.getValue())));
      }
    }
 else {
      version=Iterables.get(ent.getValue(),0);
    }
    selectedVersions.put(ent.getKey(),version);
  }
  return selectedVersions.build();
}
Program: 52850
Project: 52850
Buggy source:
public BuildRule buildAbi(){
  getLibraryRule();
  BuildRule result=getCompareAbisRule();
  if (result == null) {
    result=getClassAbiRule();
  }
  if (result == null) {
    result=getSourceAbiRule();
  }
  return Preconditions.checkNotNull(result);
}

Fixed version (ground truth):
public BuildRule buildAbi(){
  getLibraryRule();
  BuildTarget requestedTarget=getInitialBuildTarget();
  if (HasJavaAbi.isSourceAbiTarget(requestedTarget)) {
    return getSourceAbiRule();
  }
 else   if (HasJavaAbi.isClassAbiTarget(requestedTarget)) {
    return getClassAbiRule();
  }
 else   if (HasJavaAbi.isVerifiedSourceAbiTarget(requestedTarget)) {
    return getCompareAbisRule();
  }
  throw new AssertionError();
}
Program: 52851
Project: 52851
Buggy source:
private void buildAllDirectoriesAndSymlinks(){
  Set<Path> deletedDirectories=new HashSet<>();
  Set<Path> absoluteDirectoriesToMake=directoriesToMake.stream().map(Path::toAbsolutePath).collect(Collectors.toSet());
  for (  Path path : existingDirectories) {
    if (!absoluteDirectoriesToMake.contains(path)) {
      if (dryRun) {
        stderr("String_Node_Str",path);
      }
 else {
        deleteAll(path);
        deletedDirectories.add(path);
      }
    }
  }
  existingSymlinks.forEach((filePath,linkPath) -> {
    if (linkPath.equals(symlinksToCreate.get(filePath))) {
      symlinksToCreate.remove(filePath);
    }
 else {
      if (dryRun) {
        stderr("String_Node_Str",linkPath);
      }
 else {
        try {
          Files.delete(linkPath);
        }
 catch (        IOException e) {
          if (!linkInDeletedDirectories(deletedDirectories,linkPath)) {
            stderr("String_Node_Str",e.getClass().getSimpleName(),linkPath);
          }
        }
      }
    }
  }
);
  symlinksToCreate.forEach((filePath,linkPath) -> {
    if (dryRun) {
      stderr("String_Node_Str",filePath,linkPath);
    }
 else {
      createSymbolicLink(filePath,linkPath);
    }
  }
);
}

Fixed version (ground truth):
private void buildAllDirectoriesAndSymlinks(){
  Set<Path> deletedDirectories=new HashSet<>();
  Set<Path> absoluteDirectoriesToMake=directoriesToMake.stream().map(Path::toAbsolutePath).collect(Collectors.toSet());
  for (  Path path : existingDirectories) {
    if (!absoluteDirectoriesToMake.contains(path)) {
      if (dryRun) {
        stderr("String_Node_Str",path);
      }
 else {
        deleteAll(path);
        deletedDirectories.add(path);
      }
    }
  }
  existingSymlinks.forEach((filePath,linkPath) -> {
    if (linkPath.equals(symlinksToCreate.get(filePath))) {
      symlinksToCreate.remove(filePath);
    }
 else {
      if (dryRun) {
        stderr("String_Node_Str",linkPath);
      }
 else {
        try {
          Files.delete(linkPath);
        }
 catch (        IOException e) {
          if (!linkInDeletedDirectories(deletedDirectories,linkPath.toAbsolutePath())) {
            stderr("String_Node_Str",e.getClass().getSimpleName(),linkPath);
          }
        }
      }
    }
  }
);
  symlinksToCreate.forEach((filePath,linkPath) -> {
    if (dryRun) {
      stderr("String_Node_Str",filePath,linkPath);
    }
 else {
      createSymbolicLink(filePath,linkPath);
    }
  }
);
}
Program: 52852
Project: 52852
Buggy source:
private Optional<String> unableToFindTargetBuildTools(Path sdkPath){
  return Optional.of("String_Node_Str" + targetBuildToolsVersion.get() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ Escaper.escapeAsShellString(sdkPath.resolve("String_Node_Str").toString())+ "String_Node_Str"+ "String_Node_Str"+ targetBuildToolsVersion.get()+ "String_Node_Str");
}

Fixed version (ground truth):
private Optional<String> unableToFindTargetBuildTools(Path sdkPath){
  return Optional.of("String_Node_Str" + targetBuildToolsVersion.get() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ Escaper.escapeAsShellString(sdkPath.resolve("String_Node_Str").toString())+ "String_Node_Str"+ targetBuildToolsVersion.get()+ "String_Node_Str");
}
Program: 52853
Project: 52853
Buggy source:
@Nullable private String getOwningTarget(Elements elements,Element element,ImmutableList<HasJavaAbi> classpath){
  TypeElement enclosingType=MoreElements.getTypeElement(element);
  String classFilePath=elements.getBinaryName(enclosingType).toString().replace('.','/') + "String_Node_Str";
  for (  HasJavaAbi classpathRule : classpath) {
    if (classpathRule.jarContains(classFilePath)) {
      return classpathRule.getBuildTarget().getUnflavoredBuildTarget().toString();
    }
  }
  return null;
}

Fixed version (ground truth):
@Nullable private String getOwningTarget(Elements elements,Element element,ImmutableList<HasJavaAbi> classpath){
  TypeElement enclosingType=MoreElements.getTypeElement(element);
  String classFilePath=elements.getBinaryName(enclosingType).toString().replace('.',File.separatorChar) + "String_Node_Str";
  for (  HasJavaAbi classpathRule : classpath) {
    if (classpathRule.jarContains(classFilePath)) {
      return classpathRule.getBuildTarget().getUnflavoredBuildTarget().toString();
    }
  }
  return null;
}
Program: 52854
Project: 52854
Buggy source:
private GetWorkResponse getWorkUnsafe(GetWorkRequest request){
  LOG.info(String.format("String_Node_Str",request.getMinionId(),request.getFinishedTargets().size(),request.getMaxWorkUnitsToFetch()));
  checkBuildId(request.getStampedeId());
  Preconditions.checkArgument(request.isSetMinionId());
  Preconditions.checkArgument(request.isSetLastExitCode());
  GetWorkResponse response=new GetWorkResponse();
  response.setContinueBuilding(true);
  response.setWorkUnits(new ArrayList<>());
synchronized (lock) {
    Preconditions.checkArgument(!exitCodeFuture.isDone());
    if (request.getLastExitCode() != 0) {
      LOG.error(String.format("String_Node_Str",request.getMinionId(),request.getLastExitCode()));
      exitCodeFuture.complete(request.getLastExitCode());
      response.setContinueBuilding(false);
      return response;
    }
    List<WorkUnit> newWorkUnitsForMinion=allocator.dequeueZeroDependencyNodes(request.getMinionId(),request.getFinishedTargets(),request.getMaxWorkUnitsToFetch());
    if (allocator.isBuildFinished()) {
      exitCodeFuture.complete(0);
      LOG.info(String.format("String_Node_Str",request.minionId));
      response.setContinueBuilding(false);
    }
 else {
      response.setWorkUnits(newWorkUnitsForMinion);
    }
    return response;
  }
}

Fixed version (ground truth):
private GetWorkResponse getWorkUnsafe(GetWorkRequest request){
  LOG.info(String.format("String_Node_Str",request.getMinionId(),request.getFinishedTargets().size(),request.getMaxWorkUnitsToFetch()));
  checkBuildId(request.getStampedeId());
  Preconditions.checkArgument(request.isSetMinionId());
  Preconditions.checkArgument(request.isSetLastExitCode());
  GetWorkResponse response=new GetWorkResponse();
  response.setContinueBuilding(true);
  response.setWorkUnits(new ArrayList<>());
synchronized (lock) {
    if (exitCodeFuture.isDone()) {
      response.setContinueBuilding(false);
      return response;
    }
    if (request.getLastExitCode() != 0) {
      LOG.error(String.format("String_Node_Str",request.getMinionId(),request.getLastExitCode()));
      exitCodeFuture.complete(request.getLastExitCode());
      response.setContinueBuilding(false);
      return response;
    }
    List<WorkUnit> newWorkUnitsForMinion=allocator.dequeueZeroDependencyNodes(request.getMinionId(),request.getFinishedTargets(),request.getMaxWorkUnitsToFetch());
    if (allocator.isBuildFinished()) {
      exitCodeFuture.complete(0);
      LOG.info(String.format("String_Node_Str",request.minionId));
      response.setContinueBuilding(false);
    }
 else {
      response.setWorkUnits(newWorkUnitsForMinion);
    }
    return response;
  }
}
Program: 52856
Project: 52856
Buggy source:
private void buildAllDirectoriesAndSymlinks(){
  Set<Path> deletedDirectories=new HashSet<>();
  for (  Path path : existingDirectories) {
    if (!directoriesToMake.contains(path)) {
      if (dryRun) {
        stderr("String_Node_Str",path);
      }
 else {
        deleteAll(path);
        deletedDirectories.add(path);
      }
    }
  }
  existingSymlinks.forEach((filePath,linkPath) -> {
    if (linkPath.equals(symlinksToCreate.get(filePath))) {
      symlinksToCreate.remove(filePath);
    }
 else {
      if (dryRun) {
        stderr("String_Node_Str",linkPath);
      }
 else {
        try {
          Files.delete(linkPath);
        }
 catch (        IOException e) {
          if (!linkInDeletedDirectories(deletedDirectories,linkPath)) {
            stderr("String_Node_Str",e.getMessage(),linkPath);
          }
        }
      }
    }
  }
);
  symlinksToCreate.forEach((filePath,linkPath) -> {
    if (dryRun) {
      stderr("String_Node_Str",filePath,linkPath);
    }
 else {
      createSymbolicLink(filePath,linkPath);
    }
  }
);
}

Fixed version (ground truth):
private void buildAllDirectoriesAndSymlinks(){
  Set<Path> deletedDirectories=new HashSet<>();
  Set<Path> absoluteDirectoriesToMake=directoriesToMake.stream().map(Path::toAbsolutePath).collect(Collectors.toSet());
  for (  Path path : existingDirectories) {
    if (!absoluteDirectoriesToMake.contains(path)) {
      if (dryRun) {
        stderr("String_Node_Str",path);
      }
 else {
        deleteAll(path);
        deletedDirectories.add(path);
      }
    }
  }
  existingSymlinks.forEach((filePath,linkPath) -> {
    if (linkPath.equals(symlinksToCreate.get(filePath))) {
      symlinksToCreate.remove(filePath);
    }
 else {
      if (dryRun) {
        stderr("String_Node_Str",linkPath);
      }
 else {
        try {
          Files.delete(linkPath);
        }
 catch (        IOException e) {
          if (!linkInDeletedDirectories(deletedDirectories,linkPath)) {
            stderr("String_Node_Str",e.getClass().getSimpleName(),linkPath);
          }
        }
      }
    }
  }
);
  symlinksToCreate.forEach((filePath,linkPath) -> {
    if (dryRun) {
      stderr("String_Node_Str",filePath,linkPath);
    }
 else {
      createSymbolicLink(filePath,linkPath);
    }
  }
);
}
Program: 52857
Project: 52857
Buggy source:
private void createWorkUnitsStartingAtNodes(Set<EnqueuedTarget> nodes,List<WorkUnit> newUnitsOfWork,int maxUnitsOfWork){
  for (  EnqueuedTarget node : nodes) {
    if (newUnitsOfWork.size() == maxUnitsOfWork) {
      return;
    }
    if (node.partOfBuildingUnitOfWork) {
      continue;
    }
    LOG.debug(String.format("String_Node_Str",node.getBuildTarget()));
    newUnitsOfWork.add(getUnitOfWorkStartingAtLeafNode(node));
  }
}

Fixed version (ground truth):
private void createWorkUnitsStartingAtNodes(Set<EnqueuedTarget> nodes,List<WorkUnit> newUnitsOfWork,int maxUnitsOfWork){
  for (  EnqueuedTarget node : nodes) {
    if (newUnitsOfWork.size() >= maxUnitsOfWork) {
      return;
    }
    if (node.partOfBuildingUnitOfWork) {
      continue;
    }
    LOG.debug(String.format("String_Node_Str",node.getBuildTarget()));
    newUnitsOfWork.add(getUnitOfWorkStartingAtLeafNode(node));
  }
}
Program: 52858
Project: 52858
Buggy source:
/** 
 * Returns nodes that have all their dependencies satisfied. 
 */
public List<WorkUnit> dequeueZeroDependencyNodes(List<String> finishedNodes,int maxUnitsOfWork){
  LOG.info(String.format("String_Node_Str",finishedNodes.size(),maxUnitsOfWork));
  processFinishedNodes(finishedNodes);
  if (maxUnitsOfWork == 0) {
    return Lists.newArrayList();
  }
  List<WorkUnit> newUnitsOfWork=new ArrayList<>();
  createWorkUnitsStartingAtNodes(new HashSet<>(zeroDependencyTargets),newUnitsOfWork,maxUnitsOfWork);
  if (newUnitsOfWork.size() > 0) {
    LOG.info(String.format("String_Node_Str",newUnitsOfWork.size()));
  }
  return Lists.newArrayList(newUnitsOfWork);
}

Fixed version (ground truth):
/** 
 * Returns nodes that have all their dependencies satisfied. 
 */
public List<WorkUnit> dequeueZeroDependencyNodes(List<String> finishedNodes,int maxUnitsOfWork){
  Preconditions.checkArgument(maxUnitsOfWork >= 0);
  LOG.info(String.format("String_Node_Str",finishedNodes.size(),maxUnitsOfWork));
  processFinishedNodes(finishedNodes);
  if (maxUnitsOfWork == 0) {
    return Lists.newArrayList();
  }
  List<WorkUnit> newUnitsOfWork=new ArrayList<>();
  createWorkUnitsStartingAtNodes(new HashSet<>(zeroDependencyTargets),newUnitsOfWork,maxUnitsOfWork);
  if (newUnitsOfWork.size() > 0) {
    LOG.info(String.format("String_Node_Str",newUnitsOfWork.size()));
  }
  return Lists.newArrayList(newUnitsOfWork);
}
Program: 52859
Project: 52859
Buggy source:
/** 
 * Once a target has been built and uploaded to the cache, it is now safe to signal to the coordinator that the target is finished.
 * @param target
 */
public synchronized void recordUploadedTarget(String target){
  finishedTargetsToSignal.add(target);
}

Fixed version (ground truth):
/** 
 * Once a target has been built and uploaded to the cache, it is now safe to signal to the coordinator that the target is finished.
 * @param target
 */
public synchronized void recordUploadedTarget(String target){
  Preconditions.checkArgument(knownTargets.contains(target));
  Preconditions.checkArgument(!uploadedTargets.contains(target));
  uploadedTargets.add(target);
  uploadedTargetsToSignal.add(target);
}
Program: 52860
Project: 52860
Buggy source:
/** 
 * @return Targets that have finished building at minion that need to be signalled to coordinator.
 */
public synchronized List<String> getTargetsToSignal(){
  List<String> targets=Lists.newArrayList(finishedTargetsToSignal);
  finishedTargetsToSignal.clear();
  return targets;
}

Fixed version (ground truth):
/** 
 * @return Targets that have finished building at minion that need to be signalled to coordinator.
 */
public synchronized List<String> getTargetsToSignal(){
  List<String> targets=Lists.newArrayList(uploadedTargetsToSignal);
  uploadedTargetsToSignal.clear();
  return targets;
}
Program: 52861
Project: 52861
Buggy source:
/** 
 * @param newWorkUnits Work Units that have just been fetched from the coordinator 
 */
public synchronized void enqueueWorkUnitsForBuilding(List<WorkUnit> newWorkUnits){
  for (  WorkUnit workUnit : newWorkUnits) {
    List<String> buildTargetsInWorkUnit=workUnit.getBuildTargets();
    Preconditions.checkArgument(buildTargetsInWorkUnit.size() > 0);
    recordTerminalTarget(buildTargetsInWorkUnit);
    workUnitsToBuild.add(workUnit);
  }
  LOG.info(String.format("String_Node_Str",newWorkUnits.size()));
}

Fixed version (ground truth):
/** 
 * @param newWorkUnits Work Units that have just been fetched from the coordinator 
 */
public synchronized void enqueueWorkUnitsForBuilding(List<WorkUnit> newWorkUnits){
  if (newWorkUnits.size() == 0) {
    return;
  }
  for (  WorkUnit workUnit : newWorkUnits) {
    List<String> buildTargetsInWorkUnit=workUnit.getBuildTargets();
    Preconditions.checkArgument(buildTargetsInWorkUnit.size() > 0);
    recordTerminalTarget(buildTargetsInWorkUnit);
    workUnitsToBuild.add(workUnit);
  }
  availableWorkUnitCapacity-=newWorkUnits.size();
  LOG.info(String.format("String_Node_Str",newWorkUnits.size(),availableWorkUnitCapacity));
}
Program: 52862
Project: 52862
Buggy source:
/** 
 * @return Targets that minion should build, extracted from queued work units. 
 */
public synchronized List<String> getTargetsToBuild(){
  List<String> targetsToBuild=Lists.newArrayList();
  for (  WorkUnit workUnit : workUnitsToBuild) {
    targetsToBuild.addAll(workUnit.getBuildTargets());
  }
  LOG.debug(String.format("String_Node_Str",targetsToBuild.size(),workUnitsToBuild.size()));
  availableWorkUnitCapacity-=workUnitsToBuild.size();
  workUnitsToBuild.clear();
  return targetsToBuild;
}

Fixed version (ground truth):
/** 
 * @return Targets that minion should build, extracted from queued work units. 
 */
public synchronized List<String> getTargetsToBuild(){
  List<String> targetsToBuild=Lists.newArrayList();
  for (  WorkUnit workUnit : workUnitsToBuild) {
    targetsToBuild.addAll(workUnit.getBuildTargets());
  }
  knownTargets.addAll(targetsToBuild);
  LOG.debug(String.format("String_Node_Str",targetsToBuild.size(),workUnitsToBuild.size()));
  workUnitsToBuild.clear();
  return targetsToBuild;
}
Program: 52863
Project: 52863
Buggy source:
/** 
 * Increases available capacity if the given target was at the end of a work unit.
 * @param target
 */
public synchronized void recordFinishedTarget(String target){
  if (!workUnitTerminalTargets.contains(target)) {
    return;
  }
  availableWorkUnitCapacity++;
  workUnitTerminalTargets.remove(target);
}

Fixed version (ground truth):
/** 
 * Increases available capacity if the given target was at the end of a work unit.
 * @param target
 */
public synchronized void recordFinishedTarget(String target){
  Preconditions.checkArgument(knownTargets.contains(target));
  Preconditions.checkArgument(!finishedTargets.contains(target));
  finishedTargets.add(target);
  if (!workUnitTerminalTargets.contains(target)) {
    return;
  }
  availableWorkUnitCapacity++;
  workUnitTerminalTargets.remove(target);
}
Program: 52864
Project: 52864
Buggy source:
public void removeRule(SupportsPipelining<?> rule){
  rules.remove(rule);
}

Fixed version (ground truth):
/** 
 * Removes a rule from pipeline eligibility. If a pipeline is already running the rule, waits for it to complete before returning.
 */
public void removeRule(SupportsPipelining<?> rule){
  BuildRulePipelineStage<? extends RulePipelineState> pipelineStage=rules.remove(rule);
  if (pipelineStage != null && pipelineStage.pipelineBuilt()) {
    pipelineStage.cancelAndWait();
  }
}
Program: 52867
Project: 52867
Buggy source:
public CoordinatorAndMinionInfoSetter(DistBuildService service,StampedeId stampedeId,String minionQueue){
  this.service=service;
  this.stampedeId=stampedeId;
  this.minionQueue=minionQueue;
}

Fixed version (ground truth):
public CoordinatorAndMinionInfoSetter(DistBuildService service,StampedeId stampedeId,String minionQueue,boolean islocalMinionAlsoRunning){
  this.service=service;
  this.stampedeId=stampedeId;
  this.minionQueue=minionQueue;
  this.islocalMinionAlsoRunning=islocalMinionAlsoRunning;
}
Program: 52868
Project: 52868
Buggy source:
@Override public void onThriftServerStarted(String address,int port) throws IOException {
  service.setCoordinator(stampedeId,port,address);
  BuildJob buildJob=service.getCurrentBuildJobState(stampedeId);
  Preconditions.checkArgument(buildJob.isSetBuildModeInfo());
  BuildModeInfo buildModeInfo=buildJob.getBuildModeInfo();
  if (buildModeInfo.isSetNumberOfMinions() && buildModeInfo.getNumberOfMinions() > 0) {
    service.enqueueMinions(stampedeId,buildModeInfo.getNumberOfMinions(),minionQueue);
  }
}

Fixed version (ground truth):
@Override public void onThriftServerStarted(String address,int port) throws IOException {
  service.setCoordinator(stampedeId,port,address);
  BuildJob buildJob=service.getCurrentBuildJobState(stampedeId);
  Preconditions.checkArgument(buildJob.isSetBuildModeInfo());
  BuildModeInfo buildModeInfo=buildJob.getBuildModeInfo();
  if (!buildModeInfo.isSetNumberOfMinions()) {
    return;
  }
  int requiredNumberOfMinions=islocalMinionAlsoRunning ? buildModeInfo.getNumberOfMinions() - 1 : buildModeInfo.getNumberOfMinions();
  if (requiredNumberOfMinions > 0) {
    service.enqueueMinions(stampedeId,requiredNumberOfMinions,minionQueue);
  }
}
Program: 52869
Project: 52869
Buggy source:
public int buildAndReturnExitCode() throws IOException, InterruptedException {
  LocalBuilder localBuilder=new LocalBuilderImpl();
  DistBuildModeRunner runner=null;
switch (args.getDistBuildMode()) {
case REMOTE_BUILD:
    runner=new RemoteBuildModeRunner(localBuilder,args.getState().getRemoteState().getTopLevelTargets());
  break;
case COORDINATOR:
runner=newCoordinatorMode(getFreePortForCoordinator());
break;
case MINION:
runner=newMinionMode(localBuilder,args.getRemoteCoordinatorAddress(),args.getRemoteCoordinatorPort());
break;
case COORDINATOR_AND_MINION:
int localCoordinatorPort=getFreePortForCoordinator();
runner=new CoordinatorAndMinionModeRunner(newCoordinatorMode(localCoordinatorPort),newMinionMode(localBuilder,LOCALHOST_ADDRESS,localCoordinatorPort));
break;
default :
LOG.error("String_Node_Str",args.getDistBuildMode().toString());
return -1;
}
return runner.runAndReturnExitCode();
}

Fixed version (ground truth):
public int buildAndReturnExitCode() throws IOException, InterruptedException {
  LocalBuilder localBuilder=new LocalBuilderImpl();
  DistBuildModeRunner runner=null;
switch (args.getDistBuildMode()) {
case REMOTE_BUILD:
    runner=new RemoteBuildModeRunner(localBuilder,args.getState().getRemoteState().getTopLevelTargets());
  break;
case COORDINATOR:
runner=newCoordinatorMode(getFreePortForCoordinator(),false);
break;
case MINION:
runner=newMinionMode(localBuilder,args.getRemoteCoordinatorAddress(),args.getRemoteCoordinatorPort());
break;
case COORDINATOR_AND_MINION:
int localCoordinatorPort=getFreePortForCoordinator();
runner=new CoordinatorAndMinionModeRunner(newCoordinatorMode(localCoordinatorPort,true),newMinionMode(localBuilder,LOCALHOST_ADDRESS,localCoordinatorPort));
break;
default :
LOG.error("String_Node_Str",args.getDistBuildMode().toString());
return -1;
}
return runner.runAndReturnExitCode();
}
Program: 52870
Project: 52870
Buggy source:
private CoordinatorModeRunner newCoordinatorMode(int coordinatorPort){
  BuildTargetsQueue queue=BuildTargetsQueue.newQueue(Preconditions.checkNotNull(actionGraphAndResolver).getResolver(),fullyQualifiedNameToBuildTarget(args.getState().getRemoteState().getTopLevelTargets()));
  Optional<String> minionQueue=args.getDistBuildConfig().getMinionQueue();
  Preconditions.checkArgument(minionQueue.isPresent(),"String_Node_Str");
  CoordinatorModeRunner.EventListener listener=new CoordinatorAndMinionInfoSetter(args.getDistBuildService(),args.getStampedeId(),minionQueue.get());
  return new CoordinatorModeRunner(coordinatorPort,queue,args.getStampedeId(),listener,args.getDistBuildConfig().getMaxBuildNodesPerMinion());
}

Fixed version (ground truth):
private CoordinatorModeRunner newCoordinatorMode(int coordinatorPort,boolean isLocalMinionAlsoRunning){
  BuildTargetsQueue queue=BuildTargetsQueue.newQueue(Preconditions.checkNotNull(actionGraphAndResolver).getResolver(),fullyQualifiedNameToBuildTarget(args.getState().getRemoteState().getTopLevelTargets()));
  Optional<String> minionQueue=args.getDistBuildConfig().getMinionQueue();
  Preconditions.checkArgument(minionQueue.isPresent(),"String_Node_Str");
  CoordinatorModeRunner.EventListener listener=new CoordinatorAndMinionInfoSetter(args.getDistBuildService(),args.getStampedeId(),minionQueue.get(),isLocalMinionAlsoRunning);
  return new CoordinatorModeRunner(coordinatorPort,queue,args.getStampedeId(),listener,args.getDistBuildConfig().getMaxBuildNodesPerMinion());
}
Program: 52871
Project: 52871
Buggy source:
@Override public int buildSourceAbiJar(Path sourceAbiJar) throws InterruptedException {
  BuckTracing.setCurrentThreadTracingInterfaceFromJsr199Javac(new Jsr199TracingBridge(context.getEventSink(),invokingRule));
  try {
    BuckJavacTaskProxy javacTask=getJavacTask();
    javacTask.addPostEnterCallback(topLevelTypes -> {
      try {
        JarBuilder jarBuilder=newJarBuilder().setShouldHashEntries(true);
        StubGenerator stubGenerator=new StubGenerator(getTargetVersion(options),javacTask.getElements(),javacTask.getMessager(),jarBuilder,context.getEventSink());
        stubGenerator.generate(topLevelTypes);
        jarBuilder.createJarFile(sourceAbiJar);
      }
 catch (      IOException e) {
        throw new HumanReadableException("String_Node_Str",e.getMessage());
      }
    }
);
    try {
      javacTask.parse();
      if (buildSuccessful()) {
        javacTask.enter();
      }
    }
 catch (    RuntimeException e) {
      throw new HumanReadableException(String.format("String_Node_Str",invokingRule.getUnflavoredBuildTarget().toString()),e);
    }
    frontendRunAttempted=true;
    debugLogDiagnostics();
    if (!buildSuccessful()) {
      reportDiagnosticsToUser();
      return 1;
    }
    return 0;
  }
 catch (  IOException e) {
    LOG.error(e);
    throw new HumanReadableException("String_Node_Str",e.getMessage());
  }
 finally {
    BuckTracing.clearCurrentThreadTracingInterfaceFromJsr199Javac();
  }
}

Fixed version (ground truth):
@Override public int buildSourceAbiJar(Path sourceAbiJar) throws InterruptedException {
  BuckTracing.setCurrentThreadTracingInterfaceFromJsr199Javac(new Jsr199TracingBridge(context.getEventSink(),invokingRule));
  try {
    BuckJavacTaskProxy javacTask=getJavacTask();
    javacTask.addPostEnterCallback(topLevelTypes -> {
      try {
        JarBuilder jarBuilder=newJarBuilder().setShouldHashEntries(true);
        StubGenerator stubGenerator=new StubGenerator(getTargetVersion(options),javacTask.getElements(),javacTask.getMessager(),jarBuilder,context.getEventSink());
        stubGenerator.generate(topLevelTypes);
        jarBuilder.createJarFile(sourceAbiJar);
      }
 catch (      IOException e) {
        throw new HumanReadableException("String_Node_Str",e.getMessage());
      }
    }
);
    try {
      javacTask.parse();
      if (buildSuccessful()) {
        javacTask.enter();
      }
    }
 catch (    RuntimeException e) {
      throw new HumanReadableException(e,String.format("String_Node_Str",invokingRule.getUnflavoredBuildTarget().toString()));
    }
    frontendRunAttempted=true;
    debugLogDiagnostics();
    if (!buildSuccessful()) {
      reportDiagnosticsToUser();
      return 1;
    }
    return 0;
  }
 catch (  IOException e) {
    LOG.error(e);
    throw new HumanReadableException("String_Node_Str",e.getMessage());
  }
 finally {
    BuckTracing.clearCurrentThreadTracingInterfaceFromJsr199Javac();
  }
}
Program: 52872
Project: 52872
Buggy source:
@Override public int runAndReturnExitCode() throws IOException, InterruptedException {
  try (ThriftCoordinatorClient client=new ThriftCoordinatorClient(coordinatorAddress,coordinatorPort,stampedeId)){
    client.start();
    final String minionId=generateNewMinionId();
    while (true) {
      GetTargetsToBuildResponse response=client.getTargetsToBuild(minionId);
switch (response.getAction()) {
case BUILD_TARGETS:
        List<String> targetsToBuild=Lists.newArrayList(response.getBuildTargets());
      LOG.debug(String.format("String_Node_Str",minionId,targetsToBuild.size(),Joiner.on("String_Node_Str").join(targetsToBuild)));
    int buildExitCode=builder.buildLocallyAndReturnExitCode(targetsToBuild);
  LOG.debug(String.format("String_Node_Str",minionId,buildExitCode));
FinishedBuildingResponse finishedResponse=client.finishedBuilding(minionId,buildExitCode);
if (!finishedResponse.isContinueBuilding()) {
return 0;
}
break;
case RETRY_LATER:
try {
Thread.sleep(RETRY_BACKOFF_MILLIS);
}
 catch (InterruptedException e) {
throw new RuntimeException(e);
}
break;
case CLOSE_CLIENT:
return 0;
case UNKNOWN:
default :
throw new RuntimeException(String.format("String_Node_Str",response.getAction()));
}
}
}
 }

Fixed version (ground truth):
@Override public int runAndReturnExitCode() throws IOException, InterruptedException {
  try (ThriftCoordinatorClient client=new ThriftCoordinatorClient(coordinatorAddress,coordinatorPort,stampedeId)){
    client.start();
    final String minionId=generateNewMinionId();
    while (true) {
      GetTargetsToBuildResponse response=client.getTargetsToBuild(minionId);
switch (response.getAction()) {
case BUILD_TARGETS:
        List<String> targetsToBuild=Lists.newArrayList(response.getBuildTargets());
      LOG.debug(String.format("String_Node_Str",minionId,targetsToBuild.size(),Joiner.on("String_Node_Str").join(targetsToBuild)));
    int buildExitCode=builder.buildLocallyAndReturnExitCode(targetsToBuild);
  LOG.debug(String.format("String_Node_Str",minionId,buildExitCode));
FinishedBuildingResponse finishedResponse=client.finishedBuilding(minionId,buildExitCode);
if (!finishedResponse.isContinueBuilding()) {
LOG.debug(String.format("String_Node_Str",minionId));
return 0;
}
break;
case RETRY_LATER:
try {
LOG.debug(String.format("String_Node_Str",minionId));
Thread.sleep(RETRY_BACKOFF_MILLIS);
}
 catch (InterruptedException e) {
throw new RuntimeException(e);
}
break;
case CLOSE_CLIENT:
LOG.debug(String.format("String_Node_Str",minionId));
return 0;
case UNKNOWN:
default :
throw new RuntimeException(String.format("String_Node_Str",response.getAction()));
}
}
}
 }
Program: 52873
Project: 52873
Buggy source:
@Override public FinishedBuildingResponse finishedBuilding(FinishedBuildingRequest request) throws TException {
  LOG.info(String.format("String_Node_Str",request.getMinionId()));
  checkBuildId(request.getStampedeId());
synchronized (lock) {
    Preconditions.checkArgument(request.isSetMinionId());
    Preconditions.checkArgument(request.isSetBuildExitCode());
    FinishedBuildingResponse response=new FinishedBuildingResponse();
    if (request.getBuildExitCode() != 0) {
      setBuildExitCode(request.getBuildExitCode());
      response.setContinueBuilding(false);
    }
 else {
      allocator.finishedBuildingTargets(request.getMinionId());
      if (getExitCode().isDone()) {
        response.setContinueBuilding(false);
      }
 else {
        if (allocator.isBuildFinished()) {
          setBuildExitCode(0);
          response.setContinueBuilding(false);
        }
 else {
          response.setContinueBuilding(true);
        }
      }
    }
    return response;
  }
}

Fixed version (ground truth):
@Override public FinishedBuildingResponse finishedBuilding(FinishedBuildingRequest request) throws TException {
  LOG.info(String.format("String_Node_Str",request.getMinionId()));
  checkBuildId(request.getStampedeId());
synchronized (lock) {
    Preconditions.checkArgument(request.isSetMinionId());
    Preconditions.checkArgument(request.isSetBuildExitCode());
    FinishedBuildingResponse response=new FinishedBuildingResponse();
    if (request.getBuildExitCode() != 0) {
      exitCode=request.getBuildExitCode();
      removeRunningMinion(request.getMinionId());
      response.setContinueBuilding(false);
    }
 else {
      allocator.finishedBuildingTargets(request.getMinionId());
      if (allocator.isBuildFinished()) {
        removeRunningMinion(request.getMinionId());
        response.setContinueBuilding(false);
      }
 else {
        response.setContinueBuilding(true);
      }
    }
    return response;
  }
}
Program: 52874
Project: 52874
Buggy source:
@Override public GetTargetsToBuildResponse getTargetsToBuild(GetTargetsToBuildRequest request) throws TException {
  LOG.debug(String.format("String_Node_Str",request.minionId));
  checkBuildId(request.getStampedeId());
synchronized (lock) {
    Preconditions.checkArgument(request.isSetMinionId());
    GetTargetsToBuildResponse response=new GetTargetsToBuildResponse();
    if (allocator.isBuildFinished()) {
      LOG.debug(String.format("String_Node_Str",request.minionId));
      return response.setAction(GetTargetsToBuildAction.CLOSE_CLIENT);
    }
    ImmutableList<String> targets=allocator.getTargetsToBuild(request.getMinionId());
    if (targets.isEmpty()) {
      LOG.debug(String.format("String_Node_Str",request.minionId));
      return response.setAction(GetTargetsToBuildAction.RETRY_LATER);
    }
 else {
      LOG.debug(String.format("String_Node_Str",request.minionId,targets.size(),Joiner.on("String_Node_Str").join(targets)));
      return response.setAction(GetTargetsToBuildAction.BUILD_TARGETS).setBuildTargets(targets);
    }
  }
}

Fixed version (ground truth):
@Override public GetTargetsToBuildResponse getTargetsToBuild(GetTargetsToBuildRequest request) throws TException {
  LOG.debug(String.format("String_Node_Str",request.minionId));
  checkBuildId(request.getStampedeId());
synchronized (lock) {
    Preconditions.checkArgument(request.isSetMinionId());
    runningMinions.add(request.getMinionId());
    GetTargetsToBuildResponse response=new GetTargetsToBuildResponse();
    if (allocator.isBuildFinished()) {
      LOG.debug(String.format("String_Node_Str",request.minionId));
      removeRunningMinion(request.getMinionId());
      return response.setAction(GetTargetsToBuildAction.CLOSE_CLIENT);
    }
    ImmutableList<String> targets=allocator.getTargetsToBuild(request.getMinionId());
    if (targets.isEmpty()) {
      LOG.debug(String.format("String_Node_Str",request.minionId));
      return response.setAction(GetTargetsToBuildAction.RETRY_LATER);
    }
 else {
      LOG.debug(String.format("String_Node_Str",request.minionId,targets.size(),Joiner.on("String_Node_Str").join(targets)));
      return response.setAction(GetTargetsToBuildAction.BUILD_TARGETS).setBuildTargets(targets);
    }
  }
}
Program: 52875
Project: 52875
Buggy source:
@Override public Object visitString(String s,Void aVoid){
  if (getUnderlyingType(valueTreePath).getKind() == TypeKind.ERROR) {
    Tree leaf=valueTreePath.getLeaf();
    if (leaf instanceof MemberSelectTree && ((MemberSelectTree)leaf).getIdentifier().contentEquals("String_Node_Str")) {
      TreePath classNamePath=new TreePath(valueTreePath,((MemberSelectTree)leaf).getExpression());
      return getCanonicalType(getUnderlyingType(classNamePath),classNamePath);
    }
  }
  return super.visitString(s,aVoid);
}

Fixed version (ground truth):
@Override public Object visitString(String s,Void aVoid){
  if (getUnderlyingType(valueTreePath).getKind() == TypeKind.ERROR) {
    Tree leaf=valueTreePath.getLeaf();
    if (leaf instanceof MemberSelectTree && ((MemberSelectTree)leaf).getIdentifier().contentEquals("String_Node_Str")) {
      TreePath classNamePath=new TreePath(valueTreePath,((MemberSelectTree)leaf).getExpression());
      return getCanonicalType(getUnderlyingType(classNamePath),classNamePath);
    }
 else {
      javacTrees.printMessage(Diagnostic.Kind.ERROR,"String_Node_Str",leaf,valueTreePath.getCompilationUnit());
    }
  }
  return super.visitString(s,aVoid);
}
Program: 52877
Project: 52877
Buggy source:
private Tester createAnnotationFullJar() throws IOException {
  return tester.setSourceFile("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").compileFullJar();
}

Fixed version (ground truth):
private Tester createAnnotationFullJar() throws IOException {
  return tester.setSourceFile("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").compileFullJar();
}
Program: 52878
Project: 52878
Buggy source:
private static void writeZipContents(ZipFile zip,ZipArchiveEntry entry,ProjectFilesystem filesystem,Path target) throws IOException {
  try (InputStream is=zip.getInputStream(entry)){
    if (entry.isUnixSymlink()) {
      filesystem.createSymLink(target,filesystem.getPath(new String(ByteStreams.toByteArray(is),Charsets.UTF_8)),true);
    }
 else {
      try (OutputStream out=filesystem.newFileOutputStream(target)){
        ByteStreams.copy(is,out);
      }
     }
  }
   filesystem.resolve(target).toFile().setLastModified(entry.getTime());
  Set<PosixFilePermission> permissions=MorePosixFilePermissions.fromMode(entry.getExternalAttributes() >> 16);
  if (permissions.contains(PosixFilePermission.OWNER_EXECUTE)) {
    MoreFiles.makeExecutable(filesystem.resolve(target));
  }
}

Fixed version (ground truth):
private static void writeZipContents(ZipFile zip,ZipArchiveEntry entry,ProjectFilesystem filesystem,Path target) throws IOException {
  try (InputStream is=zip.getInputStream(entry)){
    if (entry.isUnixSymlink()) {
      filesystem.createSymLink(target,filesystem.getPath(new String(ByteStreams.toByteArray(is),Charsets.UTF_8)),true);
    }
 else {
      try (OutputStream out=filesystem.newFileOutputStream(target)){
        ByteStreams.copy(is,out);
      }
     }
  }
   Path filePath=filesystem.resolve(target);
  File file=filePath.toFile();
  file.setLastModified(entry.getTime());
  Set<PosixFilePermission> permissions=MorePosixFilePermissions.fromMode(entry.getExternalAttributes() >> 16);
  if (permissions.contains(PosixFilePermission.OWNER_EXECUTE) && file.getCanonicalFile().exists()) {
    MoreFiles.makeExecutable(filePath);
  }
}
Program: 52879
Project: 52879
Buggy source:
@Value.NaturalOrder ImmutableSortedSet<BuildTarget> getDeps();

Fixed version (ground truth):
@Value.NaturalOrder @Override ImmutableSortedSet<BuildTarget> getDeps();
Program: 52880
Project: 52880
Buggy source:
public FrontendOnlyJavacTask(JavacTask task){
  super(task);
  javacTask=task;
  addPlugin(new EnteringPlugin());
}

Fixed version (ground truth):
public FrontendOnlyJavacTask(JavacTask task){
  super(task);
  javacTask=task;
  addTaskListener(new SuppressEnterErrorsTaskListener(task));
  addPlugin(new EnteringPlugin());
}
Program: 52881
Project: 52881
Buggy source:
private ListenableFuture<Void> storeContent(ImmutableSet<RuleKey> contentHashes,BorrowablePath content){
  try {
    ImmutableSet<RuleKey> toStore=notPreexisting(contentHashes);
    long size=filesystem.getFileSize(content.getPath());
    if (size <= maxInlinedBytes) {
      db.storeArtifact(toStore,Files.readAllBytes(content.getPath()),size);
    }
 else     if (!toStore.isEmpty()) {
      Path artifactPath=getArtifactPath(toStore.iterator().next());
      filesystem.mkdirs(artifactPath.getParent());
      if (content.canBorrow()) {
        filesystem.move(content.getPath(),artifactPath,StandardCopyOption.REPLACE_EXISTING);
      }
 else {
        storeArtifactOutput(content.getPath(),artifactPath);
      }
      db.storeFilepath(toStore,artifactPath.toString(),size);
    }
  }
 catch (  IOException|SQLException e) {
    LOG.warn(e,"String_Node_Str",contentHashes,content);
  }
  return Futures.immediateFuture(null);
}

Fixed version (ground truth):
private ListenableFuture<Void> storeContent(ImmutableSet<RuleKey> contentHashes,BorrowablePath content){
  try {
    ImmutableSet<RuleKey> toStore=notPreexisting(contentHashes);
    if (toStore.size() == 0) {
      return Futures.immediateFuture(null);
    }
    long size=filesystem.getFileSize(content.getPath());
    if (size <= maxInlinedBytes) {
      db.storeArtifact(toStore,Files.readAllBytes(content.getPath()),size);
    }
 else     if (!toStore.isEmpty()) {
      Path artifactPath=getArtifactPath(toStore.iterator().next());
      filesystem.mkdirs(artifactPath.getParent());
      if (content.canBorrow()) {
        filesystem.move(content.getPath(),artifactPath,StandardCopyOption.REPLACE_EXISTING);
      }
 else {
        storeArtifactOutput(content.getPath(),artifactPath);
      }
      db.storeFilepath(toStore,artifactPath.toString(),size);
    }
  }
 catch (  IOException|SQLException e) {
    LOG.warn(e,"String_Node_Str",contentHashes,content);
  }
  return Futures.immediateFuture(null);
}
Program: 52882
Project: 52882
Buggy source:
@Override public ListenableFuture<Void> store(ArtifactInfo info,BorrowablePath content){
  if (!getCacheReadMode().isWritable()) {
    return Futures.immediateFuture(null);
  }
  if (info.getMetadata().containsKey(TwoLevelArtifactCacheDecorator.METADATA_KEY)) {
    return Futures.transformAsync(storeMetadata(info),result -> removeOldMetadata());
  }
 else {
    return Futures.transformAsync(storeContent(info.getRuleKeys(),content),result -> removeOldContent());
  }
}

Fixed version (ground truth):
@Override public ListenableFuture<Void> store(ArtifactInfo info,BorrowablePath content){
  if (!getCacheReadMode().isWritable()) {
    return Futures.immediateFuture(null);
  }
  ListenableFuture<Void> metadataResult=Futures.immediateFuture(null);
  if (!info.getMetadata().isEmpty()) {
    metadataResult=Futures.transformAsync(storeMetadata(info),result -> removeOldMetadata());
  }
  ListenableFuture<Void> contentResult=Futures.immediateFuture(null);
  if (!info.getMetadata().containsKey(TwoLevelArtifactCacheDecorator.METADATA_KEY)) {
    contentResult=Futures.transformAsync(storeContent(info.getRuleKeys(),content),result -> removeOldContent());
  }
  return Futures.transform(Futures.allAsList(metadataResult,contentResult),Functions.constant(null));
}
Program: 52883
Project: 52883
Buggy source:
private CacheResult fetch(RuleKey ruleKey,LazyPath output){
  CacheResult artifactFetchResult=maybeFetchArtifact(ruleKey,output);
  if (artifactFetchResult.getType() == CacheResultType.HIT || artifactFetchResult.getType() == CacheResultType.ERROR) {
    return artifactFetchResult;
  }
 else {
    return fetchMetadata(ruleKey,output);
  }
}

Fixed version (ground truth):
private CacheResult fetch(RuleKey ruleKey,LazyPath output){
  CacheResult artifactResult=fetchContent(ruleKey,output);
  CacheResult metadataResult=fetchMetadata(ruleKey,output);
  if (artifactResult.getType().isSuccess() && metadataResult.getType().isSuccess()) {
    return CacheResult.hit(name,CACHE_MODE,metadataResult.getMetadata(),artifactResult.getArtifactSizeBytes());
  }
 else   if (artifactResult.getType() == CacheResultType.HIT || artifactResult.getType() == CacheResultType.ERROR) {
    return artifactResult;
  }
 else {
    return metadataResult;
  }
}
Program: 52884
Project: 52884
Buggy source:
static AppleDebuggableBinary createAppleDebuggableBinary(BuildTarget buildTarget,ProjectFilesystem projectFilesystem,BuildRuleParams params,BuildRuleResolver resolver,BuildRule strippedBinaryRule,ProvidesLinkedBinaryDeps unstrippedBinaryRule,AppleDebugFormat debugFormat,FlavorDomain<CxxPlatform> cxxPlatformFlavorDomain,Flavor defaultCxxFlavor,FlavorDomain<AppleCxxPlatform> appleCxxPlatforms){
  Optional<AppleDsym> appleDsym=createAppleDsymForDebugFormat(debugFormat,buildTarget,projectFilesystem,params,resolver,unstrippedBinaryRule,cxxPlatformFlavorDomain,defaultCxxFlavor,appleCxxPlatforms);
  BuildRule buildRuleForDebugFormat;
  if (debugFormat == AppleDebugFormat.DWARF) {
    buildRuleForDebugFormat=unstrippedBinaryRule;
  }
 else {
    buildRuleForDebugFormat=strippedBinaryRule;
  }
  AppleDebuggableBinary rule=new AppleDebuggableBinary(strippedBinaryRule.getBuildTarget().withAppendedFlavors(AppleDebuggableBinary.RULE_FLAVOR,debugFormat.getFlavor()),projectFilesystem,params.withDeclaredDeps(AppleDebuggableBinary.getRequiredRuntimeDeps(debugFormat,strippedBinaryRule,unstrippedBinaryRule,appleDsym)).withoutExtraDeps(),buildRuleForDebugFormat);
  return rule;
}

Fixed version (ground truth):
static AppleDebuggableBinary createAppleDebuggableBinary(BuildTarget buildTarget,ProjectFilesystem projectFilesystem,BuildRuleParams params,BuildRuleResolver resolver,BuildRule strippedBinaryRule,ProvidesLinkedBinaryDeps unstrippedBinaryRule,AppleDebugFormat debugFormat,FlavorDomain<CxxPlatform> cxxPlatformFlavorDomain,Flavor defaultCxxFlavor,FlavorDomain<AppleCxxPlatform> appleCxxPlatforms){
  Optional<AppleDsym> appleDsym=debugFormat == AppleDebugFormat.DWARF_AND_DSYM ? Optional.of(requireAppleDsym(buildTarget,projectFilesystem,params,resolver,unstrippedBinaryRule,cxxPlatformFlavorDomain,defaultCxxFlavor,appleCxxPlatforms)) : Optional.empty();
  BuildRule buildRuleForDebugFormat;
  if (debugFormat == AppleDebugFormat.DWARF) {
    buildRuleForDebugFormat=unstrippedBinaryRule;
  }
 else {
    buildRuleForDebugFormat=strippedBinaryRule;
  }
  AppleDebuggableBinary rule=new AppleDebuggableBinary(strippedBinaryRule.getBuildTarget().withAppendedFlavors(AppleDebuggableBinary.RULE_FLAVOR,debugFormat.getFlavor()),projectFilesystem,params.withDeclaredDeps(AppleDebuggableBinary.getRequiredRuntimeDeps(debugFormat,strippedBinaryRule,unstrippedBinaryRule,appleDsym)).withoutExtraDeps(),buildRuleForDebugFormat);
  return rule;
}
Program: 52886
Project: 52886
Buggy source:
private Exception maybeAttachBuildRuleNameToException(@Nonnull Exception thrown){
  if ((thrown instanceof HumanReadableException) || (thrown instanceof InterruptedException)) {
    return thrown;
  }
  String message=thrown.getMessage();
  if (message != null && message.contains(rule.toString())) {
    return thrown;
  }
  return new RuntimeException(getErrorMessageIncludingBuildRule(thrown),thrown);
}

Fixed version (ground truth):
private Throwable maybeAttachBuildRuleNameToException(@Nonnull Throwable thrown){
  if ((thrown instanceof HumanReadableException) || (thrown instanceof InterruptedException)) {
    return thrown;
  }
  String message=thrown.getMessage();
  if (message != null && message.contains(rule.toString())) {
    return thrown;
  }
  return new RuntimeException(getErrorMessageIncludingBuildRule(thrown),thrown);
}
Program: 52888
Project: 52888
Buggy source:
private CacheResult fetch(ArtifactCache artifactCache,RuleKey ruleKey,LazyPath outputPath){
  CacheResult cacheResult=Futures.getUnchecked(artifactCache.fetchAsync(ruleKey,outputPath));
  if (cacheResult.getType() != CacheResultType.HIT) {
    return cacheResult;
  }
  for (  String ruleKeyName : BuildInfo.RULE_KEY_NAMES) {
    if (!cacheResult.getMetadata().containsKey(ruleKeyName)) {
      continue;
    }
    String ruleKeyValue=cacheResult.getMetadata().get(ruleKeyName);
    try {
      HashCode.fromString(ruleKeyValue);
    }
 catch (    IllegalArgumentException e) {
      throw new IllegalArgumentException(String.format("String_Node_Str",ruleKeyName,ruleKey,artifactCache.getClass(),ruleKeyValue),e);
    }
  }
  return cacheResult;
}

Fixed version (ground truth):
private CacheResult fetch(ArtifactCache artifactCache,RuleKey ruleKey,LazyPath outputPath){
  CacheResult cacheResult=Futures.getUnchecked(artifactCache.fetchAsync(ruleKey,outputPath));
  if (cacheResult.getType() != CacheResultType.HIT) {
    return cacheResult;
  }
  for (  String ruleKeyName : BuildInfo.RULE_KEY_NAMES) {
    if (!cacheResult.getMetadata().containsKey(ruleKeyName)) {
      continue;
    }
    String ruleKeyValue=cacheResult.getMetadata().get(ruleKeyName);
    try {
      verify(ruleKeyValue);
    }
 catch (    IllegalArgumentException e) {
      throw new IllegalArgumentException(String.format("String_Node_Str",ruleKeyName,ruleKey,artifactCache.getClass(),ruleKeyValue),e);
    }
  }
  return cacheResult;
}