Program: 52901
Project: 52901
Buggy source:
@Test public void testCompilationDatabase() throws IOException {
  ProjectWorkspace workspace=TestDataHelper.createProjectWorkspaceForScenario(this,"String_Node_Str",tmp);
  workspace.setUp();
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  ProjectFilesystem filesystem=new FakeProjectFilesystem();
  Path compilationDatabase=workspace.buildAndReturnOutput(target.getFullyQualifiedName());
  Path rootPath=tmp.getRoot();
  assertEquals(BuildTargets.getGenPath(filesystem,target,"String_Node_Str"),rootPath.relativize(compilationDatabase));
  Path binaryHeaderSymlinkTreeFolder=BuildTargets.getGenPath(filesystem,target.withFlavors(InternalFlavor.of("String_Node_Str"),CxxDescriptionEnhancer.HEADER_SYMLINK_TREE_FLAVOR),"String_Node_Str");
  Map<String,CxxCompilationDatabaseEntry> fileToEntry=CxxCompilationDatabaseUtils.parseCompilationDatabaseJsonFile(compilationDatabase);
  assertEquals(1,fileToEntry.size());
  String path=sandboxSources ? "String_Node_Str" : "String_Node_Str";
  BuildTarget compilationTarget=target.withFlavors(InternalFlavor.of("String_Node_Str"),InternalFlavor.of("String_Node_Str" + sanitize("String_Node_Str")));
  assertHasEntry(fileToEntry,path,new ImmutableList.Builder<String>().add(COMPILER_PATH).add("String_Node_Str").add(headerSymlinkTreePath(binaryHeaderSymlinkTreeFolder).toString()).addAll(getExtraFlagsForHeaderMaps(filesystem)).addAll(COMPILER_SPECIFIC_FLAGS).add("String_Node_Str").add("String_Node_Str").addAll(sandboxSources ? ImmutableList.of("String_Node_Str") : ImmutableList.of()).add("String_Node_Str" + rootPath + "String_Node_Str").addAll(MORE_COMPILER_SPECIFIC_FLAGS).add("String_Node_Str").add("String_Node_Str").add("String_Node_Str").add(BuildTargets.getGenPath(filesystem,compilationTarget,"String_Node_Str").toString()).add(Paths.get(path).toString()).add("String_Node_Str").add(BuildTargets.getGenPath(filesystem,compilationTarget,"String_Node_Str").toString()).build());
}

Fixed version (ground truth):
@Test public void testCompilationDatabase() throws IOException {
  ProjectWorkspace workspace=TestDataHelper.createProjectWorkspaceForScenario(this,"String_Node_Str",tmp);
  workspace.setUp();
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  ProjectFilesystem filesystem=new FakeProjectFilesystem();
  Path compilationDatabase=workspace.buildAndReturnOutput(target.getFullyQualifiedName());
  Path rootPath=tmp.getRoot();
  assertEquals(BuildTargets.getGenPath(filesystem,target,"String_Node_Str"),rootPath.relativize(compilationDatabase));
  Path binaryHeaderSymlinkTreeFolder=BuildTargets.getGenPath(filesystem,target.withFlavors(InternalFlavor.of("String_Node_Str"),CxxDescriptionEnhancer.HEADER_SYMLINK_TREE_FLAVOR),"String_Node_Str");
  Map<String,CxxCompilationDatabaseEntry> fileToEntry=CxxCompilationDatabaseUtils.parseCompilationDatabaseJsonFile(compilationDatabase);
  assertEquals(1,fileToEntry.size());
  String path=sandboxSources ? "String_Node_Str" : "String_Node_Str";
  BuildTarget compilationTarget=target.withFlavors(InternalFlavor.of("String_Node_Str"),InternalFlavor.of("String_Node_Str" + sanitize("String_Node_Str")));
  assertHasEntry(fileToEntry,path,new ImmutableList.Builder<String>().add(COMPILER_PATH).add("String_Node_Str").add(headerSymlinkTreePath(binaryHeaderSymlinkTreeFolder).toString()).addAll(getExtraFlagsForHeaderMaps(filesystem)).addAll(COMPILER_SPECIFIC_FLAGS).add("String_Node_Str").add("String_Node_Str").addAll(sandboxSources && Platform.detect() == Platform.MACOS ? ImmutableList.of("String_Node_Str") : ImmutableList.of()).add("String_Node_Str" + rootPath + "String_Node_Str").addAll(MORE_COMPILER_SPECIFIC_FLAGS).add("String_Node_Str").add("String_Node_Str").add("String_Node_Str").add(BuildTargets.getGenPath(filesystem,compilationTarget,"String_Node_Str").toString()).add(Paths.get(path).toString()).add("String_Node_Str").add(BuildTargets.getGenPath(filesystem,compilationTarget,"String_Node_Str").toString()).build());
}