nus-yam/ex-repair huggingface dataset:
Program: 52799
Project: 52799
Buggy source:
@Test public void testDepositPlusInterestFirstDay(){
  Client client=new Client();
  Account account=new Account();
  account.addTransaction(new AccountTransaction(Dates.date(2010,Calendar.JANUARY,1),null,AccountTransaction.Type.DEPOSIT,100000));
  account.addTransaction(new AccountTransaction(Dates.date(2010,Calendar.DECEMBER,31),null,AccountTransaction.Type.INTEREST,5000));
  client.addAccount(account);
  ClientPerformanceSnapshot snapshot=new ClientPerformanceSnapshot(client,startDate,endDate);
  EnumMap<CategoryType,Category> result=snapshot.getCategoryMap();
  assertEquals(105000,result.get(CategoryType.INITIAL_VALUE).valuation);
  assertEquals(0,result.get(CategoryType.EARNINGS).valuation);
  assertEquals(105000,result.get(CategoryType.FINAL_VALUE).valuation);
}

Fixed version (ground truth):
@Test public void testDepositPlusInterestFirstDay(){
  Client client=new Client();
  Account account=new Account();
  account.addTransaction(new AccountTransaction(Dates.date(2010,Calendar.JANUARY,1),null,AccountTransaction.Type.DEPOSIT,100000));
  account.addTransaction(new AccountTransaction(Dates.date(2010,Calendar.DECEMBER,31),null,AccountTransaction.Type.INTEREST,5000));
  client.addAccount(account);
  ClientPerformanceSnapshot snapshot=new ClientPerformanceSnapshot(client,startDate,endDate);
  EnumMap<CategoryType,Category> result=snapshot.getCategoryMap();
  assertEquals(105000,result.get(CategoryType.INITIAL_VALUE).getValuation());
  assertEquals(0,result.get(CategoryType.EARNINGS).getValuation());
  assertEquals(105000,result.get(CategoryType.FINAL_VALUE).getValuation());
}
Program: 52800
Project: 52800
Buggy source:
@Test public void testCapitalGainsWithPartialSellDuringReportPeriod(){
  Client client=new Client();
  Security security=new Security();
  security.addPrice(new SecurityPrice(Dates.date(2010,Calendar.JANUARY,1),10000));
  security.addPrice(new SecurityPrice(Dates.date(2011,Calendar.JUNE,1),11000));
  client.addSecurity(security);
  Portfolio portfolio=new Portfolio();
  portfolio.addTransaction(new PortfolioTransaction(Dates.date(2010,Calendar.JANUARY,1),security,PortfolioTransaction.Type.BUY,1000000,100,0));
  portfolio.addTransaction(new PortfolioTransaction(Dates.date(2011,Calendar.JANUARY,15),security,PortfolioTransaction.Type.SELL,100000,9900,0));
  client.addPortfolio(portfolio);
  ClientPerformanceSnapshot snapshot=new ClientPerformanceSnapshot(client,startDate,endDate);
  EnumMap<CategoryType,Category> result=snapshot.getCategoryMap();
  assertEquals(100000,result.get(CategoryType.INITIAL_VALUE).valuation);
  assertEquals(0,result.get(CategoryType.EARNINGS).valuation);
  assertEquals(1000 * 9 + (9900 - 10000),result.get(CategoryType.CAPITAL_GAINS).valuation);
  assertEquals(11000 * 9,result.get(CategoryType.FINAL_VALUE).valuation);
}

Fixed version (ground truth):
@Test public void testCapitalGainsWithPartialSellDuringReportPeriod(){
  Client client=new Client();
  Security security=new Security();
  security.addPrice(new SecurityPrice(Dates.date(2010,Calendar.JANUARY,1),10000));
  security.addPrice(new SecurityPrice(Dates.date(2011,Calendar.JUNE,1),11000));
  client.addSecurity(security);
  Portfolio portfolio=new Portfolio();
  portfolio.addTransaction(new PortfolioTransaction(Dates.date(2010,Calendar.JANUARY,1),security,PortfolioTransaction.Type.BUY,1000000,100,0));
  portfolio.addTransaction(new PortfolioTransaction(Dates.date(2011,Calendar.JANUARY,15),security,PortfolioTransaction.Type.SELL,100000,9900,0));
  client.addPortfolio(portfolio);
  ClientPerformanceSnapshot snapshot=new ClientPerformanceSnapshot(client,startDate,endDate);
  EnumMap<CategoryType,Category> result=snapshot.getCategoryMap();
  assertEquals(100000,result.get(CategoryType.INITIAL_VALUE).getValuation());
  assertEquals(0,result.get(CategoryType.EARNINGS).getValuation());
  assertEquals(1000 * 9 + (9900 - 10000),result.get(CategoryType.CAPITAL_GAINS).getValuation());
  assertEquals(11000 * 9,result.get(CategoryType.FINAL_VALUE).getValuation());
}
Program: 52801
Project: 52801
Buggy source:
@Test public void testCapitalGainsWithPartialSellDuringReportPeriodWithFees(){
  Client client=new Client();
  Security security=new Security();
  security.addPrice(new SecurityPrice(Dates.date(2010,Calendar.JANUARY,1),10000));
  security.addPrice(new SecurityPrice(Dates.date(2011,Calendar.JUNE,1),11000));
  client.addSecurity(security);
  Portfolio portfolio=new Portfolio();
  portfolio.addTransaction(new PortfolioTransaction(Dates.date(2010,Calendar.JANUARY,1),security,PortfolioTransaction.Type.BUY,1000000,100,0));
  portfolio.addTransaction(new PortfolioTransaction(Dates.date(2011,Calendar.JANUARY,15),security,PortfolioTransaction.Type.SELL,100000,9900,1));
  client.addPortfolio(portfolio);
  ClientPerformanceSnapshot snapshot=new ClientPerformanceSnapshot(client,startDate,endDate);
  EnumMap<CategoryType,Category> result=snapshot.getCategoryMap();
  assertEquals(1000 * 9 + (9900 - 10000),result.get(CategoryType.CAPITAL_GAINS).valuation);
}

