nus-yam/ex-repair huggingface dataset:
Program: 158535
Project: 158535
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Spell spell=game.getStack().getSpell(targetPointer.getFirst(game,source));
  if (spell != null) {
    String chooseMessage="String_Node_Str";
    for (    UUID playerId : game.getState().getPlayersInRange(source.getControllerId(),game)) {
      if (!playerId.equals(spell.getControllerId())) {
        Player player=game.getPlayer(playerId);
        if (player.chooseUse(Outcome.Copy,chooseMessage,source,game)) {
          Spell copy=spell.copySpell(source.getControllerId());
          ;
          game.getStack().push(copy);
          copy.chooseNewTargets(game,playerId);
        }
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Spell spell=game.getStack().getSpell(targetPointer.getFirst(game,source));
  if (spell != null) {
    String chooseMessage="String_Node_Str";
    for (    UUID playerId : game.getState().getPlayersInRange(source.getControllerId(),game)) {
      if (!playerId.equals(spell.getControllerId())) {
        Player player=game.getPlayer(playerId);
        if (player.chooseUse(Outcome.Copy,chooseMessage,source,game)) {
          Spell copy=spell.copySpell(source.getControllerId());
          game.getStack().push(copy);
          copy.chooseNewTargets(game,playerId);
        }
      }
    }
    return true;
  }
  return false;
}
Program: 158536
Project: 158536
Buggy source:
public void update(UserData userData){
  this.groupId=userData.groupId;
  this.avatarId=userData.avatarId;
  this.showAbilityPickerForced=userData.showAbilityPickerForced;
  this.allowRequestShowHandCards=userData.allowRequestShowHandCards;
  this.userSkipPrioritySteps=userData.userSkipPrioritySteps;
  this.confirmEmptyManaPool=userData.confirmEmptyManaPool;
  this.flagName=userData.flagName;
  this.askMoveToGraveOrder=userData.askMoveToGraveOrder;
  this.manaPoolAutomatic=userData.manaPoolAutomatic;
  this.manaPoolAutomaticRestricted=userData.manaPoolAutomaticRestricted;
  this.passPriorityCast=userData.passPriorityCast;
  this.passPriorityActivation=userData.passPriorityActivation;
  this.autoOrderTrigger=userData.autoOrderTrigger;
  this.useFirstManaAbility=useFirstManaAbility;
}

Fixed version (ground truth):
public void update(UserData userData){
  this.groupId=userData.groupId;
  this.avatarId=userData.avatarId;
  this.showAbilityPickerForced=userData.showAbilityPickerForced;
  this.allowRequestShowHandCards=userData.allowRequestShowHandCards;
  this.userSkipPrioritySteps=userData.userSkipPrioritySteps;
  this.confirmEmptyManaPool=userData.confirmEmptyManaPool;
  this.flagName=userData.flagName;
  this.askMoveToGraveOrder=userData.askMoveToGraveOrder;
  this.manaPoolAutomatic=userData.manaPoolAutomatic;
  this.manaPoolAutomaticRestricted=userData.manaPoolAutomaticRestricted;
  this.passPriorityCast=userData.passPriorityCast;
  this.passPriorityActivation=userData.passPriorityActivation;
  this.autoOrderTrigger=userData.autoOrderTrigger;
  this.useFirstManaAbility=userData.useFirstManaAbility;
}
Program: 158537
Project: 158537
Buggy source:
@Override public UlvenwaldMysteries copy(){
  return new UlvenwaldMysteries(this);
}

Fixed version (ground truth):
@Override public UlvenwaldMysteriesTriggeredAbility copy(){
  return new UlvenwaldMysteriesTriggeredAbility(this);
}
Program: 158538
Project: 158538
Buggy source:
@Override public FleetingMemories copy(){
  return new FleetingMemories(this);
}

Fixed version (ground truth):
@Override public FleetingMemoriesTriggeredAbility copy(){
  return new FleetingMemoriesTriggeredAbility(this);
}
Program: 158539
Project: 158539
Buggy source:
@Override public GrafMole copy(){
  return new GrafMole(this);
}

Fixed version (ground truth):
@Override public GrafMoleTriggeredAbility copy(){
  return new GrafMoleTriggeredAbility(this);
}
Program: 158540
Project: 158540
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    if (controller.chooseUse(Outcome.BoostCreature,"String_Node_Str",source,game)) {
      int costX=controller.announceXMana(0,Integer.MAX_VALUE,"String_Node_Str",game,source);
      Cost cost=new GenericManaCost(costX);
      if (cost.pay(source,game,source.getSourceId(),source.getControllerId(),false,null)) {
        FilterCard filter=new FilterCard("String_Node_Str" + costX);
        filter.add(new SubtypePredicate("String_Node_Str"));
        filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal,costX));
        TargetCardInYourGraveyard target=new TargetCardInYourGraveyard(filter);
        if (controller.chooseTarget(outcome,target,source,game)) {
          Card card=game.getCard(target.getFirstTarget());
          if (card != null) {
            controller.moveCards(card,Zone.BATTLEFIELD,source,game);
          }
        }
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    if (controller.chooseUse(Outcome.BoostCreature,"String_Node_Str",source,game)) {
      int costX=controller.announceXMana(0,Integer.MAX_VALUE,"String_Node_Str",game,source);
      Cost cost=new GenericManaCost(costX);
      if (cost.pay(source,game,source.getSourceId(),source.getControllerId(),false,null)) {
        FilterCard filter=new FilterCard("String_Node_Str" + costX);
        filter.add(new SubtypePredicate("String_Node_Str"));
        filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal,costX));
        filter.add(new AnotherCardPredicate());
        TargetCardInYourGraveyard target=new TargetCardInYourGraveyard(filter);
        if (controller.chooseTarget(outcome,target,source,game)) {
          Card card=game.getCard(target.getFirstTarget());
          if (card != null) {
            controller.moveCards(card,Zone.BATTLEFIELD,source,game);
          }
        }
      }
    }
    return true;
  }
  return false;
}
Program: 158541
Project: 158541
Buggy source:
@Override public void init(Ability source,Game game){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    int maxToughness=2;
    ManaCosts manaCosts=source.getManaCostsToPay();
    if (!manaCosts.getVariableCosts().isEmpty()) {
      maxToughness=source.getManaCostsToPay().getX();
    }
    Permanent permanent=game.getPermanent(getTargetPointer().getFirst(game,source));
    if (permanent != null && permanent.getToughness().getValue() <= maxToughness) {
      this.discard();
      return;
    }
  }
  super.init(source,game);
}

