nus-yam/ex-repair huggingface dataset:
Program: 53278
Project: 53278
Buggy source:
private ImmutableList<String> buildArgs(){
  ImmutableList.Builder<String> argBuilder=ImmutableList.builder();
  argBuilder.add(pythonInterpreter);
  argBuilder.add("String_Node_Str");
  argBuilder.add(PATH_TO_BUCK_PY);
  if (isServerMode) {
    argBuilder.add("String_Node_Str");
  }
  argBuilder.add("String_Node_Str",projectRoot.getAbsolutePath());
  for (  String include : commonIncludes) {
    argBuilder.add("String_Node_Str");
    argBuilder.add(include);
  }
  for (  String path : ignorePaths) {
    argBuilder.add("String_Node_Str");
    argBuilder.add(path);
  }
  return argBuilder.build();
}

Fixed version (ground truth):
private ImmutableList<String> buildArgs(){
  ImmutableList.Builder<String> argBuilder=ImmutableList.builder();
  argBuilder.add(pythonInterpreter);
  argBuilder.add("String_Node_Str");
  argBuilder.add(PATH_TO_BUCK_PY);
  if (isServerMode) {
    argBuilder.add("String_Node_Str");
  }
  argBuilder.add("String_Node_Str",projectRoot.getAbsolutePath());
  for (  String include : commonIncludes) {
    argBuilder.add("String_Node_Str");
    argBuilder.add(include);
  }
  for (  Path path : ignorePaths) {
    argBuilder.add("String_Node_Str");
    argBuilder.add(path.toString());
  }
  return argBuilder.build();
}
Program: 53279
Project: 53279
Buggy source:
@Override public int execute(final ExecutionContext context){
  final ProjectFilesystem projectFilesystem=context.getProjectFilesystem();
  ImmutableSet<String> ignorePaths=ImmutableSet.of();
  DirectoryTraversal traversal=new DirectoryTraversal(projectFilesystem.getFileForRelativePath(binDirectory),ignorePaths){
    @Override public void visit(    File file,    String relativePath) throws IOException {
      Path source=binDirectory.resolve(relativePath);
      Path target=genDirectory.resolve(relativePath);
      projectFilesystem.createParentDirs(target);
      projectFilesystem.copyFile(source,target);
      buildableContext.recordArtifact(target);
    }
  }
;
  try {
    traversal.traverse();
  }
 catch (  IOException e) {
    e.printStackTrace(context.getStdErr());
    return 1;
  }
  return 0;
}

Fixed version (ground truth):
@Override public int execute(final ExecutionContext context){
  final ProjectFilesystem projectFilesystem=context.getProjectFilesystem();
  ImmutableSet<Path> ignorePaths=ImmutableSet.of();
  DirectoryTraversal traversal=new DirectoryTraversal(projectFilesystem.getFileForRelativePath(binDirectory),ignorePaths){
    @Override public void visit(    File file,    String relativePath) throws IOException {
      Path source=binDirectory.resolve(relativePath);
      Path target=genDirectory.resolve(relativePath);
      projectFilesystem.createParentDirs(target);
      projectFilesystem.copyFile(source,target);
      buildableContext.recordArtifact(target);
    }
  }
;
  try {
    traversal.traverse();
  }
 catch (  IOException e) {
    e.printStackTrace(context.getStdErr());
    return 1;
  }
  return 0;
}
Program: 53280
Project: 53280
Buggy source:
public final void traverse() throws IOException {
  Preconditions.checkState(root.isDirectory(),"String_Node_Str",root);
  final Path rootPath=root.toPath();
  FileVisitor<Path> visitor=new FileVisitor<Path>(){
    @Override public FileVisitResult preVisitDirectory(    Path dir,    BasicFileAttributes attrs) throws IOException {
      if (ignorePaths.contains(rootPath.relativize(dir).toString())) {
        return FileVisitResult.SKIP_SUBTREE;
      }
 else {
        return FileVisitResult.CONTINUE;
      }
    }
    @Override public FileVisitResult visitFile(    Path file,    BasicFileAttributes attrs) throws IOException {
      visit(file.toFile(),rootPath.relativize(file).toString());
      return FileVisitResult.CONTINUE;
    }
    @Override public FileVisitResult visitFileFailed(    Path file,    IOException exc) throws IOException {
      return FileVisitResult.CONTINUE;
    }
    @Override public FileVisitResult postVisitDirectory(    Path dir,    IOException exc) throws IOException {
      return FileVisitResult.CONTINUE;
    }
  }
;
  Files.walkFileTree(rootPath,EnumSet.of(FileVisitOption.FOLLOW_LINKS),Integer.MAX_VALUE,visitor);
}

Fixed version (ground truth):
public final void traverse() throws IOException {
  Preconditions.checkState(root.isDirectory(),"String_Node_Str",root);
  final Path rootPath=root.toPath();
  FileVisitor<Path> visitor=new FileVisitor<Path>(){
    @Override public FileVisitResult preVisitDirectory(    Path dir,    BasicFileAttributes attrs) throws IOException {
      if (ignorePaths.contains(rootPath.relativize(dir))) {
        return FileVisitResult.SKIP_SUBTREE;
      }
 else {
        return FileVisitResult.CONTINUE;
      }
    }
    @Override public FileVisitResult visitFile(    Path file,    BasicFileAttributes attrs) throws IOException {
      visit(file.toFile(),rootPath.relativize(file).toString());
      return FileVisitResult.CONTINUE;
    }
    @Override public FileVisitResult visitFileFailed(    Path file,    IOException exc) throws IOException {
      return FileVisitResult.CONTINUE;
    }
    @Override public FileVisitResult postVisitDirectory(    Path dir,    IOException exc) throws IOException {
      return FileVisitResult.CONTINUE;
    }
  }
;
  Files.walkFileTree(rootPath,EnumSet.of(FileVisitOption.FOLLOW_LINKS),Integer.MAX_VALUE,visitor);
}
Program: 53281
Project: 53281
Buggy source:
public DirectoryTraversal(File root){
  this(root,ImmutableSet.<String>of());
}

Fixed version (ground truth):
public DirectoryTraversal(File root){
  this(root,ImmutableSet.<Path>of());
}
Program: 53282
Project: 53282
Buggy source:
@Override public FileVisitResult preVisitDirectory(Path dir,BasicFileAttributes attrs) throws IOException {
  if (ignorePaths.contains(rootPath.relativize(dir).toString())) {
    return FileVisitResult.SKIP_SUBTREE;
  }
 else {
    return FileVisitResult.CONTINUE;
  }
}