Fixed version (ground truth):
@Test public void testCapitalGainsWithPartialSellDuringReportPeriodWithFees(){
  Client client=new Client();
  Security security=new Security();
  security.addPrice(new SecurityPrice(Dates.date(2010,Calendar.JANUARY,1),10000));
  security.addPrice(new SecurityPrice(Dates.date(2011,Calendar.JUNE,1),11000));
  client.addSecurity(security);
  Portfolio portfolio=new Portfolio();
  portfolio.addTransaction(new PortfolioTransaction(Dates.date(2010,Calendar.JANUARY,1),security,PortfolioTransaction.Type.BUY,1000000,100,0));
  portfolio.addTransaction(new PortfolioTransaction(Dates.date(2011,Calendar.JANUARY,15),security,PortfolioTransaction.Type.SELL,100000,9900,1));
  client.addPortfolio(portfolio);
  ClientPerformanceSnapshot snapshot=new ClientPerformanceSnapshot(client,startDate,endDate);
  EnumMap<CategoryType,Category> result=snapshot.getCategoryMap();
  assertEquals(1000 * 9 + (9900 - 10000),result.get(CategoryType.CAPITAL_GAINS).getValuation());
}
Program: 52802
Project: 52802
Buggy source:
@Test public void testDepositPlusInterestLastDay(){
  Client client=new Client();
  Account account=new Account();
  account.addTransaction(new AccountTransaction(Dates.date(2010,Calendar.JANUARY,1),null,AccountTransaction.Type.DEPOSIT,100000));
  account.addTransaction(new AccountTransaction(Dates.date(2011,Calendar.DECEMBER,31),null,AccountTransaction.Type.INTEREST,5000));
  client.addAccount(account);
  ClientPerformanceSnapshot snapshot=new ClientPerformanceSnapshot(client,startDate,endDate);
  EnumMap<CategoryType,Category> result=snapshot.getCategoryMap();
  assertEquals(100000,result.get(CategoryType.INITIAL_VALUE).valuation);
  assertEquals(5000,result.get(CategoryType.EARNINGS).valuation);
  assertEquals(0,result.get(CategoryType.CAPITAL_GAINS).valuation);
  assertEquals(105000,result.get(CategoryType.FINAL_VALUE).valuation);
}

Fixed version (ground truth):
@Test public void testDepositPlusInterestLastDay(){
  Client client=new Client();
  Account account=new Account();
  account.addTransaction(new AccountTransaction(Dates.date(2010,Calendar.JANUARY,1),null,AccountTransaction.Type.DEPOSIT,100000));
  account.addTransaction(new AccountTransaction(Dates.date(2011,Calendar.DECEMBER,31),null,AccountTransaction.Type.INTEREST,5000));
  client.addAccount(account);
  ClientPerformanceSnapshot snapshot=new ClientPerformanceSnapshot(client,startDate,endDate);
  EnumMap<CategoryType,Category> result=snapshot.getCategoryMap();
  assertEquals(100000,result.get(CategoryType.INITIAL_VALUE).getValuation());
  assertEquals(5000,result.get(CategoryType.EARNINGS).getValuation());
  assertEquals(0,result.get(CategoryType.CAPITAL_GAINS).getValuation());
  assertEquals(105000,result.get(CategoryType.FINAL_VALUE).getValuation());
}
Program: 52803
Project: 52803
Buggy source:
public Object start(IApplicationContext context) throws Exception {
  Display display=PlatformUI.createDisplay();
  try {
    int returnCode=PlatformUI.createAndRunWorkbench(display,new ApplicationWorkbenchAdvisor());
    if (returnCode == PlatformUI.RETURN_RESTART)     return IApplication.EXIT_RESTART;
 else     return IApplication.EXIT_OK;
  }
  finally {
    display.dispose();
  }
}

Fixed version (ground truth):
public Object start(IApplicationContext context){
  Display display=PlatformUI.createDisplay();
  try {
    int returnCode=PlatformUI.createAndRunWorkbench(display,new ApplicationWorkbenchAdvisor());
    if (returnCode == PlatformUI.RETURN_RESTART)     return IApplication.EXIT_RESTART;
 else     return IApplication.EXIT_OK;
  }
  finally {
    display.dispose();
  }
}
Program: 52804
Project: 52804
Buggy source:
public Object start(IApplicationContext context) throws Exception {
  String[] args=(String[])context.getArguments().get(IApplicationContext.APPLICATION_ARGS);
  if ("String_Node_Str".equals(args[0])) {
    return doExport(args);
  }
 else {
    return error("String_Node_Str");
  }
}

Fixed version (ground truth):
public Object start(IApplicationContext context){
  String[] args=(String[])context.getArguments().get(IApplicationContext.APPLICATION_ARGS);
  if ("String_Node_Str".equals(args[0])) {
    return doExport(args);
  }
 else {
    return error("String_Node_Str");
  }
}
Program: 52806
Project: 52806
Buggy source:
@Override protected void createFormElements(Composite editArea){
  if (!allowSelectionOfSecurity) {
    bindings.createLabel(editArea,((Model)getModel()).getSecurity().getName());
  }
 else {
    bindings.bindComboViewer(editArea,Messages.ColumnSecurity,"String_Node_Str",new LabelProvider(){
      @Override public String getText(      Object element){
        return ((Security)element).getName();
      }
    }
,getModel().getClient().getSecurities().toArray());
  }
  bindings.bindComboViewer(editArea,Messages.ColumnAccount,"String_Node_Str",new LabelProvider(){
    @Override public String getText(    Object element){
      return ((Account)element).getName();
    }
  }
,getModel().getClient().getAccounts().toArray());
  bindings.bindMandatoryAmountInput(editArea,Messages.ColumnAmount,"String_Node_Str");
  bindings.bindDatePicker(editArea,Messages.ColumnDate,"String_Node_Str");
}

Fixed version (ground truth):
@Override protected void createFormElements(Composite editArea){
  if (!allowSelectionOfSecurity) {
    bindings().createLabel(editArea,((Model)getModel()).getSecurity().getName());
  }
 else {
    bindings().bindComboViewer(editArea,Messages.ColumnSecurity,"String_Node_Str",new LabelProvider(){
      @Override public String getText(      Object element){
        return ((Security)element).getName();
      }
    }
,getModel().getClient().getSecurities().toArray());
  }
  bindings().bindComboViewer(editArea,Messages.ColumnAccount,"String_Node_Str",new LabelProvider(){
    @Override public String getText(    Object element){
      return ((Account)element).getName();
    }
  }
,getModel().getClient().getAccounts().toArray());
  bindings().bindMandatoryAmountInput(editArea,Messages.ColumnAmount,"String_Node_Str");
  bindings().bindDatePicker(editArea,Messages.ColumnDate,"String_Node_Str");
}
Program: 52807
Project: 52807
Buggy source:
@Override protected void createFormElements(Composite editArea){
  bindings.bindComboViewer(editArea,Messages.ColumnTransactionType,"String_Node_Str",new LabelProvider(){
    @Override public String getText(    Object element){
      return ((AccountTransaction.Type)element).name();
    }
  }
,EnumSet.of(AccountTransaction.Type.INTEREST,AccountTransaction.Type.DEPOSIT,AccountTransaction.Type.REMOVAL,AccountTransaction.Type.TAXES,AccountTransaction.Type.FEES).toArray());
  bindings.bindMandatoryAmountInput(editArea,Messages.ColumnAmount,"String_Node_Str");
  bindings.bindDatePicker(editArea,Messages.ColumnDate,"String_Node_Str");
}