Fixed version (ground truth):
@Override public void init(Ability source,Game game){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    int maxToughness=2;
    ManaCosts manaCosts=source.getManaCostsToPay();
    if (!manaCosts.getVariableCosts().isEmpty()) {
      maxToughness=source.getManaCostsToPay().getX();
    }
    Permanent permanent=game.getPermanent(getTargetPointer().getFirst(game,source));
    if (permanent != null && permanent.getToughness().getValue() > maxToughness) {
      this.discard();
      return;
    }
  }
  super.init(source,game);
}
Program: 158542
Project: 158542
Buggy source:
@Override public boolean apply(Game game,Ability source){
  PermanentsSacrificedWatcher watcher=(PermanentsSacrificedWatcher)game.getState().getWatchers().get(PermanentsSacrificedWatcher.class.getName());
  if (watcher != null) {
    List<Permanent> sacrificedPermanents=watcher.getThisTurnSacrificedPermanents(source.getControllerId());
    if (!sacrificedPermanents.isEmpty()) {
      int amountOfClues=0;
      for (      Permanent permanent : sacrificedPermanents) {
        if (permanent.getSubtype().contains("String_Node_Str")) {
          amountOfClues++;
        }
      }
      return amountOfClues > 2;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  PermanentsSacrificedWatcher watcher=(PermanentsSacrificedWatcher)game.getState().getWatchers().get(PermanentsSacrificedWatcher.class.getName());
  if (watcher != null) {
    List<Permanent> sacrificedPermanents=watcher.getThisTurnSacrificedPermanents(source.getControllerId());
    if (sacrificedPermanents != null && !sacrificedPermanents.isEmpty()) {
      int amountOfClues=0;
      for (      Permanent permanent : sacrificedPermanents) {
        if (permanent.getSubtype().contains("String_Node_Str")) {
          amountOfClues++;
        }
      }
      return amountOfClues > 2;
    }
  }
  return false;
}
Program: 158543
Project: 158543
Buggy source:
@Override public void watch(GameEvent event,Game game){
  if (event.getType() == EventType.COUNTERED) {
    StackObject stackObject=game.getStack().getStackObject(event.getTargetId());
    if (stackObject == null) {
      stackObject=(StackObject)game.getLastKnownInformation(event.getTargetId(),Zone.STACK);
    }
    if (stackObject != null && !players.contains(stackObject.getControllerId()) && stackObject.getCardType().contains(CardType.CREATURE)) {
      StackObject counterObject=game.getStack().getStackObject(event.getSourceId());
      if (counterObject == null) {
        counterObject=(StackObject)game.getLastKnownInformation(event.getSourceId(),Zone.STACK);
      }
      if (counterObject != null && game.getOpponents(stackObject.getControllerId()).contains(counterObject.getControllerId())) {
        players.add(stackObject.getControllerId());
      }
    }
  }
}

Fixed version (ground truth):
@Override public void watch(GameEvent event,Game game){
  if (event.getType() == EventType.COUNTERED) {
    StackObject conteredSpell=game.getStack().getStackObject(event.getTargetId());
    if (conteredSpell == null) {
      conteredSpell=(StackObject)game.getLastKnownInformation(event.getTargetId(),Zone.STACK);
    }
    if (conteredSpell != null && conteredSpell instanceof Spell && !players.contains(conteredSpell.getControllerId()) && conteredSpell.getCardType().contains(CardType.CREATURE)) {
      StackObject counteringStackObject=game.getStack().getStackObject(event.getSourceId());
      if (counteringStackObject == null) {
        counteringStackObject=(StackObject)game.getLastKnownInformation(event.getSourceId(),Zone.STACK);
      }
      if (counteringStackObject != null && game.getOpponents(conteredSpell.getControllerId()).contains(counteringStackObject.getControllerId())) {
        players.add(conteredSpell.getControllerId());
      }
    }
  }
}
Program: 158544
Project: 158544
Buggy source:
/** 
 * Voice of Resurgence creates it's token under owner's control upon death even when it is controlled by an opponent when it dies. Happened with Treachery.
 */
@Test public void testDiesTriggeredAbility(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",5);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  addCard(Zone.HAND,playerB,"String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str","String_Node_Str");
  castSpell(1,PhaseStep.POSTCOMBAT_MAIN,playerB,"String_Node_Str","String_Node_Str");
  setStopAt(1,PhaseStep.END_TURN);
  execute();
  assertLife(playerA,20);
  assertLife(playerB,20);
  assertGraveyardCount(playerA,"String_Node_Str",1);
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertPermanentCount(playerA,"String_Node_Str",1);
  assertPowerToughness(playerA,"String_Node_Str",2,2);
  assertTappedCount("String_Node_Str",true,0);
}

Fixed version (ground truth):
/** 
 * Voice of Resurgence creates it's token under owner's control upon death even when it is controlled by an opponent when it dies. Happened with Treachery.
 */
@Test public void testDiesTriggeredAbility(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",5);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  addCard(Zone.HAND,playerB,"String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str","String_Node_Str");
  castSpell(1,PhaseStep.POSTCOMBAT_MAIN,playerB,"String_Node_Str","String_Node_Str");
  setStopAt(1,PhaseStep.END_TURN);
  execute();
  assertLife(playerA,20);
  assertLife(playerB,20);
  assertGraveyardCount(playerA,"String_Node_Str",1);
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertPermanentCount(playerA,"String_Node_Str",2);
  assertPowerToughness(playerA,"String_Node_Str",3,3,Filter.ComparisonScope.All);
  assertTappedCount("String_Node_Str",true,0);
}
Program: 158545
Project: 158545
Buggy source:
public List<Choice> getUnchosen(){
  List<Choice> unchosen=new ArrayList<Choice>();
  for (  Choice choice : this) {
    if (!choice.isChosen()) {
      unchosen.add(choice);
    }
  }
  return unchosen;
}

Fixed version (ground truth):
public List<Choice> getUnchosen(){
  List<Choice> unchosen=new ArrayList<>();
  for (  Choice choice : this) {
    if (!choice.isChosen()) {
      unchosen.add(choice);
    }
  }
  return unchosen;
}
Program: 158546
Project: 158546
Buggy source:
/** 
 * Uses card.moveToZone and posts a inform message about moving the card to graveyard into the game log
 * @param card
 * @param sourceId
 * @param game
 * @param fromZone if null, this info isn't postet
 * @param toTop to the top of the library else to the bottom
 * @param withName show the card name in the log
 * @return
 */
boolean moveCardToLibraryWithInfo(Card card,UUID sourceId,Game game,Zone fromZone,boolean toTop,boolean withName);

Fixed version (ground truth):
/** 
 * Uses card.moveToZone and posts a inform message about moving the card to library into the game log
 * @param card
 * @param sourceId
 * @param game
 * @param fromZone if null, this info isn't postet
 * @param toTop to the top of the library else to the bottom
 * @param withName show the card name in the log
 * @return
 */
boolean moveCardToLibraryWithInfo(Card card,UUID sourceId,Game game,Zone fromZone,boolean toTop,boolean withName);
Program: 158547
Project: 158547
Buggy source:
MultipliedValue(final MultipliedValue dynamicValue){
  this.value=dynamicValue.value.copy();
  this.multplier=dynamicValue.multplier;
}

Fixed version (ground truth):
MultipliedValue(final MultipliedValue dynamicValue){
  this.value=dynamicValue.value.copy();
  this.multiplier=dynamicValue.multiplier;
}
Program: 158548
Project: 158548
Buggy source:
@Override public String toString(){
  StringBuilder sb=new StringBuilder();
  if (multplier == 2) {
    sb.append("String_Node_Str");
  }
 else {
    sb.append(multplier).append("String_Node_Str");
  }
  return sb.append(value.toString()).toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder sb=new StringBuilder();
  if (multiplier == 2) {
    sb.append("String_Node_Str");
  }
 else {
    sb.append(multiplier).append("String_Node_Str");
  }
  return sb.append(value.toString()).toString();
}
Program: 158549
Project: 158549
Buggy source:
@Override public int calculate(Game game,Ability sourceAbility,Effect effect){
  return multplier * value.calculate(game,sourceAbility,effect);
}

Fixed version (ground truth):
@Override public int calculate(Game game,Ability sourceAbility,Effect effect){
  return multiplier * value.calculate(game,sourceAbility,effect);
}
Program: 158550
Project: 158550
Buggy source:
@Override public String getMessage(){
  return "String_Node_Str" + amount;
}

Fixed version (ground truth):
@Override public String getMessage(){
  return "String_Node_Str" + amount + "String_Node_Str"+ amount+ "String_Node_Str"+ amount+ "String_Node_Str";
}
Program: 158551
Project: 158551
Buggy source:
@Override public int calculate(Game game,Ability sourceAbility,Effect effect){
  int count=0;
  for (  CombatGroup combatGroup : game.getCombat().getGroups()) {
    if (combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
      int blockers=combatGroup.getBlockers().size();
      return blockers > 1 ? (blockers - 1) * amount : 0;
    }
  }
  return 0;
}

Fixed version (ground truth):
@Override public int calculate(Game game,Ability sourceAbility,Effect effect){
  for (  CombatGroup combatGroup : game.getCombat().getGroups()) {
    if (combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
      int blockers=combatGroup.getBlockers().size();
      return blockers > 1 ? (blockers - 1) * amount : 0;
    }
  }
  return 0;
}
Program: 158552
Project: 158552
Buggy source:
/** 
 * Reported bug: When Breaker of Armies is granted Menace and there is only 1 valid blocker, the game enters a state that cannot be continued. He must be blocked by all creatures that are able, however, with menace the only valid blocks would be by more than one creature, so the expected behavior is no blocks can be made.
 */
@Ignore @Test public void testBreakerOfArmiesWithMenace(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",8);
  addCard(Zone.HAND,playerA,"String_Node_Str",1);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str","String_Node_Str");
  attack(1,playerA,"String_Node_Str");
  block(1,playerB,"String_Node_Str","String_Node_Str");
  setStopAt(1,PhaseStep.POSTCOMBAT_MAIN);
  execute();
  assertPermanentCount(playerA,"String_Node_Str",1);
  assertLife(playerB,10);
}

Fixed version (ground truth):
/** 
 * Reported bug: When Breaker of Armies is granted Menace and there is only 1 valid blocker, the game enters a state that cannot be continued. He must be blocked by all creatures that are able, however, with menace the only valid blocks would be by more than one creature, so the expected behavior is no blocks can be made.
 */
@Test public void testBreakerOfArmiesWithMenace(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",8);
  addCard(Zone.HAND,playerA,"String_Node_Str",1);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str","String_Node_Str");
  attack(1,playerA,"String_Node_Str");
  block(1,playerB,"String_Node_Str","String_Node_Str");
  setStopAt(1,PhaseStep.POSTCOMBAT_MAIN);
  execute();
  assertPermanentCount(playerB,"String_Node_Str",1);
  assertLife(playerB,8);
}
Program: 158554
Project: 158554
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  Permanent permanent=game.getPermanent(source.getSourceId());
  String chosenType="String_Node_Str";
  if (player != null && permanent != null) {
    Choice typeChoice=new ChoiceImpl(true);
    typeChoice.setMessage("String_Node_Str");
    Set<String> types=CardRepository.instance.getCreatureTypes();
    types.remove("String_Node_Str");
    typeChoice.setChoices(types);
    while (!player.choose(Outcome.BoostCreature,typeChoice,game)) {
      if (!player.canRespond()) {
        return false;
      }
    }
    game.informPlayers(permanent.getName() + "String_Node_Str" + player.getLogName()+ "String_Node_Str"+ typeChoice.getChoice());
    chosenType=typeChoice.getChoice();
    if (chosenType != null && !chosenType.isEmpty()) {
      ContinuousEffect effect=new BecomesSubtypeAllEffect(Duration.EndOfTurn,chosenType);
      game.addEffect(effect,source);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  MageObject sourceObject=game.getObject(source.getSourceId());
  String chosenType="String_Node_Str";
  if (player != null && sourceObject != null) {
    Choice typeChoice=new ChoiceImpl(true);
    typeChoice.setMessage("String_Node_Str");
    Set<String> types=CardRepository.instance.getCreatureTypes();
    types.remove("String_Node_Str");
    typeChoice.setChoices(types);
    while (!player.choose(Outcome.BoostCreature,typeChoice,game)) {
      if (!player.canRespond()) {
        return false;
      }
    }
    game.informPlayers(sourceObject.getLogName() + "String_Node_Str" + player.getLogName()+ "String_Node_Str"+ typeChoice.getChoice());
    chosenType=typeChoice.getChoice();
    if (chosenType != null && !chosenType.isEmpty()) {
      ContinuousEffect effect=new BecomesSubtypeAllEffect(Duration.EndOfTurn,chosenType);
      game.addEffect(effect,source);
      return true;
    }
  }
  return false;
}
Program: 158555
Project: 158555
Buggy source:
public void changeGUISize(){
  setGUISize();
  cardGrid.changeGUISize();
}

Fixed version (ground truth):
public void changeGUISize(){
  setGUISize();
  cardGrid.changeGUISize();
  if (currentView instanceof CardGrid) {
    this.currentView.drawCards(sortSetting);
  }
}
Program: 158556
Project: 158556
Buggy source:
@Override public boolean pay(Ability ability,Game game,UUID sourceId,UUID controllerId,boolean noMana,Cost costToPay){
  if (targets.choose(Outcome.Exile,controllerId,sourceId,game)) {
    Player controller=game.getPlayer(controllerId);
    if (controller != null) {
      Card card=controller.getGraveyard().get(targets.getFirstTarget(),game);
      if (card != null && controller.moveCards(card,null,Zone.EXILED,ability,game)) {
        ability.getEffects().get(0).setTargetPointer(new FixedTarget(card.getId()));
        paid=card.getManaCost().pay(ability,game,sourceId,controllerId,noMana);
      }
    }
  }
  return paid;
}

Fixed version (ground truth):
@Override public boolean pay(Ability ability,Game game,UUID sourceId,UUID controllerId,boolean noMana,Cost costToPay){
  if (targets.choose(Outcome.Exile,controllerId,sourceId,game)) {
    Player controller=game.getPlayer(controllerId);
    if (controller != null) {
      Card card=controller.getGraveyard().get(targets.getFirstTarget(),game);
      if (card != null && controller.moveCards(card,Zone.EXILED,ability,game)) {
        ability.getEffects().get(0).setTargetPointer(new FixedTarget(card.getId()));
        paid=card.getManaCost().pay(ability,game,sourceId,controllerId,noMana);
      }
    }
  }
  return paid;
}
Program: 158557
Project: 158557
Buggy source:
@Override public void init(Ability source,Game game){
  super.init(source,game);
  if (!(copyFromObject instanceof Permanent) && (copyFromObject instanceof Card)) {
    this.copyFromObject=new PermanentCard((Card)copyFromObject,source.getControllerId(),game);
  }
  Permanent permanent=game.getPermanent(copyToObjectId);
  if (permanent != null) {
    affectedObjectList.add(new MageObjectReference(permanent,game));
  }
 else   if (source.getAbilityType().equals(AbilityType.STATIC)) {
    permanent=game.getPermanentEntering(copyToObjectId);
    if (permanent != null) {
      copyToPermanent(permanent,game,source);
      affectedObjectList.add(new MageObjectReference(permanent.getId(),game.getState().getZoneChangeCounter(copyToObjectId) + 1,game));
    }
  }
}

Fixed version (ground truth):
@Override public void init(Ability source,Game game){
  super.init(source,game);
  if (!(copyFromObject instanceof Permanent) && (copyFromObject instanceof Card)) {
    this.copyFromObject=new PermanentCard((Card)copyFromObject,source.getControllerId(),game);
  }
  Permanent permanent=game.getPermanent(copyToObjectId);
  if (permanent != null) {
    affectedObjectList.add(new MageObjectReference(permanent,game));
  }
 else   if (source.getAbilityType().equals(AbilityType.STATIC)) {
    permanent=game.getPermanentEntering(copyToObjectId);
    if (permanent != null) {
      copyToPermanent(permanent,game,source);
      int ZCCDiff=1;
      if (permanent instanceof PermanentToken) {
        ZCCDiff=0;
      }
      affectedObjectList.add(new MageObjectReference(permanent.getId(),game.getState().getZoneChangeCounter(copyToObjectId) + ZCCDiff,game));
    }
  }
}
Program: 158558
Project: 158558
Buggy source:
private void btnQuitTournamentActionPerformed(java.awt.event.ActionEvent evt){
  UserRequestMessage message=new UserRequestMessage("String_Node_Str","String_Node_Str");
  message.setButton1("String_Node_Str",null);
  message.setButton2("String_Node_Str",PlayerAction.CLIENT_QUIT_TOURNAMENT);
  MageFrame.getInstance().showUserRequestDialog(message);
}

Fixed version (ground truth):
private void btnQuitTournamentActionPerformed(java.awt.event.ActionEvent evt){
  UserRequestMessage message=new UserRequestMessage("String_Node_Str","String_Node_Str");
  message.setButton1("String_Node_Str",null);
  message.setButton2("String_Node_Str",PlayerAction.CLIENT_QUIT_TOURNAMENT);
  message.setTournamentId(tournamentId);
  MageFrame.getInstance().showUserRequestDialog(message);
}
Program: 158559
Project: 158559
Buggy source:
/** 
 * In a Commander FFA game, I controlled 5 vampires (one of which was Captivating Vampire). My opponent cast Progenitor Mimic, copying Captivating Vampire. I used the ability of my Captivating Vampire to gain control of his Mimic/Vampire but the buff didn't switch control. His other vampire still got the buff even after I gained control of the Mimic/Vampire. Did not get to see if the Mimic/Vampire produced tokens on the right side of the field (my side) as the game ended just after my turn.
 */
@Test public void testChangeControl(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",4);
  addCard(Zone.HAND,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",3);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",3);
  castSpell(2,PhaseStep.PRECOMBAT_MAIN,playerB,"String_Node_Str");
  setChoice(playerB,"String_Node_Str");
  activateAbility(2,PhaseStep.POSTCOMBAT_MAIN,playerA,"String_Node_Str","String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  setStopAt(2,PhaseStep.END_TURN);
  execute();
  assertPermanentCount(playerA,"String_Node_Str",2);
  assertPowerToughness(playerA,"String_Node_Str",3,3,Filter.ComparisonScope.All);
  assertPowerToughness(playerA,"String_Node_Str",4,3,Filter.ComparisonScope.All);
}

Fixed version (ground truth):
/** 
 * In a Commander FFA game, I controlled 5 vampires (one of which was Captivating Vampire). My opponent cast Progenitor Mimic, copying Captivating Vampire. I used the ability of my Captivating Vampire to gain control of his Mimic/Vampire but the buff didn't switch control. His other vampire still got the buff even after I gained control of the Mimic/Vampire. Did not get to see if the Mimic/Vampire produced tokens on the right side of the field (my side) as the game ended just after my turn.
 */
@Test public void testChangeControl(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",4);
  addCard(Zone.HAND,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",3);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",3);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  castSpell(2,PhaseStep.PRECOMBAT_MAIN,playerB,"String_Node_Str");
  setChoice(playerB,"String_Node_Str");
  activateAbility(2,PhaseStep.POSTCOMBAT_MAIN,playerA,"String_Node_Str","String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  setStopAt(2,PhaseStep.END_TURN);
  execute();
  assertPermanentCount(playerA,"String_Node_Str",2);
  assertPowerToughness(playerB,"String_Node_Str",3,1);
  assertPowerToughness(playerA,"String_Node_Str",3,3,Filter.ComparisonScope.All);
  assertPowerToughness(playerA,"String_Node_Str",4,3,Filter.ComparisonScope.All);
}
Program: 158560
Project: 158560
Buggy source:
@Override public boolean checkControlChanged(Game game){
  if (!controllerId.equals(beforeResetControllerId)) {
    this.removeFromCombat(game);
    this.controlledFromStartOfControllerTurn=false;
    this.getAbilities(game).setControllerId(controllerId);
    game.getContinuousEffects().setController(objectId,controllerId);
    game.fireEvent(new GameEvent(EventType.LOST_CONTROL,objectId,objectId,beforeResetControllerId));
    game.fireEvent(new GameEvent(EventType.GAINED_CONTROL,objectId,objectId,controllerId));
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkControlChanged(Game game){
  if (!controllerId.equals(beforeResetControllerId)) {
    this.removeFromCombat(game);
    this.controlledFromStartOfControllerTurn=false;
    this.getAbilities(game).setControllerId(controllerId);
    game.getContinuousEffects().setController(objectId,controllerId);
    game.fireEvent(new GameEvent(EventType.LOST_CONTROL,objectId,objectId,beforeResetControllerId));
    game.fireEvent(new GameEvent(EventType.GAINED_CONTROL,objectId,objectId,controllerId));
    return true;
  }
 else   if (isCopy()) {
    this.getAbilities(game).setControllerId(controllerId);
    game.getContinuousEffects().setController(objectId,controllerId);
  }
  return false;
}
Program: 158562
Project: 158562
Buggy source:
@Override public void watch(GameEvent event,Game game){
  if (step != null && game.getTurn().getStep() != step) {
    spellsCastFromHand.clear();
    step=null;
  }
  if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone().equals(Zone.HAND)) {
    step=game.getTurn().getStep();
    Spell spell=(Spell)game.getObject(event.getTargetId());
    if (this.getSourceId().equals(spell.getSourceId())) {
      condition=true;
    }
  }
}

Fixed version (ground truth):
@Override public void watch(GameEvent event,Game game){
  if (step != null && game.getTurn().getStep() != step) {
    spellsCastFromHand.clear();
    step=null;
  }
  if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone().equals(Zone.HAND)) {
    if (step == null) {
      step=game.getTurn().getStep();
    }
    Spell spell=(Spell)game.getObject(event.getTargetId());
    spellsCastFromHand.add(spell.getSourceId());
  }
}
Program: 158563
Project: 158563
Buggy source:
@Override public boolean apply(Game game,Ability source){
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanentEntering(source.getSourceId());
  int zccDiff=0;
  if (permanent == null) {
    permanent=game.getPermanentOrLKIBattlefield(source.getSourceId());
    zccDiff=-1;
  }
  if (permanent != null) {
    Spell spell=game.getStack().getSpell(source.getSourceId());
    if (spell == null || spell.getZoneChangeCounter(game) != permanent.getZoneChangeCounter(game) + zccDiff) {
      if (game.getLastKnownInformation(source.getSourceId(),Zone.STACK,permanent.getZoneChangeCounter(game) + zccDiff) == null) {
        return false;
      }
    }
    CastFromHandWatcher watcher=(CastFromHandWatcher)game.getState().getWatchers().get(CastFromHandWatcher.class.getName(),source.getSourceId());
    if (watcher != null && watcher.spellWasCastFromHand(source.getSourceId())) {
      return true;
    }
  }
  return false;
}
Program: 158564
Project: 158564
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanentEntering(source.getSourceId());
  int zccDiff=0;
  if (permanent == null) {
    permanent=game.getPermanentOrLKIBattlefield(source.getSourceId());
    zccDiff=-1;
  }
  if (permanent != null) {
    Spell spell=game.getStack().getSpell(source.getSourceId());
    if (spell == null || spell.getZoneChangeCounter(game) != permanent.getZoneChangeCounter(game) + zccDiff) {
      if (game.getLastKnownInformation(source.getSourceId(),Zone.STACK,permanent.getZoneChangeCounter(game) + zccDiff) == null) {
        return false;
      }
    }
    CastFromHandWatcher watcher=(CastFromHandWatcher)game.getState().getWatchers().get(CastFromHandWatcher.class.getName(),source.getSourceId());
    if (watcher != null && watcher.spellWasCastFromHand(source.getSourceId())) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanentEntering(source.getSourceId());
  int zccDiff=0;
  if (permanent == null) {
    permanent=game.getPermanentOrLKIBattlefield(source.getSourceId());
    zccDiff=-1;
  }
  if (permanent != null) {
    Spell spell=game.getStack().getSpell(source.getSourceId());
    if (spell == null || spell.getZoneChangeCounter(game) != permanent.getZoneChangeCounter(game) + zccDiff) {
      if (game.getLastKnownInformation(source.getSourceId(),Zone.STACK,permanent.getZoneChangeCounter(game) + zccDiff) == null) {
        return false;
      }
    }
    CastFromHandWatcher watcher=(CastFromHandWatcher)game.getState().getWatchers().get(CastFromHandWatcher.class.getName());
    if (watcher != null && watcher.spellWasCastFromHand(source.getSourceId())) {
      return true;
    }
  }
  return false;
}
Program: 158565
Project: 158565
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanent(source.getSourceId());
  if (permanent == null) {
    permanent=game.getPermanentEntering(source.getSourceId());
  }
  if (permanent != null) {
    Watcher watcher=game.getState().getWatchers().get("String_Node_Str",source.getSourceId());
    if (watcher != null && watcher.conditionMet()) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanentEntering(source.getSourceId());
  int zccDiff=0;
  if (permanent == null) {
    permanent=game.getPermanentOrLKIBattlefield(source.getSourceId());
    zccDiff=-1;
  }
  if (permanent != null) {
    Spell spell=game.getStack().getSpell(source.getSourceId());
    if (spell == null || spell.getZoneChangeCounter(game) != permanent.getZoneChangeCounter(game) + zccDiff) {
      if (game.getLastKnownInformation(source.getSourceId(),Zone.STACK,permanent.getZoneChangeCounter(game) + zccDiff) == null) {
        return false;
      }
    }
    Watcher watcher=game.getState().getWatchers().get("String_Node_Str",source.getSourceId());
    if (watcher != null && watcher.conditionMet()) {
      return true;
    }
  }
  return false;
}
Program: 158567
Project: 158567
Buggy source:
@Override public boolean apply(Layer layer,SubLayer sublayer,Ability source,Game game){
  Permanent enchantment=game.getPermanent(source.getSourceId());
  if (enchantment != null && enchantment.getAttachedTo() != null) {
    Permanent permanent=game.getPermanent(enchantment.getAttachedTo());
    if (permanent != null) {
switch (layer) {
case AbilityAddingRemovingEffects_6:
        permanent.removeAllAbilities(source.getSourceId(),game);
      for (      String landType : landTypes) {
switch (landType) {
case "String_Node_Str":
          permanent.addAbility(new BlackManaAbility(),source.getSourceId(),game);
        break;
case "String_Node_Str":
      permanent.addAbility(new RedManaAbility(),source.getSourceId(),game);
    break;
case "String_Node_Str":
  permanent.addAbility(new GreenManaAbility(),source.getSourceId(),game);
break;
case "String_Node_Str":
permanent.addAbility(new BlueManaAbility(),source.getSourceId(),game);
break;
case "String_Node_Str":
permanent.addAbility(new WhiteManaAbility(),source.getSourceId(),game);
break;
}
}
break;
case TypeChangingEffects_4:
permanent.getSubtype().removeAll(allLandTypes);
permanent.getSubtype().addAll(landTypes);
break;
}
return true;
}
}
return false;
}

Fixed version (ground truth):
@Override public boolean apply(Layer layer,SubLayer sublayer,Ability source,Game game){
  Permanent enchantment=game.getPermanent(source.getSourceId());
  if (enchantment != null && enchantment.getAttachedTo() != null) {
    Permanent permanent=game.getPermanent(enchantment.getAttachedTo());
    if (permanent != null) {
switch (layer) {
case AbilityAddingRemovingEffects_6:
        permanent.removeAllAbilities(source.getSourceId(),game);
      for (      String landType : landTypes) {
switch (landType) {
case "String_Node_Str":
          if (permanent.getSubtype().contains("String_Node_Str")) {
            permanent.addAbility(new BlackManaAbility(),source.getSourceId(),game);
          }
        break;
case "String_Node_Str":
      if (permanent.getSubtype().contains("String_Node_Str")) {
        permanent.addAbility(new RedManaAbility(),source.getSourceId(),game);
      }
    break;
case "String_Node_Str":
  if (permanent.getSubtype().contains("String_Node_Str")) {
    permanent.addAbility(new GreenManaAbility(),source.getSourceId(),game);
  }
break;
case "String_Node_Str":
if (permanent.getSubtype().contains("String_Node_Str")) {
permanent.addAbility(new BlueManaAbility(),source.getSourceId(),game);
}
break;
case "String_Node_Str":
if (permanent.getSubtype().contains("String_Node_Str")) {
permanent.addAbility(new WhiteManaAbility(),source.getSourceId(),game);
}
break;
}
}
break;
case TypeChangingEffects_4:
permanent.getSubtype().removeAll(allLandTypes);
permanent.getSubtype().addAll(landTypes);
break;
}
return true;
}
}
return false;
}
Program: 158568
Project: 158568
Buggy source:
public List<UUID> getCardList(){
  return new ArrayList(library);
}

Fixed version (ground truth):
public List<UUID> getCardList(){
  return new ArrayList<>(library);
}
Program: 158569
Project: 158569
Buggy source:
@Test public void testWithSurge(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",5);
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str",playerB);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  setStopAt(1,PhaseStep.BEGIN_COMBAT);
  execute();
  assertGraveyardCount(playerA,"String_Node_Str",1);
  assertGraveyardCount(playerA,"String_Node_Str",1);
  assertPermanentCount(playerA,"String_Node_Str",1);
  assertHandCount(playerA,"String_Node_Str",1);
  assertHandCount(playerB,"String_Node_Str",1);
  assertPermanentCount(playerA,7);
  assertLife(playerB,17);
}

Fixed version (ground truth):
@Test public void testWithSurge(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",5);
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str");
  addCard(Zone.HAND,playerB,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",3);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str",playerB);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerB,"String_Node_Str","String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  setStopAt(1,PhaseStep.BEGIN_COMBAT);
  execute();
  assertGraveyardCount(playerA,"String_Node_Str",1);
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertGraveyardCount(playerA,"String_Node_Str",1);
  assertPermanentCount(playerA,"String_Node_Str",1);
  assertPermanentCount(playerB,"String_Node_Str",0);
  assertHandCount(playerA,"String_Node_Str",1);
  assertHandCount(playerB,"String_Node_Str",1);
  assertPermanentCount(playerA,7);
  assertLife(playerB,17);
}
Program: 158570
Project: 158570
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Cards cardsToHand=new CardsImpl();
    for (    Permanent permanent : game.getBattlefield().getActivePermanents(filter,source.getControllerId(),source.getSourceId(),game)) {
      cardsToHand.add(permanent);
    }
    controller.moveCards(cardsToHand,Zone.HAND,source,game);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Set<Card> permanentsToHand=new HashSet<>();
    for (    Permanent permanent : game.getBattlefield().getActivePermanents(filter,source.getControllerId(),source.getSourceId(),game)) {
      permanentsToHand.add(permanent);
    }
    controller.moveCards(permanentsToHand,Zone.HAND,source,game);
    return true;
  }
  return false;
}
Program: 158571
Project: 158571
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  StackObject item=game.getState().getStack().getFirst();
  if (item instanceof StackAbility && ((StackAbility)item).getStackAbility() instanceof CyclingAbility) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (game.getState().getStack().isEmpty()) {
    return false;
  }
  StackObject item=game.getState().getStack().getFirst();
  if (item instanceof StackAbility && ((StackAbility)item).getStackAbility() instanceof CyclingAbility) {
    return true;
  }
  return false;
}
Program: 158572
Project: 158572
Buggy source:
public final void init(PlayerView player,BigCard bigCard,UUID gameId,int priorityTime){
  this.playerPanel.init(gameId,player.getPlayerId(),bigCard,priorityTime);
  this.battlefieldPanel.init(gameId,bigCard);
  this.gameId=gameId;
  if (MageFrame.getSession().isTestMode()) {
    this.playerId=player.getPlayerId();
    this.btnCheat.setVisible(true);
  }
 else {
    this.btnCheat.setVisible(false);
  }
}

Fixed version (ground truth):
public final void init(PlayerView player,BigCard bigCard,UUID gameId,int priorityTime){
  this.playerPanel.init(gameId,player.getPlayerId(),bigCard,priorityTime);
  this.battlefieldPanel.init(gameId,bigCard);
  this.gameId=gameId;
  this.playerId=player.getPlayerId();
  if (MageFrame.getSession().isTestMode()) {
    this.btnCheat.setVisible(true);
  }
 else {
    this.btnCheat.setVisible(false);
  }
}
Program: 158573
Project: 158573
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  UUID targetId=event.getTargetId();
  Permanent permanent=game.getPermanent(targetId);
  if (permanent != null && filter.match(permanent,getSourceId(),getControllerId(),game)) {
    if (!setTargetPointer.equals(SetTargetPointer.NONE)) {
      for (      Effect effect : this.getEffects()) {
switch (setTargetPointer) {
case PERMANENT:
          effect.setTargetPointer(new FixedTarget(event.getTargetId()));
        break;
case PLAYER:
      effect.setTargetPointer(new FixedTarget(permanent.getControllerId()));
    break;
}
}
}
return true;
}
return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  UUID targetId=event.getTargetId();
  Permanent permanent=game.getPermanent(targetId);
  if (permanent != null && filter.match(permanent,getSourceId(),getControllerId(),game)) {
    if (!setTargetPointer.equals(SetTargetPointer.NONE)) {
      for (      Effect effect : this.getEffects()) {
switch (setTargetPointer) {
case PERMANENT:
          effect.setTargetPointer(new FixedTarget(permanent,game));
        break;
case PLAYER:
      effect.setTargetPointer(new FixedTarget(permanent.getControllerId()));
    break;
}
}
}
return true;
}
return false;
}
Program: 158574
Project: 158574
Buggy source:
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt){
  String lastFolder=MageFrame.getPreferences().get("String_Node_Str","String_Node_Str");
  if (!lastFolder.isEmpty()) {
    fcSelectDeck.setCurrentDirectory(new File(lastFolder));
  }
  deck.setName(this.txtDeckName.getText());
  int ret=fcSelectDeck.showSaveDialog(this);
  if (ret == JFileChooser.APPROVE_OPTION) {
    File file=fcSelectDeck.getSelectedFile();
    try {
      String fileName=file.getPath();
      if (!fileName.endsWith("String_Node_Str")) {
        fileName+="String_Node_Str";
      }
      setCursor(new Cursor(Cursor.WAIT_CURSOR));
      Sets.saveDeck(fileName,deck.getDeckCardLists());
    }
 catch (    Exception ex) {
      LOGGER.fatal(ex);
    }
 finally {
      setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
    try {
      MageFrame.getPreferences().put("String_Node_Str",file.getCanonicalPath());
    }
 catch (    IOException ex) {
    }
  }
}

Fixed version (ground truth):
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt){
  String lastFolder=MageFrame.getPreferences().get("String_Node_Str","String_Node_Str");
  if (!lastFolder.isEmpty()) {
    fcSelectDeck.setCurrentDirectory(new File(lastFolder));
  }
  deck.setName(this.txtDeckName.getText());
  int ret=fcSelectDeck.showSaveDialog(this);
  if (ret == JFileChooser.APPROVE_OPTION) {
    File file=fcSelectDeck.getSelectedFile();
    try {
      String fileName=file.getPath();
      if (!fileName.endsWith("String_Node_Str")) {
        fileName+="String_Node_Str";
      }
      setCursor(new Cursor(Cursor.WAIT_CURSOR));
      Sets.saveDeck(fileName,deck.getDeckCardLists());
    }
 catch (    Exception ex) {
      logger.fatal(ex);
    }
 finally {
      setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
    try {
      MageFrame.getPreferences().put("String_Node_Str",file.getCanonicalPath());
    }
 catch (    IOException ex) {
    }
  }
}
Program: 158575
Project: 158575
Buggy source:
@Override protected void done(){
  try {
    get();
  }
 catch (  InterruptedException|ExecutionException ex) {
    LOGGER.fatal("String_Node_Str",ex);
  }
catch (  CancellationException ex) {
  }
}

Fixed version (ground truth):
@Override protected void done(){
  try {
    get();
  }
 catch (  InterruptedException|ExecutionException ex) {
    logger.fatal("String_Node_Str",ex);
  }
catch (  CancellationException ex) {
  }
}
Program: 158576
Project: 158576
Buggy source:
private void btnLoadActionPerformed(java.awt.event.ActionEvent evt){
  String lastFolder=MageFrame.getPreferences().get("String_Node_Str","String_Node_Str");
  if (!lastFolder.isEmpty()) {
    fcSelectDeck.setCurrentDirectory(new File(lastFolder));
  }
  int ret=fcSelectDeck.showOpenDialog(this);
  if (ret == JFileChooser.APPROVE_OPTION) {
    File file=fcSelectDeck.getSelectedFile();
    try {
      setCursor(new Cursor(Cursor.WAIT_CURSOR));
      deck=Deck.load(DeckImporterUtil.importDeck(file.getPath()),true,true);
    }
 catch (    GameException ex) {
      JOptionPane.showMessageDialog(MageFrame.getDesktop(),ex.getMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    }
catch (    Exception ex) {
      LOGGER.fatal(ex);
    }
 finally {
      setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
    refreshDeck();
    try {
      if (file != null) {
        MageFrame.getPreferences().put("String_Node_Str",file.getCanonicalPath());
      }
    }
 catch (    IOException ex) {
    }
  }
  fcSelectDeck.setSelectedFile(null);
}

Fixed version (ground truth):
private void btnLoadActionPerformed(java.awt.event.ActionEvent evt){
  String lastFolder=MageFrame.getPreferences().get("String_Node_Str","String_Node_Str");
  if (!lastFolder.isEmpty()) {
    fcSelectDeck.setCurrentDirectory(new File(lastFolder));
  }
  int ret=fcSelectDeck.showOpenDialog(this);
  if (ret == JFileChooser.APPROVE_OPTION) {
    File file=fcSelectDeck.getSelectedFile();
    try {
      setCursor(new Cursor(Cursor.WAIT_CURSOR));
      deck=Deck.load(DeckImporterUtil.importDeck(file.getPath()),true,true);
    }
 catch (    GameException ex) {
      JOptionPane.showMessageDialog(MageFrame.getDesktop(),ex.getMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    }
catch (    Exception ex) {
      logger.fatal(ex);
    }
 finally {
      setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
    refreshDeck();
    try {
      if (file != null) {
        MageFrame.getPreferences().put("String_Node_Str",file.getCanonicalPath());
      }
    }
 catch (    IOException ex) {
    }
  }
  fcSelectDeck.setSelectedFile(null);
}