Fixed version (ground truth):
@Override public FileVisitResult preVisitDirectory(Path dir,BasicFileAttributes attrs) throws IOException {
  if (ignorePaths.contains(rootPath.relativize(dir))) {
    return FileVisitResult.SKIP_SUBTREE;
  }
 else {
    return FileVisitResult.CONTINUE;
  }
}
Program: 53283
Project: 53283
Buggy source:
public ProjectFilesystem(File projectRoot){
  this(projectRoot,ImmutableSet.<String>of());
}

Fixed version (ground truth):
public ProjectFilesystem(File projectRoot){
  this(projectRoot,ImmutableSet.<Path>of());
}
Program: 53284
Project: 53284
Buggy source:
public ImmutableSet<String> getIgnorePaths(){
  return ignorePaths;
}

Fixed version (ground truth):
/** 
 * @return A {@link ImmutableSet} of {@link Path} objects to have buck ignore.  All paths will berelative to the  {@link ProjectFilesystem#getRootPath()}.
 */
public ImmutableSet<Path> getIgnorePaths(){
  return ignorePaths;
}
Program: 53285
Project: 53285
Buggy source:
private boolean shouldIgnore(Path path){
  Path normalizedPath=path.normalize();
  for (  String prefix : ignoredPrefixes) {
    if (normalizedPath.startsWith(prefix)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean shouldIgnore(Path path){
  Path normalizedPath=path.normalize();
  for (  Path prefix : ignoredPrefixes) {
    if (normalizedPath.startsWith(prefix)) {
      return true;
    }
  }
  return false;
}
Program: 53286
Project: 53286
Buggy source:
public ProjectFilesystemWatcher(ProjectFilesystem filesystem,EventBus fileChangeEventBus,ImmutableSet<String> excludeDirectories,WatchService watchService) throws IOException {
  this.filesystem=Preconditions.checkNotNull(filesystem);
  this.ignoredPrefixes=Preconditions.checkNotNull(excludeDirectories);
  this.eventBus=Preconditions.checkNotNull(fileChangeEventBus);
  this.watchService=Preconditions.checkNotNull(watchService);
  this.keys=Maps.newHashMap();
  registerAll(filesystem.getRootPath());
}

Fixed version (ground truth):
public ProjectFilesystemWatcher(ProjectFilesystem filesystem,EventBus fileChangeEventBus,ImmutableSet<Path> excludeDirectories,WatchService watchService) throws IOException {
  this.filesystem=Preconditions.checkNotNull(filesystem);
  this.ignoredPrefixes=Preconditions.checkNotNull(excludeDirectories);
  this.eventBus=Preconditions.checkNotNull(fileChangeEventBus);
  this.watchService=Preconditions.checkNotNull(watchService);
  this.keys=Maps.newHashMap();
  registerAll(filesystem.getRootPath());
}
Program: 53287
Project: 53287
Buggy source:
@Test public void testIgnorePaths() throws IOException {
  ProjectFilesystem filesystem=EasyMock.createMock(ProjectFilesystem.class);
  EasyMock.expect(filesystem.getPathRelativizer()).andReturn(IdentityPathRelativizer.getIdentityRelativizer()).times(2);
  BuildTargetParser parser=EasyMock.createMock(BuildTargetParser.class);
  EasyMock.replay(filesystem,parser);
  Reader reader=new StringReader(Joiner.on('\n').join("String_Node_Str","String_Node_Str"));
  BuckConfig config=BuckConfig.createFromReader(reader,filesystem,parser,Platform.detect());
  ImmutableSet<String> ignorePaths=config.getIgnorePaths();
  assertEquals("String_Node_Str",ignorePaths,ImmutableSet.of(BuckConstant.BUCK_OUTPUT_DIRECTORY,"String_Node_Str",System.getProperty(BuckConfig.BUCK_BUCKD_DIR_KEY,"String_Node_Str"),config.getCacheDir().toString(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  EasyMock.verify(filesystem,parser);
}

Fixed version (ground truth):
@Test public void testIgnorePaths() throws IOException {
  ProjectFilesystem filesystem=EasyMock.createMock(ProjectFilesystem.class);
  EasyMock.expect(filesystem.getPathRelativizer()).andReturn(IdentityPathRelativizer.getIdentityRelativizer()).times(2);
  BuildTargetParser parser=EasyMock.createMock(BuildTargetParser.class);
  EasyMock.replay(filesystem,parser);
  Reader reader=new StringReader(Joiner.on('\n').join("String_Node_Str","String_Node_Str"));
  BuckConfig config=BuckConfig.createFromReader(reader,filesystem,parser,Platform.detect());
  ImmutableSet<Path> ignorePaths=config.getIgnorePaths();
  assertEquals("String_Node_Str",ignorePaths,MorePaths.asPaths(ImmutableSet.of(BuckConstant.BUCK_OUTPUT_DIRECTORY,"String_Node_Str",System.getProperty(BuckConfig.BUCK_BUCKD_DIR_KEY,"String_Node_Str"),config.getCacheDir().toString(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str")));
  EasyMock.verify(filesystem,parser);
}
Program: 53288
Project: 53288
Buggy source:
@Test public void testIgnorePathsWithAbsoluteCacheDir() throws IOException {
  ProjectFilesystem filesystem=EasyMock.createMock(ProjectFilesystem.class);
  BuildTargetParser parser=EasyMock.createMock(BuildTargetParser.class);
  EasyMock.replay(filesystem,parser);
  Reader reader=new StringReader(Joiner.on('\n').join("String_Node_Str","String_Node_Str"));
  BuckConfig config=BuckConfig.createFromReader(reader,filesystem,parser,Platform.detect());
  ImmutableSet<String> ignorePaths=config.getIgnorePaths();
  assertFalse("String_Node_Str",ignorePaths.contains("String_Node_Str"));
  EasyMock.verify(filesystem,parser);
}

Fixed version (ground truth):
@Test public void testIgnorePathsWithAbsoluteCacheDir() throws IOException {
  ProjectFilesystem filesystem=EasyMock.createMock(ProjectFilesystem.class);
  BuildTargetParser parser=EasyMock.createMock(BuildTargetParser.class);
  EasyMock.replay(filesystem,parser);
  Reader reader=new StringReader(Joiner.on('\n').join("String_Node_Str","String_Node_Str"));
  BuckConfig config=BuckConfig.createFromReader(reader,filesystem,parser,Platform.detect());
  ImmutableSet<Path> ignorePaths=config.getIgnorePaths();
  assertFalse("String_Node_Str",ignorePaths.contains("String_Node_Str"));
  EasyMock.verify(filesystem,parser);
}
Program: 53289
Project: 53289
Buggy source:
@Test public void testIgnorePathsWithRelativeCacheDir() throws IOException {
  ProjectFilesystem filesystem=EasyMock.createMock(ProjectFilesystem.class);
  EasyMock.expect(filesystem.getPathRelativizer()).andReturn(IdentityPathRelativizer.getIdentityRelativizer());
  BuildTargetParser parser=EasyMock.createMock(BuildTargetParser.class);
  EasyMock.replay(filesystem,parser);
  Reader reader=new StringReader(Joiner.on('\n').join("String_Node_Str","String_Node_Str"));
  BuckConfig config=BuckConfig.createFromReader(reader,filesystem,parser,Platform.detect());
  ImmutableSet<String> ignorePaths=config.getIgnorePaths();
  assertTrue("String_Node_Str",ignorePaths.contains("String_Node_Str"));
  EasyMock.verify(filesystem,parser);
}

Fixed version (ground truth):
@Test public void testIgnorePathsWithRelativeCacheDir() throws IOException {
  ProjectFilesystem filesystem=EasyMock.createMock(ProjectFilesystem.class);
  EasyMock.expect(filesystem.getPathRelativizer()).andReturn(IdentityPathRelativizer.getIdentityRelativizer());
  BuildTargetParser parser=EasyMock.createMock(BuildTargetParser.class);
  EasyMock.replay(filesystem,parser);
  Reader reader=new StringReader(Joiner.on('\n').join("String_Node_Str","String_Node_Str"));
  BuckConfig config=BuckConfig.createFromReader(reader,filesystem,parser,Platform.detect());
  ImmutableSet<Path> ignorePaths=config.getIgnorePaths();
  assertTrue("String_Node_Str",ignorePaths.contains(Paths.get("String_Node_Str")));
  EasyMock.verify(filesystem,parser);
}
Program: 53290
Project: 53290
Buggy source:
@Test public void testBuckProject() throws IOException {
  ProjectWorkspace workspace=TestDataHelper.createProjectWorkspaceForScenario(this,"String_Node_Str",temporaryFolder);
  workspace.setUp();
  ProcessResult result=workspace.runBuckCommand("String_Node_Str");
  result.assertExitCode("String_Node_Str",0);
  workspace.verify();
  assertEquals("String_Node_Str",Joiner.on('\n').join("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") + '\n',result.getStdout());
  assertThat("String_Node_Str",result.getStderr(),containsString("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testBuckProject() throws IOException {
  ProjectWorkspace workspace=TestDataHelper.createProjectWorkspaceForScenario(this,"String_Node_Str",temporaryFolder);
  workspace.setUp();
  ProcessResult result=workspace.runBuckCommand("String_Node_Str");
  result.assertExitCode("String_Node_Str",0);
  workspace.verify();
  assertEquals("String_Node_Str",Joiner.on('\n').join("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") + '\n',result.getStdout());
  assertThat("String_Node_Str",result.getStderr(),containsString("String_Node_Str"));
}
Program: 53291
Project: 53291
Buggy source:
/** 
 * Create a   {@link Function} that will deobfuscate internal class names for this build.
 * @return the Function.
 */
private Function<String,String> createProguardDeobfuscator(ExecutionContext context) throws IOException {
  if (!proguardMappingFile.isPresent()) {
    return Functions.identity();
  }
  Map<String,String> rawProguardMap=ProguardMapping.readClassMapping(context.getProjectFilesystem().readLines(proguardMappingFile.get()));
  ImmutableMap.Builder<String,String> internalNameBuilder=ImmutableMap.builder();
  for (  Map.Entry<String,String> entry : rawProguardMap.entrySet()) {
    internalNameBuilder.put(entry.getValue().replace('.','/'),entry.getKey().replace('.','/'));
  }
  final Map<String,String> deobfuscator=internalNameBuilder.build();
  return new Function<String,String>(){
    @Nullable @Override public String apply(    @Nullable String input){
      return deobfuscator.get(input);
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Create a   {@link Function} that will deobfuscate internal class names for this build.
 * @return the Function.
 */
private Function<String,String> createProguardDeobfuscator(ExecutionContext context) throws IOException {
  if (!proguardMappingFile.isPresent()) {
    return Functions.identity();
  }
  ProjectFilesystem projectFilesystem=context.getProjectFilesystem();
  Path pathToProguardMappingFile=proguardMappingFile.get();
  if (!projectFilesystem.exists(pathToProguardMappingFile.toString())) {
    return Functions.identity();
  }
  List<String> lines=projectFilesystem.readLines(pathToProguardMappingFile);
  Map<String,String> rawProguardMap=ProguardMapping.readClassMapping(lines);
  ImmutableMap.Builder<String,String> internalNameBuilder=ImmutableMap.builder();
  for (  Map.Entry<String,String> entry : rawProguardMap.entrySet()) {
    internalNameBuilder.put(entry.getValue().replace('.','/'),entry.getKey().replace('.','/'));
  }
  final Map<String,String> deobfuscator=internalNameBuilder.build();
  return new Function<String,String>(){
    @Nullable @Override public String apply(    @Nullable String input){
      return deobfuscator.get(input);
    }
  }
;
}
Program: 53294
Project: 53294
Buggy source:
private BuildContext createBuildContext(DefaultJavaLibraryRule javaLibrary,@Nullable String bootclasspath,@Nullable ProjectFilesystem projectFilesystem){
  AndroidPlatformTarget platformTarget=EasyMock.createMock(AndroidPlatformTarget.class);
  ImmutableList<Path> bootclasspathEntries=(bootclasspath == null) ? ImmutableList.<Path>of(Paths.get("String_Node_Str")) : ImmutableList.of(Paths.get(bootclasspath));
  EasyMock.expect(platformTarget.getBootclasspathEntries()).andReturn(bootclasspathEntries).anyTimes();
  replay(platformTarget);
  if (projectFilesystem == null) {
    projectFilesystem=EasyMock.createMock(ProjectFilesystem.class);
  }
  return BuildContext.builder().setDependencyGraph(RuleMap.createGraphFromSingleRule(javaLibrary)).setStepRunner(EasyMock.createMock(StepRunner.class)).setProjectFilesystem(projectFilesystem).setArtifactCache(new NoopArtifactCache()).setBuildDependencies(BuildDependencies.TRANSITIVE).setJavaPackageFinder(EasyMock.createMock(JavaPackageFinder.class)).setAndroidBootclasspathForAndroidPlatformTarget(Optional.of(platformTarget)).setEventBus(BuckEventBusFactory.newInstance()).build();
}

Fixed version (ground truth):
private BuildContext createBuildContext(DefaultJavaLibraryRule javaLibrary,@Nullable String bootclasspath,@Nullable ProjectFilesystem projectFilesystem){
  AndroidPlatformTarget platformTarget=EasyMock.createMock(AndroidPlatformTarget.class);
  ImmutableList<Path> bootclasspathEntries=(bootclasspath == null) ? ImmutableList.<Path>of(Paths.get("String_Node_Str")) : ImmutableList.of(Paths.get(bootclasspath));
  expect(platformTarget.getBootclasspathEntries()).andReturn(bootclasspathEntries).anyTimes();
  replay(platformTarget);
  if (projectFilesystem == null) {
    projectFilesystem=EasyMock.createMock(ProjectFilesystem.class);
  }
  return BuildContext.builder().setDependencyGraph(RuleMap.createGraphFromSingleRule(javaLibrary)).setStepRunner(EasyMock.createMock(StepRunner.class)).setProjectFilesystem(projectFilesystem).setArtifactCache(new NoopArtifactCache()).setBuildDependencies(BuildDependencies.TRANSITIVE).setJavaPackageFinder(EasyMock.createMock(JavaPackageFinder.class)).setAndroidBootclasspathForAndroidPlatformTarget(Optional.of(platformTarget)).setEventBus(BuckEventBusFactory.newInstance()).build();
}
Program: 53295
Project: 53295
Buggy source:
private BuildContext createSuggestContext(BuildRuleResolver ruleResolver,BuildDependencies buildDependencies){
  DependencyGraph graph=RuleMap.createGraphFromBuildRules(ruleResolver);
  BuildContext context=EasyMock.createMock(BuildContext.class);
  EasyMock.expect(context.getDependencyGraph()).andReturn(graph).anyTimes();
  EasyMock.expect(context.getBuildDependencies()).andReturn(buildDependencies).anyTimes();
  replay(context);
  return context;
}

Fixed version (ground truth):
private BuildContext createSuggestContext(BuildRuleResolver ruleResolver,BuildDependencies buildDependencies){
  DependencyGraph graph=RuleMap.createGraphFromBuildRules(ruleResolver);
  BuildContext context=EasyMock.createMock(BuildContext.class);
  expect(context.getDependencyGraph()).andReturn(graph).anyTimes();
  expect(context.getBuildDependencies()).andReturn(buildDependencies).anyTimes();
  replay(context);
  return context;
}
Program: 53297
Project: 53297
Buggy source:
private ExitCodeAndStdOut processJsonConfig(File jsonTempFile) throws IOException {
  final ImmutableList<String> args=ImmutableList.of(pythonInterpreter,PATH_TO_INTELLIJ_PY,jsonTempFile.getAbsolutePath());
  ShellStep command=new ShellStep(){
    @Override public String getShortName(){
      return "String_Node_Str";
    }
    @Override protected ImmutableList<String> getShellCommandInternal(    ExecutionContext context){
      return args;
    }
  }
;
  int exitCode=command.execute(executionContext);
  return new ExitCodeAndStdOut(exitCode,command.getStdout());
}

Fixed version (ground truth):
private ExitCodeAndStdOut processJsonConfig(File jsonTempFile) throws IOException {
  final ImmutableList<String> args=ImmutableList.of(pythonInterpreter,PATH_TO_INTELLIJ_PY,jsonTempFile.getAbsolutePath());
  ShellStep command=new ShellStep(){
    @Override public String getShortName(){
      return "String_Node_Str";
    }
    @Override protected ImmutableList<String> getShellCommandInternal(    ExecutionContext context){
      return args;
    }
  }
;
  Console console=executionContext.getConsole();
  Console childConsole=new Console(console.getVerbosity(),console.getStdOut(),console.getStdErr(),Ansi.withoutTty());
  ExecutionContext childContext=ExecutionContext.builder().setExecutionContext(executionContext).setConsole(childConsole).build();
  int exitCode=command.execute(childContext);
  return new ExitCodeAndStdOut(exitCode,command.getStdout());
}
Program: 53298
Project: 53298
Buggy source:
@Override public Set<String> findDrawables(Iterable<String> dirs) throws IOException {
  final ImmutableSet.Builder<String> drawableBuilder=ImmutableSet.builder();
  for (  String dir : dirs) {
    new DirectoryTraversal(new File(dir)){
      @Override public void visit(      File file,      String relativePath){
        if (DRAWABLE_PATH_PATTERN.matcher(relativePath).matches()) {
          drawableBuilder.add(file.getPath());
        }
      }
    }
.traverse();
  }
  return drawableBuilder.build();
}

Fixed version (ground truth):
@Override public Set<String> findDrawables(Iterable<String> dirs) throws IOException {
  final ImmutableSet.Builder<String> drawableBuilder=ImmutableSet.builder();
  for (  String dir : dirs) {
    new DirectoryTraversal(new File(dir)){
      @Override public void visit(      File file,      String relativePath){
        if (DRAWABLE_PATH_PATTERN.matcher(relativePath).matches()) {
          drawableBuilder.add(Paths.normalizePathSeparator(file.getPath()));
        }
      }
    }
.traverse();
  }
  return drawableBuilder.build();
}
Program: 53299
Project: 53299
Buggy source:
@Override public void visit(File file,String relativePath){
  if (DRAWABLE_PATH_PATTERN.matcher(relativePath).matches()) {
    drawableBuilder.add(file.getPath());
  }
}

Fixed version (ground truth):
@Override public void visit(File file,String relativePath){
  if (DRAWABLE_PATH_PATTERN.matcher(relativePath).matches()) {
    drawableBuilder.add(Paths.normalizePathSeparator(file.getPath()));
  }
}
Program: 53300
Project: 53300
Buggy source:
private String getFile(String dir,String qualifier,String filename){
  return new File(dir,String.format("String_Node_Str",qualifier,filename)).getPath();
}

Fixed version (ground truth):
private String getFile(String dir,String qualifier,String filename){
  return Paths.normalizePathSeparator(new File(dir,String.format("String_Node_Str",qualifier,filename)).getPath());
}
Program: 53301
Project: 53301
Buggy source:
@Override public RuleKey.Builder appendToRuleKey(RuleKey.Builder builder) throws IOException {
  ImmutableSortedSet.Builder<String> resFiles=ImmutableSortedSet.naturalOrder();
  addResContents(resFiles);
  ImmutableSortedSet.Builder<String> assetsFiles=ImmutableSortedSet.naturalOrder();
  addAssetsContents(assetsFiles);
  return super.appendToRuleKey(builder).set("String_Node_Str",resFiles.build()).set("String_Node_Str",assetsFiles.build());
}

Fixed version (ground truth):
@Override public RuleKey.Builder appendToRuleKey(RuleKey.Builder builder) throws IOException {
  ImmutableSortedSet.Builder<String> resFiles=ImmutableSortedSet.naturalOrder();
  addResContents(resFiles);
  ImmutableSortedSet.Builder<String> assetsFiles=ImmutableSortedSet.naturalOrder();
  addAssetsContents(assetsFiles);
  return super.appendToRuleKey(builder).set("String_Node_Str",resFiles.build()).set("String_Node_Str",rDotJavaPackage).set("String_Node_Str",assetsFiles.build()).set("String_Node_Str",manifestFile);
}
Program: 53302
Project: 53302
Buggy source:
protected AndroidResourceRule(BuildRuleParams buildRuleParams,@Nullable String res,@Nullable String rDotJavaPackage,@Nullable String assets,@Nullable String manifestFile,DirectoryTraverser directoryTraverser){
  super(buildRuleParams);
  this.directoryTraverser=Preconditions.checkNotNull(directoryTraverser);
  this.res=res;
  this.rDotJavaPackage=rDotJavaPackage;
  this.assets=assets;
  this.manifestFile=manifestFile;
  if (res == null) {
    pathToTextSymbolsDir=null;
    pathToTextSymbolsFile=null;
  }
 else {
    BuildTarget buildTarget=buildRuleParams.getBuildTarget();
    pathToTextSymbolsDir=String.format("String_Node_Str",BuckConstant.BIN_DIR,buildTarget.getBasePathWithSlash(),buildTarget.getShortName());
    pathToTextSymbolsFile=pathToTextSymbolsDir + "String_Node_Str";
  }
}

Fixed version (ground truth):
protected AndroidResourceRule(BuildRuleParams buildRuleParams,@Nullable String res,@Nullable String rDotJavaPackage,@Nullable String assets,@Nullable String manifestFile,DirectoryTraverser directoryTraverser){
  super(buildRuleParams);
  this.directoryTraverser=Preconditions.checkNotNull(directoryTraverser);
  this.res=res;
  this.rDotJavaPackage=rDotJavaPackage;
  this.assets=assets;
  this.manifestFile=manifestFile;
  if (res == null) {
    pathToTextSymbolsDir=null;
    pathToTextSymbolsFile=null;
  }
 else {
    BuildTarget buildTarget=buildRuleParams.getBuildTarget();
    pathToTextSymbolsDir=String.format("String_Node_Str",BuckConstant.GEN_DIR,buildTarget.getBasePathWithSlash(),buildTarget.getShortName());
    pathToTextSymbolsFile=pathToTextSymbolsDir + "String_Node_Str";
  }
}
Program: 53303
Project: 53303
Buggy source:
/** 
 * This will copy the template directory, renaming files named   {@code BUCK.test} to {@code BUCK}in the process. Files whose names end in   {@code .expected} will not be copied.
 */
public void setUp() throws IOException {
  MoreFiles.copyRecursively(templatePath,destPath,BUILD_FILE_RENAME);
  if (Platform.detect() == Platform.WINDOWS) {
    SimpleFileVisitor<Path> copyDirVisitor=new SimpleFileVisitor<Path>(){
      @Override public FileVisitResult visitFile(      Path path,      BasicFileAttributes attrs) throws IOException {
        if (attrs.size() <= 4096) {
          File file=path.toFile();
          String linkTo=Files.toString(file,Charsets.UTF_8);
          File linkToFile=new File(templatePath.toFile(),linkTo);
          if (linkToFile.isFile()) {
            java.nio.file.Files.copy(linkToFile.toPath(),path,StandardCopyOption.REPLACE_EXISTING);
          }
 else           if (linkToFile.isDirectory()) {
            if (!file.delete()) {
              throw new IOException();
            }
            MoreFiles.copyRecursively(linkToFile.toPath(),path);
          }
        }
        return FileVisitResult.CONTINUE;
      }
    }
;
    java.nio.file.Files.walkFileTree(destPath,copyDirVisitor);
  }
  isSetUp=true;
}

Fixed version (ground truth):
/** 
 * This will copy the template directory, renaming files named   {@code BUCK.test} to {@code BUCK}in the process. Files whose names end in   {@code .expected} will not be copied.
 */
public void setUp() throws IOException {
  MoreFiles.copyRecursively(templatePath,destPath,BUILD_FILE_RENAME);
  if (Platform.detect() == Platform.WINDOWS) {
    SimpleFileVisitor<Path> copyDirVisitor=new SimpleFileVisitor<Path>(){
      @Override public FileVisitResult visitFile(      Path path,      BasicFileAttributes attrs) throws IOException {
        if (attrs.size() > 0 && attrs.size() <= 4096) {
          File file=path.toFile();
          String linkTo=Files.toString(file,Charsets.UTF_8);
          File linkToFile=new File(templatePath.toFile(),linkTo);
          if (linkToFile.isFile()) {
            java.nio.file.Files.copy(linkToFile.toPath(),path,StandardCopyOption.REPLACE_EXISTING);
          }
 else           if (linkToFile.isDirectory()) {
            if (!file.delete()) {
              throw new IOException();
            }
            MoreFiles.copyRecursively(linkToFile.toPath(),path);
          }
        }
        return FileVisitResult.CONTINUE;
      }
    }
;
    java.nio.file.Files.walkFileTree(destPath,copyDirVisitor);
  }
  isSetUp=true;
}
Program: 53304
Project: 53304
Buggy source:
/** 
 * TODO(mbolin): Try to eliminate this method.
 * @deprecated {@link AbstractCachingBuildRule#getBuildSteps(BuildContext)} should be producingrelative paths that should be resolved by a  {@link ProjectFilesystem} from an{@link ExecutionContext} rather than from a {@link BuildContext}.
 */
@Deprecated public ProjectFilesystem getProjectFilesystem(){
  return projectFilesystem;
}

Fixed version (ground truth):
/** 
 * TODO(mbolin): Try to eliminate this method.
 * @deprecated {@link Buildable#getBuildSteps(BuildContext)} should be producingrelative paths that should be resolved by a  {@link ProjectFilesystem} from an{@link ExecutionContext} rather than from a {@link BuildContext}.
 */
@Deprecated public ProjectFilesystem getProjectFilesystem(){
  return projectFilesystem;
}
Program: 53305
Project: 53305
Buggy source:
/** 
 * Takes an   {@link Iterable} of {@link SourcePath} objects and filters those that are suitable tobe returned by  {@link AbstractCachingBuildRule#getInputsToCompareToOutput()}.
 */
public static Iterable<String> filterInputsToCompareToOutput(Iterable<? extends SourcePath> sources){
  return Iterables.transform(Iterables.filter(sources,FileSourcePath.class),SourcePath.TO_REFERENCE);
}

Fixed version (ground truth):
/** 
 * Takes an   {@link Iterable} of {@link SourcePath} objects and filters those that are suitable tobe returned by  {@link Buildable#getInputsToCompareToOutput()}.
 */
public static Iterable<String> filterInputsToCompareToOutput(Iterable<? extends SourcePath> sources){
  return Iterables.transform(Iterables.filter(sources,FileSourcePath.class),SourcePath.TO_REFERENCE);
}
Program: 53306
Project: 53306
Buggy source:
/** 
 * Tests the following methods: <ul> <li>  {@link AndroidManifestRule#getType()}<li>  {@link com.facebook.buck.rules.AbstractCachingBuildRule#getInputsToCompareToOutput()}<li>  {@link AndroidManifestRule#getPathToOutputFile()}</ul>
 */
@Test public void testSimpleObserverMethods(){
  AndroidManifestRule androidManifestRule=createSimpleAndroidManifestRule();
  assertEquals("String_Node_Str",androidManifestRule.getType().getName());
  assertEquals(ImmutableList.of("String_Node_Str"),androidManifestRule.getInputsToCompareToOutput());
  assertEquals(BuckConstant.GEN_DIR + "String_Node_Str",androidManifestRule.getPathToOutputFile());
}

Fixed version (ground truth):
/** 
 * Tests the following methods: <ul> <li>  {@link AndroidManifestRule#getType()}<li>  {@link Buildable#getInputsToCompareToOutput()}<li>  {@link AndroidManifestRule#getPathToOutputFile()}</ul>
 */
@Test public void testSimpleObserverMethods(){
  AndroidManifestRule androidManifestRule=createSimpleAndroidManifestRule();
  assertEquals("String_Node_Str",androidManifestRule.getType().getName());
  assertEquals(ImmutableList.of("String_Node_Str"),androidManifestRule.getInputsToCompareToOutput());
  assertEquals(BuckConstant.GEN_DIR + "String_Node_Str",androidManifestRule.getPathToOutputFile());
}
Program: 53307
Project: 53307
Buggy source:
/** 
 * Get the path of the directory to make.
 * @param context
 * @return Path of the directory to make.
 */
public String getPath(ExecutionContext context){
  return context.getProjectFilesystem().getPathRelativizer().apply(pathRelativeToProjectRoot);
}

Fixed version (ground truth):
/** 
 * Get the path of the directory to make.
 * @return Path of the directory to make.
 */
public String getPath(ExecutionContext context){
  return context.getProjectFilesystem().getPathRelativizer().apply(pathRelativeToProjectRoot);
}
Program: 53309
Project: 53309
Buggy source:
@Override protected ImmutableSortedSet<String> getInputsToCompareToOutput(){
  return srcs;
}

Fixed version (ground truth):
@Override protected ImmutableSortedSet<String> getInputsToCompareToOutput(){
  return ImmutableSortedSet.copyOf(srcs);
}
Program: 53310
Project: 53310
Buggy source:
protected Genrule(BuildRuleParams buildRuleParams,List<String> srcs,String cmd,String out,Function<String,String> relativeToAbsolutePathFunction){
  super(buildRuleParams);
  this.srcs=ImmutableSortedSet.<String>naturalOrder().addAll(srcs).build();
  this.cmd=Preconditions.checkNotNull(cmd);
  this.srcsToAbsolutePaths=Maps.toMap(srcs,relativeToAbsolutePathFunction);
  Preconditions.checkNotNull(out);
  this.pathToOutDirectory=String.format("String_Node_Str",BuckConstant.GEN_DIR,buildRuleParams.getBuildTarget().getBasePathWithSlash());
  this.pathToOutFile=String.format("String_Node_Str",pathToOutDirectory,out);
  this.absolutePathToOutFile=relativeToAbsolutePathFunction.apply(this.pathToOutFile);
  this.pathToTmpDirectory=String.format("String_Node_Str",BuckConstant.GEN_DIR,buildRuleParams.getBuildTarget().getBasePathWithSlash(),getBuildTarget().getShortName());
  this.absolutePathToTmpDirectory=relativeToAbsolutePathFunction.apply(pathToTmpDirectory);
  this.pathToSrcDirectory=String.format("String_Node_Str",BuckConstant.GEN_DIR,buildRuleParams.getBuildTarget().getBasePathWithSlash(),getBuildTarget().getShortName());
  this.absolutePathToSrcDirectory=relativeToAbsolutePathFunction.apply(pathToSrcDirectory);
  this.relativeToAbsolutePathFunction=relativeToAbsolutePathFunction;
}

Fixed version (ground truth):
protected Genrule(BuildRuleParams buildRuleParams,List<String> srcs,String cmd,String out,Function<String,String> relativeToAbsolutePathFunction){
  super(buildRuleParams);
  this.srcs=ImmutableList.copyOf(srcs);
  this.cmd=Preconditions.checkNotNull(cmd);
  this.srcsToAbsolutePaths=Maps.toMap(srcs,relativeToAbsolutePathFunction);
  Preconditions.checkNotNull(out);
  this.pathToOutDirectory=String.format("String_Node_Str",BuckConstant.GEN_DIR,buildRuleParams.getBuildTarget().getBasePathWithSlash());
  this.pathToOutFile=String.format("String_Node_Str",pathToOutDirectory,out);
  this.absolutePathToOutFile=relativeToAbsolutePathFunction.apply(this.pathToOutFile);
  this.pathToTmpDirectory=String.format("String_Node_Str",BuckConstant.GEN_DIR,buildRuleParams.getBuildTarget().getBasePathWithSlash(),getBuildTarget().getShortName());
  this.absolutePathToTmpDirectory=relativeToAbsolutePathFunction.apply(pathToTmpDirectory);
  this.pathToSrcDirectory=String.format("String_Node_Str",BuckConstant.GEN_DIR,buildRuleParams.getBuildTarget().getBasePathWithSlash(),getBuildTarget().getShortName());
  this.absolutePathToSrcDirectory=relativeToAbsolutePathFunction.apply(pathToSrcDirectory);
  this.relativeToAbsolutePathFunction=relativeToAbsolutePathFunction;
}
Program: 53311
Project: 53311
Buggy source:
@Override public boolean hasUncachedDescendants(final BuildContext context) throws IOException {
  if (hasUncachedDescendants.isSet()) {
    return hasUncachedDescendants.asBoolean();
  }
  if (!isCached(context)) {
    hasUncachedDescendants=TriState.TRUE;
  }
 else {
    boolean depHasUncachedDescendant=false;
    for (    BuildRule dep : getDeps()) {
      if (dep.hasUncachedDescendants(context)) {
        depHasUncachedDescendant=true;
        break;
      }
    }
    hasUncachedDescendants=TriState.forBooleanValue(depHasUncachedDescendant);
  }
  return hasUncachedDescendants.asBoolean();
}

Fixed version (ground truth):
@Override public boolean hasUncachedDescendants(final BuildContext context) throws IOException {
  if (hasUncachedDescendants.isSet()) {
    return hasUncachedDescendants.asBoolean();
  }
  if (!isCached(context)) {
    hasUncachedDescendants=TriState.TRUE;
  }
 else {
    hasUncachedDescendants=TriState.forBooleanValue(!getDepsWithUncachedDescendants(context).isEmpty());
  }
  return hasUncachedDescendants.asBoolean();
}
Program: 53313
Project: 53313
Buggy source:
@Test public void whenBuildFinishesThenBuildSuccessEventFired() throws ExecutionException, InterruptedException {
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  CachingBuildRuleParams params=new CachingBuildRuleParams(target,ImmutableSortedSet.<BuildRule>of(),ImmutableSet.of(BuildTargetPattern.MATCH_ALL),artifactCache);
  StepRunner stepRunner=createNiceMock(StepRunner.class);
  expect(stepRunner.getListeningExecutorService()).andStubReturn(MoreExecutors.sameThreadExecutor());
  JavaPackageFinder packageFinder=createNiceMock(JavaPackageFinder.class);
  replay(stepRunner,packageFinder);
  EventBus bus=new EventBus();
  Listener listener=new Listener();
  bus.register(listener);
  DummyRule rule=new DummyRule(params,false,false);
  File root=new File("String_Node_Str");
  BuildContext context=BuildContext.builder().setEventBus(bus).setProjectRoot(root).setDependencyGraph(createMock(DependencyGraph.class)).setProjectFilesystem(new ProjectFilesystem(root)).setCommandRunner(stepRunner).setJavaPackageFinder(packageFinder).build();
  ListenableFuture<BuildRuleSuccess> build=rule.build(context);
  build.get();
  assertSeenEventsContain(ImmutableList.<BuildEvent>of(BuildEvents.started(rule),BuildEvents.finished(rule,SUCCESS,MISS)),listener.getSeen());
}

Fixed version (ground truth):
@Test public void whenBuildFinishesThenBuildSuccessEventFired() throws ExecutionException, InterruptedException {
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  CachingBuildRuleParams params=new CachingBuildRuleParams(target,ImmutableSortedSet.<BuildRule>of(),ImmutableSet.of(BuildTargetPattern.MATCH_ALL),artifactCache);
  StepRunner stepRunner=createNiceMock(StepRunner.class);
  expect(stepRunner.getListeningExecutorService()).andStubReturn(MoreExecutors.sameThreadExecutor());
  JavaPackageFinder packageFinder=createNiceMock(JavaPackageFinder.class);
  replay(stepRunner,packageFinder);
  EventBus bus=new EventBus();
  Listener listener=new Listener();
  bus.register(listener);
  DummyRule rule=new DummyRule(params,false,false,false);
  File root=new File("String_Node_Str");
  BuildContext context=BuildContext.builder().setEventBus(bus).setProjectRoot(root).setDependencyGraph(createMock(DependencyGraph.class)).setProjectFilesystem(new ProjectFilesystem(root)).setCommandRunner(stepRunner).setJavaPackageFinder(packageFinder).build();
  ListenableFuture<BuildRuleSuccess> build=rule.build(context);
  build.get();
  assertSeenEventsContain(ImmutableList.<BuildEvent>of(BuildEvents.started(rule),BuildEvents.finished(rule,SUCCESS,MISS)),listener.getSeen());
}
Program: 53314
Project: 53314
Buggy source:
protected DummyRule(CachingBuildRuleParams cachingBuildRuleParams,boolean isCached,boolean cacheDetonates){
  super(cachingBuildRuleParams);
  cached=isCached;
  this.cacheDetonates=cacheDetonates;
}

Fixed version (ground truth):
protected DummyRule(CachingBuildRuleParams cachingBuildRuleParams,boolean isCached,boolean cacheDetonates,boolean hasUncachedDescendants){
  super(cachingBuildRuleParams);
  cached=isCached;
  this.cacheDetonates=cacheDetonates;
  this.hasUncachedDescendants=hasUncachedDescendants;
  deps=Sets.newHashSet();
}
Program: 53315
Project: 53315
Buggy source:
@Test @SuppressWarnings("String_Node_Str") public void whenCacheRaisesExceptionThenBuildFailEventFired() throws ExecutionException, InterruptedException {
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  CachingBuildRuleParams params=new CachingBuildRuleParams(target,ImmutableSortedSet.<BuildRule>of(),ImmutableSet.of(BuildTargetPattern.MATCH_ALL),artifactCache);
  StepRunner stepRunner=createNiceMock(StepRunner.class);
  expect(stepRunner.getListeningExecutorService()).andStubReturn(MoreExecutors.sameThreadExecutor());
  JavaPackageFinder packageFinder=createNiceMock(JavaPackageFinder.class);
  replay(stepRunner,packageFinder);
  EventBus bus=new EventBus();
  Listener listener=new Listener();
  bus.register(listener);
  DummyRule rule=new DummyRule(params,false,true);
  File root=new File("String_Node_Str");
  BuildContext context=BuildContext.builder().setEventBus(bus).setProjectRoot(root).setDependencyGraph(createMock(DependencyGraph.class)).setProjectFilesystem(new ProjectFilesystem(root)).setCommandRunner(stepRunner).setJavaPackageFinder(packageFinder).build();
  ListenableFuture<BuildRuleSuccess> build=rule.build(context);
  try {
    build.get();
    fail("String_Node_Str");
  }
 catch (  ExecutionException ignored) {
  }
  assertSeenEventsContain(ImmutableList.<BuildEvent>of(BuildEvents.started(rule),BuildEvents.finished(rule,FAIL,MISS)),listener.getSeen());
}

Fixed version (ground truth):
@Test @SuppressWarnings("String_Node_Str") public void whenCacheRaisesExceptionThenBuildFailEventFired() throws ExecutionException, InterruptedException {
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  CachingBuildRuleParams params=new CachingBuildRuleParams(target,ImmutableSortedSet.<BuildRule>of(),ImmutableSet.of(BuildTargetPattern.MATCH_ALL),artifactCache);
  StepRunner stepRunner=createNiceMock(StepRunner.class);
  expect(stepRunner.getListeningExecutorService()).andStubReturn(MoreExecutors.sameThreadExecutor());
  JavaPackageFinder packageFinder=createNiceMock(JavaPackageFinder.class);
  replay(stepRunner,packageFinder);
  EventBus bus=new EventBus();
  Listener listener=new Listener();
  bus.register(listener);
  DummyRule rule=new DummyRule(params,false,true,false);
  File root=new File("String_Node_Str");
  BuildContext context=BuildContext.builder().setEventBus(bus).setProjectRoot(root).setDependencyGraph(createMock(DependencyGraph.class)).setProjectFilesystem(new ProjectFilesystem(root)).setCommandRunner(stepRunner).setJavaPackageFinder(packageFinder).build();
  ListenableFuture<BuildRuleSuccess> build=rule.build(context);
  try {
    build.get();
    fail("String_Node_Str");
  }
 catch (  ExecutionException ignored) {
  }
  assertSeenEventsContain(ImmutableList.<BuildEvent>of(BuildEvents.started(rule),BuildEvents.finished(rule,FAIL,MISS)),listener.getSeen());
}
Program: 53316
Project: 53316
Buggy source:
@Test public void whenBuildResultCachedThenBuildCachedEventFired() throws ExecutionException, InterruptedException {
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  CachingBuildRuleParams params=new CachingBuildRuleParams(target,ImmutableSortedSet.<BuildRule>of(),ImmutableSet.of(BuildTargetPattern.MATCH_ALL),artifactCache);
  StepRunner stepRunner=createNiceMock(StepRunner.class);
  expect(stepRunner.getListeningExecutorService()).andStubReturn(MoreExecutors.sameThreadExecutor());
  JavaPackageFinder packageFinder=createNiceMock(JavaPackageFinder.class);
  replay(stepRunner,packageFinder);
  EventBus bus=new EventBus();
  Listener listener=new Listener();
  bus.register(listener);
  DummyRule rule=new DummyRule(params,true,false);
  File root=new File("String_Node_Str");
  BuildContext context=BuildContext.builder().setEventBus(bus).setProjectRoot(root).setDependencyGraph(createMock(DependencyGraph.class)).setProjectFilesystem(new ProjectFilesystem(root)).setCommandRunner(stepRunner).setJavaPackageFinder(packageFinder).build();
  ListenableFuture<BuildRuleSuccess> build=rule.build(context);
  build.get();
  assertSeenEventsContain(ImmutableList.<BuildEvent>of(BuildEvents.started(rule),BuildEvents.finished(rule,SUCCESS,HIT)),listener.getSeen());
}

Fixed version (ground truth):
@Test public void whenBuildResultCachedThenBuildCachedEventFired() throws ExecutionException, InterruptedException {
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  CachingBuildRuleParams params=new CachingBuildRuleParams(target,ImmutableSortedSet.<BuildRule>of(),ImmutableSet.of(BuildTargetPattern.MATCH_ALL),artifactCache);
  StepRunner stepRunner=createNiceMock(StepRunner.class);
  expect(stepRunner.getListeningExecutorService()).andStubReturn(MoreExecutors.sameThreadExecutor());
  JavaPackageFinder packageFinder=createNiceMock(JavaPackageFinder.class);
  replay(stepRunner,packageFinder);
  EventBus bus=new EventBus();
  Listener listener=new Listener();
  bus.register(listener);
  DummyRule rule=new DummyRule(params,true,false,false);
  File root=new File("String_Node_Str");
  BuildContext context=BuildContext.builder().setEventBus(bus).setProjectRoot(root).setDependencyGraph(createMock(DependencyGraph.class)).setProjectFilesystem(new ProjectFilesystem(root)).setCommandRunner(stepRunner).setJavaPackageFinder(packageFinder).build();
  ListenableFuture<BuildRuleSuccess> build=rule.build(context);
  build.get();
  assertSeenEventsContain(ImmutableList.<BuildEvent>of(BuildEvents.started(rule),BuildEvents.finished(rule,SUCCESS,HIT)),listener.getSeen());
}
Program: 53317
Project: 53317
Buggy source:
public DependencyGraph parseBuildFilesForTargets(Iterable<BuildTarget> buildTargets,Iterable<String> defaultIncludes) throws IOException, NoSuchBuildTargetException {
  if (!parserWasPopulatedViaParseRawRules) {
    Set<File> buildTargetFiles=Sets.newHashSet();
    for (    BuildTarget buildTarget : buildTargets) {
      File buildFile=buildTarget.getBuildFile();
      boolean isNewElement=buildTargetFiles.add(buildFile);
      if (isNewElement) {
        parseBuildFile(buildFile,defaultIncludes);
      }
    }
  }
  DependencyGraph graph=findAllTransitiveDependencies(buildTargets,defaultIncludes);
  Tracer.addComment("String_Node_Str");
  return graph;
}

Fixed version (ground truth):
public DependencyGraph parseBuildFilesForTargets(Iterable<BuildTarget> buildTargets,Iterable<String> defaultIncludes) throws IOException, NoSuchBuildTargetException {
  if (!parserWasPopulatedViaParseRawRules) {
    Set<File> buildTargetFiles=Sets.newHashSet();
    for (    BuildTarget buildTarget : buildTargets) {
      File buildFile=buildTarget.getBuildFile();
      boolean isNewElement=buildTargetFiles.add(buildFile);
      if (isNewElement) {
        parseBuildFile(buildFile,defaultIncludes);
      }
      if (!knownBuildTargets.containsKey(buildTarget.getFullyQualifiedName())) {
        throw NoSuchBuildTargetException.createForMissingBuildRule(buildTarget);
      }
    }
  }
  DependencyGraph graph=findAllTransitiveDependencies(buildTargets,defaultIncludes);
  Tracer.addComment("String_Node_Str");
  return graph;
}