Fixed version (ground truth):
@Override protected void createFormElements(Composite editArea){
  bindings().bindComboViewer(editArea,Messages.ColumnTransactionType,"String_Node_Str",new LabelProvider(){
    @Override public String getText(    Object element){
      return ((AccountTransaction.Type)element).name();
    }
  }
,EnumSet.of(AccountTransaction.Type.INTEREST,AccountTransaction.Type.DEPOSIT,AccountTransaction.Type.REMOVAL,AccountTransaction.Type.TAXES,AccountTransaction.Type.FEES).toArray());
  bindings().bindMandatoryAmountInput(editArea,Messages.ColumnAmount,"String_Node_Str");
  bindings().bindDatePicker(editArea,Messages.ColumnDate,"String_Node_Str");
}
Program: 52809
Project: 52809
Buggy source:
private Rectangle getSize(Event event,String s){
  int p=s.indexOf(POINT);
  if (p >= 0)   s=s.substring(0,p);
  TextLayout textLayout=getSharedTextLayout(event.display);
  textLayout.setText(s + "String_Node_Str");
  return textLayout.getBounds();
}

Fixed version (ground truth):
private Rectangle getSize(Event event,String text){
  String s=text;
  int p=s.indexOf(POINT);
  if (p >= 0)   s=s.substring(0,p);
  TextLayout textLayout=getSharedTextLayout(event.display);
  textLayout.setText(s + "String_Node_Str");
  return textLayout.getBounds();
}
Program: 52810
Project: 52810
Buggy source:
public static final void attachPageListenerTo(final IWizardContainer c){
  if (c instanceof IPageChangeProvider) {
    ((IPageChangeProvider)c).addPageChangedListener(new IPageChangedListener(){
      AbstractWizardPage currentPage;
      @Override public void pageChanged(      PageChangedEvent event){
        if (currentPage != null)         currentPage.afterPage();
        currentPage=(AbstractWizardPage)event.getSelectedPage();
        currentPage.beforePage();
      }
    }
);
  }
}

Fixed version (ground truth):
public static final void attachPageListenerTo(final IWizardContainer c){
  if (c instanceof IPageChangeProvider) {
    ((IPageChangeProvider)c).addPageChangedListener(new IPageChangedListener(){
      private AbstractWizardPage currentPage;
      @Override public void pageChanged(      PageChangedEvent event){
        if (currentPage != null)         currentPage.afterPage();
        currentPage=(AbstractWizardPage)event.getSelectedPage();
        currentPage.beforePage();
      }
    }
);
  }
}
Program: 52811
Project: 52811
Buggy source:
public TotalsCategory(long valuation){
  super(null,valuation);
  this.valuation=valuation;
}

Fixed version (ground truth):
public TotalsCategory(long valuation){
  super(null,valuation);
  this.setValuation(valuation);
}
Program: 52812
Project: 52812
Buggy source:
public TotalsCategory(long valuation){
  super(null,valuation);
  this.valuation=valuation;
}

Fixed version (ground truth):
public TotalsCategory(long valuation){
  super(null,valuation);
  this.setValuation(valuation);
}
Program: 52813
Project: 52813
Buggy source:
private long asPrice(String s) throws ParseException {
  if ("String_Node_Str".equals(s))   return -1;
  return (long)(FMT_PRICE.parse(s).doubleValue() * 100);
}

Fixed version (ground truth):
private long asPrice(String s) throws ParseException {
  if ("String_Node_Str".equals(s))   return -1;
  return (long)(FMT_PRICE.get().parse(s).doubleValue() * 100);
}
Program: 52814
Project: 52814
Buggy source:
private int asNumber(String s) throws ParseException {
  if ("String_Node_Str".equals(s))   return -1;
  return FMT_PRICE.parse(s).intValue();
}

Fixed version (ground truth):
private int asNumber(String s) throws ParseException {
  if ("String_Node_Str".equals(s))   return -1;
  return FMT_PRICE.get().parse(s).intValue();
}
Program: 52816
Project: 52816
Buggy source:
private Date asDate(String s) throws ParseException {
  if ("String_Node_Str".equals(s))   return null;
  return fmtTradeDate.parse(s);
}

Fixed version (ground truth):
private Date asDate(String s) throws ParseException {
  if ("String_Node_Str".equals(s))   return null;
  return FMT_TRADE_DATET.get().parse(s);
}
Program: 52817
Project: 52817
Buggy source:
private long parseIndex(String text) throws IOException {
  try {
    DecimalFormat fmt=new DecimalFormat("String_Node_Str",new DecimalFormatSymbols(Locale.GERMANY));
    Number q=fmt.parse(text);
    return (long)(q.doubleValue() * 100);
  }
 catch (  ParseException e) {
    throw new IOException(e);
  }
}

Fixed version (ground truth):
private long parseIndex(String text) throws IOException {
  try {
    Number q=FMT_INDEX.get().parse(text);
    return (long)(q.doubleValue() * Values.Quote.factor());
  }
 catch (  ParseException e) {
    throw new IOException(e);
  }
}
Program: 52818
Project: 52818
Buggy source:
public static void pack(Tree tree){
  for (int i=0, n=tree.getColumnCount(); i < n; i++) {
    TreeColumn column=tree.getColumn(i);
    int originalWidth=column.getWidth();
    column.pack();
    int packedWidth=column.getWidth();
    if (packedWidth < originalWidth)     column.setWidth(originalWidth);
  }
  tree.pack();
}

Fixed version (ground truth):
public static void pack(Tree tree){
  for (int i=0, n=tree.getColumnCount(); i < n; i++) {
    TreeColumn column=tree.getColumn(i);
    int originalWidth=getOriginalWidth(column,column.getWidth());
    column.pack();
    int packedWidth=column.getWidth();
    if (packedWidth < originalWidth)     column.setWidth(originalWidth);
  }
  tree.pack();
}
Program: 52819
Project: 52819
Buggy source:
@Override protected void reportingPeriodUpdated(){
  Calendar startDate=Calendar.getInstance();
  startDate.setTime(Dates.today());
  startDate.add(Calendar.YEAR,-getReportingYears());
  startDate.set(Calendar.DAY_OF_MONTH,1);
  startDate.add(Calendar.DATE,-1);
  ClientPerformanceSnapshot snapshot=new ClientPerformanceSnapshot(getClient(),startDate.getTime(),Dates.today());
  calculation.setInput(snapshot);
  calculation.refresh();
  calculation.expandAll();
  ViewerHelper.pack(calculation);
  snapshotStart.setInput(snapshot.getStartClientSnapshot());
  snapshotStart.pack();
  snapshotEnd.setInput(snapshot.getEndClientSnapshot());
  snapshotEnd.pack();
}

Fixed version (ground truth):
@Override protected void reportingPeriodUpdated(){
  Calendar startDate=Calendar.getInstance();
  startDate.setTime(Dates.today());
  startDate.add(Calendar.YEAR,-getReportingYears());
  startDate.set(Calendar.DAY_OF_MONTH,1);
  startDate.add(Calendar.DATE,-1);
  ClientPerformanceSnapshot snapshot=new ClientPerformanceSnapshot(getClient(),startDate.getTime(),Dates.today());
  try {
    calculation.getTree().setRedraw(false);
    calculation.setInput(snapshot);
    calculation.expandAll();
    ViewerHelper.pack(calculation);
    calculation.getTree().getParent().layout();
  }
  finally {
    calculation.getTree().setRedraw(true);
  }
  snapshotStart.setInput(snapshot.getStartClientSnapshot());
  snapshotStart.pack();
  snapshotEnd.setInput(snapshot.getEndClientSnapshot());
  snapshotEnd.pack();
}
Program: 52820
Project: 52820
Buggy source:
private boolean shouldInvalidateParentChain(TargetNode<?,?> targetNode){
  if (lastTargetGraph != null) {
    Optional<TargetNode<?,?>> previousTargetNode=lastTargetGraph.getExactOptional(targetNode.getBuildTarget());
    if (previousTargetNode.isPresent()) {
      Preconditions.checkState(lastActionGraphBuilder.getRuleOptional(targetNode.getBuildTarget()).isPresent());
      if (!targetNode.equals(previousTargetNode.get())) {
        if (LOG.isVerboseEnabled()) {
          LOG.verbose("String_Node_Str",targetNode.getBuildTarget().toString());
        }
        return true;
      }
    }
  }
  if (!targetNode.getDescription().producesCacheableSubgraph()) {
    if (LOG.isVerboseEnabled()) {
      LOG.verbose("String_Node_Str",targetNode.getBuildTarget().toString());
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean shouldInvalidateParentChain(TargetNode<?,?> targetNode){
  if (lastTargetGraph != null) {
    Optional<TargetNode<?,?>> previousTargetNode=lastTargetGraph.getExactOptional(targetNode.getBuildTarget());
    if (previousTargetNode.isPresent()) {
      Preconditions.checkState(lastActionGraphBuilder.getRuleOptional(targetNode.getBuildTarget()).isPresent());
      if (!targetNode.equals(previousTargetNode.get())) {
        if (LOG.isVerboseEnabled()) {
          LOG.verbose("String_Node_Str",targetNode.getBuildTarget().toString());
        }
        return true;
      }
    }
 else {
      return true;
    }
  }
  if (!targetNode.getDescription().producesCacheableSubgraph()) {
    if (LOG.isVerboseEnabled()) {
      LOG.verbose("String_Node_Str",targetNode.getBuildTarget().toString());
    }
    return true;
  }
  return false;
}
Program: 52821
Project: 52821
Buggy source:
private boolean invalidateChangedTargets(TargetNode<?,?> node,TargetGraph targetGraph,Map<BuildTarget,Boolean> explored,Set<UnflavoredBuildTarget> validTargets){
  if (explored.containsKey(node.getBuildTarget())) {
    return explored.get(node.getBuildTarget());
  }
  boolean ancestorInvalidated=false;
  for (  TargetNode<?,?> child : targetGraph.getOutgoingNodesFor(node)) {
    ancestorInvalidated|=invalidateChangedTargets(child,targetGraph,explored,validTargets);
  }
  boolean invalidateParent=false;
  if (ancestorInvalidated || shouldInvalidateParentChain(node)) {
    if (LOG.isVerboseEnabled()) {
      LOG.verbose("String_Node_Str",node.getBuildTarget().toString());
    }
    invalidateParent=true;
  }
 else {
    validTargets.add(node.getBuildTarget().getUnflavoredBuildTarget());
  }
  explored.put(node.getBuildTarget(),invalidateParent);
  return invalidateParent;
}

Fixed version (ground truth):
private boolean invalidateChangedTargets(TargetNode<?,?> node,TargetGraph targetGraph,Map<BuildTarget,Boolean> explored,Set<UnflavoredBuildTarget> invalidTargets){
  if (explored.containsKey(node.getBuildTarget())) {
    return explored.get(node.getBuildTarget());
  }
  boolean ancestorInvalidated=false;
  for (  TargetNode<?,?> child : targetGraph.getOutgoingNodesFor(node)) {
    ancestorInvalidated|=invalidateChangedTargets(child,targetGraph,explored,invalidTargets);
  }
  boolean invalidateParent=false;
  if (ancestorInvalidated || shouldInvalidateParentChain(node)) {
    if (LOG.isVerboseEnabled()) {
      LOG.verbose("String_Node_Str",node.getBuildTarget().toString());
    }
    invalidateParent=true;
    invalidTargets.add(node.getBuildTarget().getUnflavoredBuildTarget());
  }
  explored.put(node.getBuildTarget(),invalidateParent);
  return invalidateParent;
}
Program: 52822
Project: 52822
Buggy source:
/** 
 * Populates the given   {@link ActionGraphBuilder} with the rules from the previously used {@link ActionGraphBuilder} that are deemed usable after checking for invalidations with a target graphwalk.
 */
public void populateActionGraphBuilderWithCachedRules(BuckEventBus eventBus,TargetGraph targetGraph,ActionGraphBuilder graphBuilder){
  int reusedRuleCount=0;
  if (lastActionGraphBuilder != null) {
    Map<BuildTarget,Boolean> explored=new HashMap<>();
    Set<UnflavoredBuildTarget> validTargets=new HashSet<>();
    for (    TargetNode<?,?> root : targetGraph.getNodesWithNoIncomingEdges()) {
      invalidateChangedTargets(root,targetGraph,explored,validTargets);
    }
    reusedRuleCount=addValidRulesToActionGraphBuilder(graphBuilder,validTargets);
    lastActionGraphBuilder.invalidate();
  }
  lastTargetGraph=targetGraph;
  lastActionGraphBuilder=graphBuilder;
  eventBus.post(new ActionGraphEvent.IncrementalLoad(reusedRuleCount));
}

Fixed version (ground truth):
/** 
 * Populates the given   {@link ActionGraphBuilder} with the rules from the previously used {@link ActionGraphBuilder} that are deemed usable after checking for invalidations with a target graphwalk.
 */
public void populateActionGraphBuilderWithCachedRules(BuckEventBus eventBus,TargetGraph targetGraph,ActionGraphBuilder graphBuilder){
  int reusedRuleCount=0;
  if (lastActionGraphBuilder != null) {
    Map<BuildTarget,Boolean> explored=new HashMap<>();
    Set<UnflavoredBuildTarget> invalidTargets=new HashSet<>();
    for (    TargetNode<?,?> root : targetGraph.getNodesWithNoIncomingEdges()) {
      invalidateChangedTargets(root,targetGraph,explored,invalidTargets);
    }
    reusedRuleCount=addValidRulesToActionGraphBuilder(graphBuilder,invalidTargets);
    lastActionGraphBuilder.invalidate();
  }
  lastTargetGraph=targetGraph;
  lastActionGraphBuilder=graphBuilder;
  eventBus.post(new ActionGraphEvent.IncrementalLoad(reusedRuleCount));
}
Program: 52823
Project: 52823
Buggy source:
private int addValidRulesToActionGraphBuilder(ActionGraphBuilder graphBuilder,Set<UnflavoredBuildTarget> validTargets){
  SourcePathRuleFinder ruleFinder=new SourcePathRuleFinder(graphBuilder);
  SourcePathResolver pathResolver=DefaultSourcePathResolver.from(ruleFinder);
  int totalRuleCount=0;
  int reusedRuleCount=0;
  for (  BuildRule buildRule : lastActionGraphBuilder.getBuildRules()) {
    if (validTargets.contains(buildRule.getBuildTarget().getUnflavoredBuildTarget())) {
      graphBuilder.addToIndex(buildRule);
      buildRule.updateBuildRuleResolver(graphBuilder,ruleFinder,pathResolver);
      reusedRuleCount++;
    }
    totalRuleCount++;
  }
  LOG.debug("String_Node_Str",reusedRuleCount,totalRuleCount);
  return reusedRuleCount;
}

Fixed version (ground truth):
private int addValidRulesToActionGraphBuilder(ActionGraphBuilder graphBuilder,Set<UnflavoredBuildTarget> invalidTargets){
  SourcePathRuleFinder ruleFinder=new SourcePathRuleFinder(graphBuilder);
  SourcePathResolver pathResolver=DefaultSourcePathResolver.from(ruleFinder);
  int totalRuleCount=0;
  int reusedRuleCount=0;
  for (  BuildRule buildRule : lastActionGraphBuilder.getBuildRules()) {
    if (!invalidTargets.contains(buildRule.getBuildTarget().getUnflavoredBuildTarget())) {
      graphBuilder.addToIndex(buildRule);
      buildRule.updateBuildRuleResolver(graphBuilder,ruleFinder,pathResolver);
      reusedRuleCount++;
    }
    totalRuleCount++;
  }
  LOG.debug("String_Node_Str",reusedRuleCount,totalRuleCount);
  return reusedRuleCount;
}
Program: 52824
Project: 52824
Buggy source:
private void setUpTargetGraphAndResolver(TargetNode<?,?>... nodes){
  targetGraph=TargetGraphFactory.newInstance(nodes);
  graphBuilder=createActionGraphBuilder(targetGraph);
}

Fixed version (ground truth):
private void setUpTargetGraphAndResolver(TargetNode<?,?>... nodes){
  targetGraph=TargetGraphFactory.newInstanceExact(nodes);
  graphBuilder=createActionGraphBuilder(targetGraph);
}
Program: 52825
Project: 52825
Buggy source:
@Override public void run() throws Throwable {
  for (  String className : testClassNames) {
    if (!shouldIncludeTest(className)) {
      continue;
    }
    Class<?> testClass=Class.forName(className);
    List<TestResult> results;
    if (!mightBeATestClass(testClass)) {
      results=Collections.emptyList();
    }
 else {
      results=new ArrayList<>();
      TestNG testng=new TestNG();
      testng.setUseDefaultListeners(false);
      testng.setAnnotationTransformer(new FilteringAnnotationTransformer(results));
      testng.setTestClasses(new Class<?>[]{testClass});
      testng.addListener(new TestListener(results));
      testng.addListener(new SuiteHTMLReporter());
      testng.addListener((IReporter)new FailedReporter());
      testng.addListener(new XMLReporter());
      testng.addListener(new EmailableReporter());
      testng.addListener(new JUnitReportReporterWithMethodParameters());
      testng.run();
    }
    writeResult(className,results);
  }
}

Fixed version (ground truth):
@Override public void run() throws Throwable {
  for (  String className : testClassNames) {
    Class<?> testClass=Class.forName(className);
    List<TestResult> results;
    if (!mightBeATestClass(testClass)) {
      results=Collections.emptyList();
    }
 else {
      results=new ArrayList<>();
      TestNG testng=new TestNG();
      testng.setUseDefaultListeners(false);
      testng.setAnnotationTransformer(new FilteringAnnotationTransformer(results));
      testng.setTestClasses(new Class<?>[]{testClass});
      testng.addListener(new TestListener(results));
      testng.addListener(new SuiteHTMLReporter());
      testng.addListener((IReporter)new FailedReporter());
      testng.addListener(new XMLReporter());
      testng.addListener(new EmailableReporter());
      testng.addListener(new JUnitReportReporterWithMethodParameters());
      testng.run();
    }
    writeResult(className,results);
  }
}
Program: 52827
Project: 52827
Buggy source:
/** 
 * Given a file at `a/b/c/D.java`, and full name of the class is `b.c.D`, the source root for that file is `a`. Returns empty if either the file could not be parsed or the directory structure does not match the package.
 * @param sourcePath path to the java source file.
 * @return the path to source root.
 */
public Optional<Path> getSourceRootFromSource(Path sourcePath){
  Path normalizedSourcePath=sourcePath.normalize();
  Path sourceDirectoryPath=normalizedSourcePath.getParent();
  return getPackagePathFromSource(normalizedSourcePath).flatMap(packagePath -> sourceDirectoryPath.endsWith(packagePath) ? Optional.of(sourceDirectoryPath.subpath(0,sourceDirectoryPath.getNameCount() - packagePath.getNameCount())) : Optional.empty());
}

Fixed version (ground truth):
/** 
 * Given a file at `a/b/c/D.java`, and full name of the class is `b.c.D`, the source root for that file is `a`. Returns empty if either the file could not be parsed or the directory structure does not match the package.
 * @param sourcePath path to the java source file.
 * @return the path to source root.
 */
public Optional<Path> getSourceRootFromSource(Path sourcePath){
  Path normalizedSourcePath=sourcePath.normalize();
  if (!normalizedSourcePath.toString().endsWith("String_Node_Str")) {
    return Optional.empty();
  }
  Path sourceDirectoryPath=normalizedSourcePath.getParent();
  return getPackagePathFromSource(normalizedSourcePath).flatMap(packagePath -> sourceDirectoryPath.endsWith(packagePath) ? Optional.of(sourceDirectoryPath.subpath(0,sourceDirectoryPath.getNameCount() - packagePath.getNameCount())) : Optional.empty());
}
Program: 52828
Project: 52828
Buggy source:
/** 
 * Blocking call 
 */
private int processFileBuffer(boolean onlyIfBufferIsFull){
  Set<String> hashCodes;
  SettableFuture<Map<String,byte[]>> resultFuture;
synchronized (multiFetchLock) {
    if (onlyIfBufferIsFull && hashCodesToFetch.size() < multiFetchBufferMaxSize) {
      return 0;
    }
    if (hashCodesToFetch.isEmpty()) {
      return 0;
    }
    hashCodes=hashCodesToFetch;
    hashCodesToFetch=new HashSet<>();
    resultFuture=multiFetchFuture;
    multiFetchFuture=SettableFuture.create();
  }
  try {
    LOG.info("String_Node_Str",hashCodes.size(),onlyIfBufferIsFull ? "String_Node_Str" : "String_Node_Str");
    resultFuture.set(service.multiFetchSourceFiles(hashCodes));
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  return hashCodes.size();
}

Fixed version (ground truth):
/** 
 * Blocking call 
 */
private int processFileBuffer(boolean onlyIfBufferIsFull){
  Set<String> hashCodes;
  SettableFuture<Map<String,byte[]>> resultFuture;
synchronized (multiFetchLock) {
    if (onlyIfBufferIsFull && hashCodesToFetch.size() < multiFetchBufferMaxSize) {
      return 0;
    }
    if (hashCodesToFetch.isEmpty()) {
      return 0;
    }
    hashCodes=hashCodesToFetch;
    hashCodesToFetch=new HashSet<>();
    resultFuture=multiFetchFuture;
    multiFetchFuture=SettableFuture.create();
  }
  try {
    LOG.info("String_Node_Str",hashCodes.size(),onlyIfBufferIsFull ? "String_Node_Str" : "String_Node_Str");
    resultFuture.set(service.multiFetchSourceFiles(hashCodes));
  }
 catch (  IOException e) {
    LOG.error(e);
    resultFuture.setException(e);
    return 0;
  }
  return hashCodes.size();
}
Program: 52829
Project: 52829
Buggy source:
private ImmutableList<String> getFlags(String platform,String field,char delim){
  return delegate.getValue(platform,field).isPresent() ? delegate.getListWithoutComments(SECTION + '#' + platform,field,delim) : delegate.getListWithoutComments(SECTION,field,delim);
}

Fixed version (ground truth):
private ImmutableList<String> getFlags(String platform,String field,char delim){
  return delegate.getValue(SECTION + '#' + platform,field).isPresent() ? delegate.getListWithoutComments(SECTION + '#' + platform,field,delim) : delegate.getListWithoutComments(SECTION,field,delim);
}
Program: 52830
Project: 52830
Buggy source:
/** 
 * @return a {@link SourcePath} identified by a {@link Path}. 
 */
public PathSourcePath getPathSourcePath(@PropagatesNullable Path path){
  if (path == null) {
    return null;
  }
  if (path.isAbsolute()) {
    return PathSourcePath.of(projectFilesystem,path);
  }
  return PathSourcePath.of(projectFilesystem,checkPathExists(path.toString(),String.format("String_Node_Str",path)));
}

Fixed version (ground truth):
/** 
 * @return a {@link SourcePath} identified by a {@link Path}. 
 */
public PathSourcePath getPathSourcePath(@PropagatesNullable Path path){
  if (path == null) {
    return null;
  }
  if (path.isAbsolute()) {
    return PathSourcePath.of(projectFilesystem,path);
  }
  return PathSourcePath.of(projectFilesystem,checkPathExists(path.toString(),"String_Node_Str"));
}
Program: 52831
Project: 52831
Buggy source:
@Override public LocationMacro coerce(CellPathResolver cellRoots,ProjectFilesystem filesystem,Path pathRelativeToProjectRoot,ImmutableList<String> args) throws CoerceFailedException {
  if (args.size() != 1) {
    throw new CoerceFailedException(String.format("String_Node_Str",args.size()));
  }
  LocationMacro.SplitResult parts=LocationMacro.splitSupplementaryOutputPart(args.get(0));
  BuildTarget target=buildTargetTypeCoercer.coerce(cellRoots,filesystem,pathRelativeToProjectRoot,parts.target);
  return LocationMacro.of(target,parts.supplementaryOutput);
}

Fixed version (ground truth):
@Override public LocationMacro coerce(CellPathResolver cellRoots,ProjectFilesystem filesystem,Path pathRelativeToProjectRoot,ImmutableList<String> args) throws CoerceFailedException {
  if (args.size() != 1 || args.get(0).isEmpty()) {
    throw new CoerceFailedException(String.format("String_Node_Str",args.size()));
  }
  LocationMacro.SplitResult parts=LocationMacro.splitSupplementaryOutputPart(args.get(0));
  BuildTarget target=buildTargetTypeCoercer.coerce(cellRoots,filesystem,pathRelativeToProjectRoot,parts.target);
  return LocationMacro.of(target,parts.supplementaryOutput);
}
Program: 52832
Project: 52832
Buggy source:
@Override protected LocationMacro parse(BuildTarget target,CellPathResolver cellNames,ImmutableList<String> input) throws MacroException {
  if (input.size() != 1) {
    throw new MacroException(String.format("String_Node_Str",input));
  }
  LocationMacro.SplitResult parts=LocationMacro.splitSupplementaryOutputPart(input.get(0));
  return LocationMacro.of(parseBuildTarget(target,cellNames,ImmutableList.of(parts.target)),parts.supplementaryOutput);
}

Fixed version (ground truth):
@Override protected LocationMacro parse(BuildTarget target,CellPathResolver cellNames,ImmutableList<String> input) throws MacroException {
  if (input.size() != 1 || input.get(0).isEmpty()) {
    throw new MacroException(String.format("String_Node_Str",input));
  }
  LocationMacro.SplitResult parts=LocationMacro.splitSupplementaryOutputPart(input.get(0));
  return LocationMacro.of(parseBuildTarget(target,cellNames,ImmutableList.of(parts.target)),parts.supplementaryOutput);
}
Program: 52833
Project: 52833
Buggy source:
/** 
 * Exposes information about the BuildRule to BuildRules that depend on this BuildRule during action graph construction. If   {@link #hasProviders()} is {@code false}, UnsupportedOperationException will be thrown.
 * @param providerKey the key to the provider desired
 * @param < T > the type of the provider
 * @return the provider of the type desired from this BuildRule
 * @throws MissingProviderException if the required provider is not present
 */
<T extends BuildRuleInfoProvider>T getProvider(T.ProviderKey providerKey) throws MissingProviderException ;

Fixed version (ground truth):
/** 
 * Exposes information about the BuildRule to BuildRules that depend on this BuildRule during action graph construction. If   {@link #hasProviders()} is {@code false}, UnsupportedOperationException will be thrown.
 * @param providerKey the key to the provider desired
 * @param < T > the type of the provider
 * @return the provider of the type desired from this BuildRule
 * @throws MissingProviderException if the required provider is not present
 */
<T extends BuildRuleInfoProvider>T getProvider(BuildRuleInfoProvider.ProviderKey providerKey) throws MissingProviderException ;
Program: 52837
Project: 52837
Buggy source:
private void publishPendingBuildRuleFinishedEvents(){
synchronized (buildRuleFinishedEventsLock) {
    if (pendingBuildRuleFinishedEvent.size() == 0) {
      return;
    }
    LOG.info(String.format("String_Node_Str",pendingBuildRuleFinishedEvent.size()));
    long currentTimestampMillis=clock.currentTimeMillis();
    Iterator<TimestampedEvent<BuildRuleFinishedEvent>> eventsIterator=pendingBuildRuleFinishedEvent.iterator();
    while (eventsIterator.hasNext()) {
      TimestampedEvent<BuildRuleFinishedEvent> timestampedEvent=eventsIterator.next();
      long elapsedMillisSinceEvent=currentTimestampMillis - timestampedEvent.eventTimestampMillis;
      if (elapsedMillisSinceEvent < CACHE_SYNCHRONIZATION_SAFETY_MARGIN_MILLIS) {
        if (allBuildRuleFinishedEventsRecieved) {
          try {
            Thread.sleep(CACHE_SYNCHRONIZATION_SAFETY_MARGIN_MILLIS - elapsedMillisSinceEvent);
          }
 catch (          InterruptedException e) {
            LOG.error(e);
            Thread.currentThread().interrupt();
            return;
          }
        }
 else {
          break;
        }
      }
      String buildTarget=timestampedEvent.event.getBuildTarget();
      remoteBuildRuleCompletionNotifier.signalCompletionOfBuildRule(buildTarget);
      eventsIterator.remove();
    }
  }
}

Fixed version (ground truth):
private void publishPendingBuildRuleFinishedEvents(){
synchronized (buildRuleFinishedEventsLock) {
    if (pendingBuildRuleFinishedEvent.size() == 0) {
      return;
    }
    LOG.info(String.format("String_Node_Str",pendingBuildRuleFinishedEvent.size()));
    Iterator<TimestampedEvent<BuildRuleFinishedEvent>> eventsIterator=pendingBuildRuleFinishedEvent.iterator();
    while (eventsIterator.hasNext()) {
      TimestampedEvent<BuildRuleFinishedEvent> timestampedEvent=eventsIterator.next();
      long elapsedMillisSinceEvent=clock.currentTimeMillis() - timestampedEvent.eventTimestampMillis;
      if (elapsedMillisSinceEvent < CACHE_SYNCHRONIZATION_SAFETY_MARGIN_MILLIS) {
        if (allBuildRuleFinishedEventsRecieved) {
          try {
            long sleepMillis=CACHE_SYNCHRONIZATION_SAFETY_MARGIN_MILLIS - elapsedMillisSinceEvent;
            LOG.info(String.format("String_Node_Str",sleepMillis,timestampedEvent.event.getBuildTarget()));
            Thread.sleep(sleepMillis);
          }
 catch (          InterruptedException e) {
            LOG.error(e);
            Thread.currentThread().interrupt();
            return;
          }
        }
 else {
          break;
        }
      }
      String buildTarget=timestampedEvent.event.getBuildTarget();
      remoteBuildRuleCompletionNotifier.signalCompletionOfBuildRule(buildTarget);
      eventsIterator.remove();
    }
  }
}
Program: 52838
Project: 52838
Buggy source:
/** 
 * @param path Absolute path or path relative to the project root.
 * @return If {@code path} is relative, it is returned. If it is absolute and is inside theproject root, it is relativized to the project root and returned. Otherwise an absent value is returned.
 */
@Override public Optional<Path> getPathRelativeToProjectRoot(Path path){
  path=MorePaths.normalize(path);
  if (path.isAbsolute()) {
    if (path.startsWith(projectRoot)) {
      return Optional.of(MorePaths.relativize(projectRoot,path));
    }
 else {
      return Optional.empty();
    }
  }
 else {
    return Optional.of(path);
  }
}

Fixed version (ground truth):
/** 
 * @param path Absolute path or path relative to the project root.
 * @return If {@code path} is relative, it is returned. If it is absolute and is inside theproject root, it is relativized to the project root and returned. Otherwise an absent value is returned.
 */
@Override public Optional<Path> getPathRelativeToProjectRoot(Path path){
  path=MorePaths.normalize(path);
  if (path.isAbsolute()) {
    Path configuredBuckOut=MorePaths.normalize(projectRoot.resolve(buckPaths.getConfiguredBuckOut()));
    if (path.startsWith(configuredBuckOut) || path.startsWith(projectRoot)) {
      return Optional.of(MorePaths.relativize(projectRoot,path));
    }
 else {
      return Optional.empty();
    }
  }
 else {
    return Optional.of(path);
  }
}
Program: 52839
Project: 52839
Buggy source:
private static BuckPaths getConfiguredBuckPaths(Path rootPath,Config config,Optional<EmbeddedCellBuckOutInfo> embeddedCellBuckOutInfo){
  BuckPaths buckPaths=BuckPaths.createDefaultBuckPaths(rootPath);
  Optional<String> configuredBuckOut=config.getValue("String_Node_Str","String_Node_Str");
  if (embeddedCellBuckOutInfo.isPresent()) {
    Path cellBuckOut=embeddedCellBuckOutInfo.get().getRootCellBuckOut().resolve("String_Node_Str").resolve(embeddedCellBuckOutInfo.get().getCellName());
    buckPaths=buckPaths.withConfiguredBuckOut(rootPath.relativize(cellBuckOut));
  }
 else   if (configuredBuckOut.isPresent()) {
    buckPaths=buckPaths.withConfiguredBuckOut(rootPath.getFileSystem().getPath(configuredBuckOut.get()));
  }
  return buckPaths;
}

Fixed version (ground truth):
private static BuckPaths getConfiguredBuckPaths(Path rootPath,Config config,Optional<EmbeddedCellBuckOutInfo> embeddedCellBuckOutInfo){
  BuckPaths buckPaths=BuckPaths.createDefaultBuckPaths(rootPath);
  Optional<String> configuredBuckOut=config.getValue("String_Node_Str","String_Node_Str");
  if (embeddedCellBuckOutInfo.isPresent()) {
    Path cellBuckOut=embeddedCellBuckOutInfo.get().getEmbeddedCellsBuckOutBaseDir().resolve(embeddedCellBuckOutInfo.get().getCellName());
    buckPaths=buckPaths.withConfiguredBuckOut(rootPath.relativize(cellBuckOut));
  }
 else   if (configuredBuckOut.isPresent()) {
    buckPaths=buckPaths.withConfiguredBuckOut(rootPath.getFileSystem().getPath(configuredBuckOut.get()));
  }
  return buckPaths;
}
Program: 52842
Project: 52842
Buggy source:
protected static Predicate<Path> getDefaultPathPredicate(ProjectFilesystem projectFilesystem){
  return path -> path.startsWith(projectFilesystem.getBuckPaths().getBuckOut()) || projectFilesystem.isIgnored(path);
}

Fixed version (ground truth):
/** 
 * This predicate matches files that might be result of builds or files that are explicitly ignored.
 */
protected static Predicate<Path> getDefaultPathPredicate(ProjectFilesystem projectFilesystem){
  return path -> isInBuckOut(projectFilesystem,path) || isInEmbeddedCellBuckOut(projectFilesystem,path) || projectFilesystem.isIgnored(path);
}
Program: 52843
Project: 52843
Buggy source:
public static DefaultFileHashCache createBuckOutFileHashCache(ProjectFilesystem projectFilesystem,FileHashCacheMode fileHashCacheMode){
  return new DefaultFileHashCache(projectFilesystem,(path) -> !(path.startsWith(projectFilesystem.getBuckPaths().getBuckOut())),fileHashCacheMode);
}

Fixed version (ground truth):
public static DefaultFileHashCache createBuckOutFileHashCache(ProjectFilesystem projectFilesystem,FileHashCacheMode fileHashCacheMode){
  return new DefaultFileHashCache(projectFilesystem,(path) -> !isInBuckOut(projectFilesystem,path),fileHashCacheMode);
}
Program: 52844
Project: 52844
Buggy source:
@Test public void thatBuckoutCacheWillGetIsCorrect() throws IOException, InterruptedException {
  ProjectFilesystem filesystem=TestProjectFilesystems.createProjectFilesystem(tmp.getRoot());
  Path buckOut=filesystem.getBuckPaths().getBuckOut();
  filesystem.mkdirs(buckOut);
  Path buckOutFile=buckOut.resolve("String_Node_Str");
  Path otherFile=Paths.get("String_Node_Str");
  filesystem.writeContentsToPath("String_Node_Str",buckOutFile);
  filesystem.writeContentsToPath("String_Node_Str",otherFile);
  DefaultFileHashCache cache=DefaultFileHashCache.createBuckOutFileHashCache(filesystem,fileHashCacheMode);
  assertTrue(cache.willGet(filesystem.getPath("String_Node_Str")));
  assertFalse(cache.willGet(filesystem.getPath("String_Node_Str")));
}

Fixed version (ground truth):
@Test public void thatBuckoutCacheWillGetIsCorrect() throws IOException, InterruptedException {
  ProjectFilesystem filesystem=TestProjectFilesystems.createProjectFilesystem(tmp.getRoot());
  Path buckOut=filesystem.getBuckPaths().getBuckOut();
  filesystem.mkdirs(buckOut);
  Path buckOutFile=buckOut.resolve("String_Node_Str");
  Path otherFile=Paths.get("String_Node_Str");
  filesystem.writeContentsToPath("String_Node_Str",buckOutFile);
  filesystem.writeContentsToPath("String_Node_Str",otherFile);
  DefaultFileHashCache cache=DefaultFileHashCache.createBuckOutFileHashCache(filesystem,fileHashCacheMode);
  assertTrue(cache.willGet(filesystem.getPath("String_Node_Str")));
  assertFalse(cache.willGet(filesystem.getPath("String_Node_Str")));
  assertFalse(cache.willGet(filesystem.getPath("String_Node_Str")));
}
Program: 52845
Project: 52845
Buggy source:
@Test public void thatNonBuckoutCacheWillGetIsCorrect() throws IOException, InterruptedException {
  ProjectFilesystem filesystem=TestProjectFilesystems.createProjectFilesystem(tmp.getRoot());
  Path buckOut=filesystem.getBuckPaths().getBuckOut();
  filesystem.mkdirs(buckOut);
  Path buckOutFile=buckOut.resolve("String_Node_Str");
  Path otherFile=Paths.get("String_Node_Str");
  filesystem.writeContentsToPath("String_Node_Str",buckOutFile);
  filesystem.writeContentsToPath("String_Node_Str",otherFile);
  DefaultFileHashCache cache=DefaultFileHashCache.createDefaultFileHashCache(filesystem,fileHashCacheMode);
  assertFalse(cache.willGet(filesystem.getPath("String_Node_Str")));
  assertTrue(cache.willGet(filesystem.getPath("String_Node_Str")));
}

Fixed version (ground truth):
@Test public void thatNonBuckoutCacheWillGetIsCorrect() throws IOException, InterruptedException {
  ProjectFilesystem filesystem=TestProjectFilesystems.createProjectFilesystem(tmp.getRoot());
  Path buckOut=filesystem.getBuckPaths().getBuckOut();
  filesystem.mkdirs(buckOut);
  Path buckOutFile=buckOut.resolve("String_Node_Str");
  Path otherFile=Paths.get("String_Node_Str");
  filesystem.writeContentsToPath("String_Node_Str",buckOutFile);
  filesystem.writeContentsToPath("String_Node_Str",otherFile);
  DefaultFileHashCache cache=DefaultFileHashCache.createDefaultFileHashCache(filesystem,fileHashCacheMode);
  assertFalse(cache.willGet(filesystem.getPath("String_Node_Str")));
  assertFalse(cache.willGet(filesystem.getPath("String_Node_Str")));
  assertTrue(cache.willGet(filesystem.getPath("String_Node_Str")));
}
Program: 52847
Project: 52847
Buggy source:
private void writeUmbrellaHeaderIfNeeded(String moduleName,ImmutableSortedSet<Path> headerPaths,Path headerSymlinkTreeRoot) throws IOException {
  ImmutableList<String> headerPathStrings=headerPaths.stream().map(Path::getFileName).map(Path::toString).collect(ImmutableList.toImmutableList());
  if (!headerPaths.contains(moduleName + "String_Node_Str")) {
    projectFilesystem.writeContentsToPath(new UmbrellaHeader(moduleName,headerPathStrings).render(),headerSymlinkTreeRoot.resolve(Paths.get(moduleName,moduleName + "String_Node_Str")));
  }
}

Fixed version (ground truth):
private void writeUmbrellaHeaderIfNeeded(String moduleName,ImmutableSortedSet<Path> headerPaths,Path headerSymlinkTreeRoot) throws IOException {
  ImmutableList<String> headerPathStrings=headerPaths.stream().map(Path::getFileName).map(Path::toString).collect(ImmutableList.toImmutableList());
  if (!headerPathStrings.contains(moduleName + "String_Node_Str")) {
    Path umbrellaPath=headerSymlinkTreeRoot.resolve(Paths.get(moduleName,moduleName + "String_Node_Str"));
    Preconditions.checkState(!projectFilesystem.exists(umbrellaPath));
    projectFilesystem.writeContentsToPath(new UmbrellaHeader(moduleName,headerPathStrings).render(),umbrellaPath);
  }
}