nus-yam/ex-repair huggingface dataset:
Program: 158662
Project: 158662
Buggy source:
public UUID getControllerOfSourceId(UUID sourceId){
  UUID controllerFound=null;
  for (  PreventionEffect effect : preventionEffects) {
    HashSet<Ability> abilities=preventionEffects.getAbility(effect.getId());
    for (    Ability ability : abilities) {
      if (ability.getSourceId().equals(sourceId)) {
        if (controllerFound == null || controllerFound.equals(ability.getControllerId())) {
          controllerFound=ability.getControllerId();
        }
 else {
          return null;
        }
      }
    }
  }
  for (  ReplacementEffect effect : replacementEffects) {
    HashSet<Ability> abilities=replacementEffects.getAbility(effect.getId());
    for (    Ability ability : abilities) {
      if (ability.getSourceId() != null) {
        if (ability.getSourceId().equals(sourceId)) {
          if (controllerFound == null || controllerFound.equals(ability.getControllerId())) {
            controllerFound=ability.getControllerId();
          }
 else {
            return null;
          }
        }
      }
 else {
        logger.warn("String_Node_Str" + ability.getRule());
      }
    }
  }
  return controllerFound;
}

Fixed version (ground truth):
public UUID getControllerOfSourceId(UUID sourceId){
  UUID controllerFound=null;
  for (  PreventionEffect effect : preventionEffects) {
    HashSet<Ability> abilities=preventionEffects.getAbility(effect.getId());
    for (    Ability ability : abilities) {
      if (ability.getSourceId().equals(sourceId)) {
        if (controllerFound == null || controllerFound.equals(ability.getControllerId())) {
          controllerFound=ability.getControllerId();
        }
 else {
          return null;
        }
      }
    }
  }
  for (  ReplacementEffect effect : replacementEffects) {
    HashSet<Ability> abilities=replacementEffects.getAbility(effect.getId());
    for (    Ability ability : abilities) {
      if (ability.getSourceId() != null) {
        if (ability.getSourceId().equals(sourceId)) {
          if (controllerFound == null || controllerFound.equals(ability.getControllerId())) {
            controllerFound=ability.getControllerId();
          }
 else {
            return null;
          }
        }
      }
 else {
        LOGGER.warn("String_Node_Str" + ability.getRule());
      }
    }
  }
  return controllerFound;
}
Program: 158663
Project: 158663
Buggy source:
private void setControllerForEffect(ContinuousEffectsList<?> effects,UUID sourceId,UUID controllerId){
  for (  Effect effect : effects) {
    HashSet<Ability> abilities=effects.getAbility(effect.getId());
    if (abilities != null) {
      for (      Ability ability : abilities) {
        if (ability.getSourceId() != null) {
          if (ability.getSourceId().equals(sourceId)) {
            ability.setControllerId(controllerId);
          }
        }
 else {
          if (!ability.getZone().equals(Zone.COMMAND)) {
            logger.fatal("String_Node_Str" + ability);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void setControllerForEffect(ContinuousEffectsList<?> effects,UUID sourceId,UUID controllerId){
  for (  Effect effect : effects) {
    HashSet<Ability> abilities=effects.getAbility(effect.getId());
    if (abilities != null) {
      for (      Ability ability : abilities) {
        if (ability.getSourceId() != null) {
          if (ability.getSourceId().equals(sourceId)) {
            ability.setControllerId(controllerId);
          }
        }
 else         if (!ability.getZone().equals(Zone.COMMAND)) {
          LOGGER.fatal("String_Node_Str" + ability);
        }
      }
    }
  }
}
Program: 158664
Project: 158664
Buggy source:
public List<ContinuousEffect> getLayeredEffects(Game game){
  List<ContinuousEffect> layerEffects=new ArrayList<>();
  for (  ContinuousEffect effect : layeredEffects) {
switch (effect.getDuration()) {
case WhileOnBattlefield:
case WhileOnStack:
case WhileInGraveyard:
      HashSet<Ability> abilities=layeredEffects.getAbility(effect.getId());
    if (abilities != null) {
      for (      Ability ability : abilities) {
        if (!(ability instanceof StaticAbility) || ability.isInUseableZone(game,null,null)) {
          layerEffects.add(effect);
          break;
        }
      }
    }
 else {
      logger.error("String_Node_Str" + effect.toString());
    }
  break;
default :
layerEffects.add(effect);
}
}
updateTimestamps(layerEffects);
Collections.sort(layerEffects,sorter);
return layerEffects;
}

Fixed version (ground truth):
public List<ContinuousEffect> getLayeredEffects(Game game){
  List<ContinuousEffect> layerEffects=new ArrayList<>();
  for (  ContinuousEffect effect : layeredEffects) {
switch (effect.getDuration()) {
case WhileOnBattlefield:
case WhileOnStack:
case WhileInGraveyard:
      HashSet<Ability> abilities=layeredEffects.getAbility(effect.getId());
    if (abilities != null) {
      for (      Ability ability : abilities) {
        if (!(ability instanceof StaticAbility) || ability.isInUseableZone(game,null,null)) {
          layerEffects.add(effect);
          break;
        }
      }
    }
 else {
      LOGGER.error("String_Node_Str" + effect.toString());
    }
  break;
default :
layerEffects.add(effect);
}
}
updateTimestamps(layerEffects);
Collections.sort(layerEffects,sorter);
return layerEffects;
}
Program: 158665
Project: 158665
Buggy source:
@Override public boolean apply(Game game,Ability source){
  UUID defendingPlayerId=(UUID)getValue("String_Node_Str");
  Player player=null;
  if (defendingPlayerId != null) {
    player=game.getPlayer(defendingPlayerId);
  }
  if (player != null) {
    int amount=Math.min(count,game.getBattlefield().countAll(filter,player.getId(),game));
    Target target=new TargetControlledPermanent(amount,amount,filter,true);
    if (target.canChoose(player.getId(),game)) {
      while (!target.isChosen() && target.canChoose(player.getId(),game) && player.canRespond()) {
        player.choose(Outcome.Sacrifice,target,source.getSourceId(),game);
      }
      for (int idx=0; idx < target.getTargets().size(); idx++) {
        Permanent permanent=game.getPermanent(target.getTargets().get(idx));
        if (permanent != null) {
          permanent.sacrifice(source.getSourceId(),game);
        }
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  UUID defendingPlayerId=(UUID)getValue("String_Node_Str");
  Player player=null;
  if (defendingPlayerId != null) {
    player=game.getPlayer(defendingPlayerId);
  }
  if (player != null) {
    int amount=Math.min(count,game.getBattlefield().countAll(FILTER,player.getId(),game));
    Target target=new TargetControlledPermanent(amount,amount,FILTER,true);
    if (target.canChoose(player.getId(),game)) {
      while (!target.isChosen() && target.canChoose(player.getId(),game) && player.canRespond()) {
        player.choose(Outcome.Sacrifice,target,source.getSourceId(),game);
      }
      for (int idx=0; idx < target.getTargets().size(); idx++) {
        Permanent permanent=game.getPermanent(target.getTargets().get(idx));
        if (permanent != null) {
          permanent.sacrifice(source.getSourceId(),game);
        }
      }
    }
    return true;
  }
  return false;
}
Program: 158666
Project: 158666
Buggy source:
/** 
 * Sets the job's state to   {@link State#ABORTED} and the error to the given exception. Logs a warning with thegiven message and exception.
 * @param message
 * @param error
 */
public void setError(String message,Exception error){
  if (message == null) {
    message="String_Node_Str" + this.getName() + "String_Node_Str"+ this.getSource().toString()+ "String_Node_Str"+ error.toString();
  }
  log.warn(message);
  this.state.setValue(State.ABORTED);
  this.error.setValue(error);
  this.message.setValue(message);
}

Fixed version (ground truth):
/** 
 * Sets the job's state to   {@link State#ABORTED} and the error to the givenexception. Logs a warning with the given message and exception.
 * @param message
 * @param error
 */
public void setError(String message,Exception error){
  if (message == null) {
    message="String_Node_Str" + this.getName() + "String_Node_Str"+ this.getSource().toString()+ "String_Node_Str"+ error.toString();
  }
  log.warn(message);
  this.state.setValue(State.ABORTED);
  this.error.setValue(error);
  this.message.setValue(message);
}
Program: 158667
Project: 158667
Buggy source:
public static Destination toFile(final File file){
  return new Destination(){
    @Override public OutputStream open() throws IOException {
      File parent=file.getAbsoluteFile().getParentFile();
      if (!parent.mkdirs() && !parent.exists()) {
        throw new IOException(parent + "String_Node_Str");
      }
      return new FileOutputStream(file);
    }
    @Override public boolean exists(){
      return file.isFile();
    }
    @Override public void delete() throws IOException {
      if (file.exists() && !file.delete()) {
        throw new IOException(file + "String_Node_Str");
      }
    }
  }
;
}

Fixed version (ground truth):
public static Destination toFile(final File file){
  return new Destination(){
    @Override public OutputStream open() throws IOException {
      File parent=file.getAbsoluteFile().getParentFile();
      if (!parent.mkdirs() && !parent.exists()) {
        throw new IOException(parent + "String_Node_Str");
      }
      return new FileOutputStream(file);
    }
    @Override public boolean isValid() throws IOException {
      if (file.isFile()) {
        return file.length() > 0;
      }
      return false;
    }
    @Override public boolean exists(){
      return file.isFile();
    }
    @Override public void delete() throws IOException {
      if (file.exists() && !file.delete()) {
        throw new IOException(file + "String_Node_Str");
      }
    }
  }
;
}
Program: 158669
Project: 158669
Buggy source:
/** 
 * This test fails sometimes, probably because two plains are tapped for the first creature
 */
@Test public void testSimpleCast2(){
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",2);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",2);
  setStopAt(1,PhaseStep.BEGIN_COMBAT);
  execute();
  assertPermanentCount(playerA,"String_Node_Str",2);
}

Fixed version (ground truth):
/** 
 * This test fails sometimes, probably because two plains are tapped for the first creature
 */
@Test @Ignore public void testSimpleCast2(){
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",2);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",2);
  setStopAt(1,PhaseStep.BEGIN_COMBAT);
  execute();
  assertPermanentCount(playerA,"String_Node_Str",2);
}
Program: 158670
Project: 158670
Buggy source:
public void add(ManaType manaType,int amount){
switch (manaType) {
case BLACK:
    black+=amount;
  break;
case BLUE:
blue+=amount;
;
break;
case GREEN:
green+=amount;
;
break;
case RED:
red+=amount;
;
break;
case WHITE:
white+=amount;
;
break;
case COLORLESS:
generic+=amount;
;
break;
}
}

Fixed version (ground truth):
public void add(ManaType manaType,int amount){
switch (manaType) {
case BLACK:
    black+=amount;
  break;
case BLUE:
blue+=amount;
;
break;
case GREEN:
green+=amount;
;
break;
case RED:
red+=amount;
;
break;
case WHITE:
white+=amount;
;
break;
case COLORLESS:
colorless+=amount;
;
case GENERIC:
generic+=amount;
;
break;
}
}
Program: 158671
Project: 158671
Buggy source:
public void clear(ManaType manaType){
switch (manaType) {
case BLACK:
    black=0;
  break;
case BLUE:
blue=0;
break;
case GREEN:
green=0;
break;
case RED:
red=0;
break;
case WHITE:
white=0;
break;
case COLORLESS:
generic=0;
break;
}
}

Fixed version (ground truth):
public void clear(ManaType manaType){
switch (manaType) {
case BLACK:
    black=0;
  break;
case BLUE:
blue=0;
break;
case GREEN:
green=0;
break;
case RED:
red=0;
break;
case WHITE:
white=0;
break;
case GENERIC:
generic=0;
break;
case COLORLESS:
colorless=0;
break;
}
}
Program: 158672
Project: 158672
Buggy source:
public void removeAll(FilterMana filter){
  if (filter == null) {
    return;
  }
  if (filter.isBlack()) {
    black=0;
  }
  if (filter.isBlue()) {
    blue=0;
  }
  if (filter.isWhite()) {
    white=0;
  }
  if (filter.isGreen()) {
    green=0;
  }
  if (filter.isRed()) {
    red=0;
  }
  if (filter.isGeneric()) {
    generic=0;
  }
}

Fixed version (ground truth):
public void removeAll(FilterMana filter){
  if (filter == null) {
    return;
  }
  if (filter.isBlack()) {
    black=0;
  }
  if (filter.isBlue()) {
    blue=0;
  }
  if (filter.isWhite()) {
    white=0;
  }
  if (filter.isGreen()) {
    green=0;
  }
  if (filter.isRed()) {
    red=0;
  }
  if (filter.isColorless()) {
    colorless=0;
  }
  if (filter.isGeneric()) {
    generic=0;
  }
}
Program: 158673
Project: 158673
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanent(source.getSourceId());
  if (permanent != null) {
    Player player=game.getPlayer(source.getControllerId());
    if (player != null) {
      TargetControlledPermanent target=new TargetControlledPermanent(1,1,filter,false);
      if (target.canChoose(player.getId(),game)) {
        player.choose(Outcome.Sacrifice,target,source.getSourceId(),game);
        Permanent artifactSacrifice=game.getPermanent(target.getFirstTarget());
        if (artifactSacrifice != null) {
          return artifactSacrifice.sacrifice(source.getSourceId(),game);
        }
 else {
          permanent.tap(game);
          player.damage(4,source.getSourceId(),game,false,true);
        }
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@java.lang.Override public boolean apply(Game game,Ability source){
  Permanent sourceObject=game.getPermanentOrLKIBattlefield(source.getSourceId());
  if (sourceObject != null) {
    Player controller=game.getPlayer(source.getControllerId());
    if (controller != null) {
      TargetControlledPermanent target=new TargetControlledPermanent(1,1,filter,true);
      if (target.canChoose(controller.getId(),game)) {
        controller.choose(Outcome.Sacrifice,target,source.getSourceId(),game);
        Permanent artifactSacrifice=game.getPermanent(target.getFirstTarget());
        if (artifactSacrifice != null) {
          artifactSacrifice.sacrifice(source.getSourceId(),game);
        }
      }
 else {
        sourceObject.tap(game);
        controller.damage(4,source.getSourceId(),game,false,true);
      }
    }
    return true;
  }
  return false;
}
Program: 158674
Project: 158674
Buggy source:
@Override public RustElementalEffect copy(){
  return new RustElementalEffect(this);
}

Fixed version (ground truth):
@java.lang.Override public RustElementalEffect copy(){
  return new RustElementalEffect(this);
}
Program: 158677
Project: 158677
Buggy source:
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  Mana mana=((ManaEvent)event).getMana();
  if (mana.getBlack() > 0) {
    mana.set(ManaType.BLACK,mana.getBlack() * 2);
  }
  if (mana.getBlue() > 0) {
    mana.set(ManaType.BLUE,mana.getBlue() * 2);
  }
  if (mana.getWhite() > 0) {
    mana.set(ManaType.WHITE,mana.getWhite() * 2);
  }
  if (mana.getGreen() > 0) {
    mana.set(ManaType.GREEN,mana.getGreen() * 2);
  }
  if (mana.getRed() > 0) {
    mana.set(ManaType.RED,mana.getRed() * 2);
  }
  if (mana.getGeneric() > 0) {
    mana.set(ManaType.COLORLESS,mana.getGeneric() * 2);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  Mana mana=((ManaEvent)event).getMana();
  if (mana.getBlack() > 0) {
    mana.set(ManaType.BLACK,mana.getBlack() * 2);
  }
  if (mana.getBlue() > 0) {
    mana.set(ManaType.BLUE,mana.getBlue() * 2);
  }
  if (mana.getWhite() > 0) {
    mana.set(ManaType.WHITE,mana.getWhite() * 2);
  }
  if (mana.getGreen() > 0) {
    mana.set(ManaType.GREEN,mana.getGreen() * 2);
  }
  if (mana.getRed() > 0) {
    mana.set(ManaType.RED,mana.getRed() * 2);
  }
  if (mana.getColorless() > 0) {
    mana.set(ManaType.COLORLESS,mana.getColorless() * 2);
  }
  return false;
}
Program: 158678
Project: 158678
Buggy source:
public List<Mana> getNetMana(Game game,Ability source){
  List<Mana> netManas=new ArrayList<>();
  Mana types=getManaTypes(game,source);
  if (types.getAny() > 0) {
    netManas.add(new Mana(0,0,0,0,0,0,1,0));
    return netManas;
  }
  if (types.getBlack() > 0) {
    netManas.add(new Mana(ColoredManaSymbol.B));
  }
  if (types.getRed() > 0) {
    netManas.add(new Mana(ColoredManaSymbol.R));
  }
  if (types.getBlue() > 0) {
    netManas.add(new Mana(ColoredManaSymbol.U));
  }
  if (types.getGreen() > 0) {
    netManas.add(new Mana(ColoredManaSymbol.G));
  }
  if (types.getWhite() > 0) {
    netManas.add(new Mana(ColoredManaSymbol.W));
  }
  if (types.getGeneric() > 0) {
    netManas.add(new Mana(0,0,0,0,0,0,0,1));
  }
  return netManas;
}

Fixed version (ground truth):
public List<Mana> getNetMana(Game game,Ability source){
  List<Mana> netManas=new ArrayList<>();
  Mana types=getManaTypes(game,source);
  if (types.getAny() > 0) {
    netManas.add(new Mana(0,0,0,0,0,0,1,0));
    return netManas;
  }
  if (types.getBlack() > 0) {
    netManas.add(new Mana(ColoredManaSymbol.B));
  }
  if (types.getRed() > 0) {
    netManas.add(new Mana(ColoredManaSymbol.R));
  }
  if (types.getBlue() > 0) {
    netManas.add(new Mana(ColoredManaSymbol.U));
  }
  if (types.getGreen() > 0) {
    netManas.add(new Mana(ColoredManaSymbol.G));
  }
  if (types.getWhite() > 0) {
    netManas.add(new Mana(ColoredManaSymbol.W));
  }
  if (types.getColorless() > 0) {
    netManas.add(new Mana(0,0,0,0,0,0,0,1));
  }
  return netManas;
}
Program: 158681
Project: 158681
Buggy source:
/** 
 * Checks if a possible creature for a block is already doing another required block
 * @param possibleBlockerId
 * @param mustBeBlockedByAtLeastOne
 * @param game
 * @return null block is required otherwise message with reason why not
 */
protected String isCreatureDoingARequiredBlock(UUID possibleBlockerId,Map<UUID,Set<UUID>> mustBeBlockedByAtLeastOne,Game game){
  Permanent possibleBlocker=game.getPermanent(possibleBlockerId);
  if (possibleBlocker != null) {
    if (possibleBlocker.getBlocking() == 0) {
      return possibleBlocker.getIdName() + "String_Node_Str";
    }
    Set<UUID> forcingAttackers=creatureMustBlockAttackers.get(possibleBlockerId);
    if (forcingAttackers == null) {
      if (possibleBlocker.getBlocking() > 0) {
        CombatGroup combatGroupOfPossibleBlocker=findGroupOfBlocker(possibleBlockerId);
        if (combatGroupOfPossibleBlocker != null) {
          for (          UUID blockedAttackerId : combatGroupOfPossibleBlocker.getAttackers()) {
            if (mustBeBlockedByAtLeastOne.containsKey(blockedAttackerId)) {
              if (combatGroupOfPossibleBlocker.getBlockers().size() == 1) {
                return null;
              }
              Permanent blockedAttacker=game.getPermanent(blockedAttackerId);
              return possibleBlocker.getIdName() + "String_Node_Str" + blockedAttacker.getIdName()+ "String_Node_Str";
            }
          }
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Checks if a possible creature for a block is already doing another required block
 * @param possibleBlockerId
 * @param mustBeBlockedByAtLeastOne
 * @param game
 * @return null block is required otherwise message with reason why not
 */
protected String isCreatureDoingARequiredBlock(UUID possibleBlockerId,Map<UUID,Set<UUID>> mustBeBlockedByAtLeastOne,Game game){
  Permanent possibleBlocker=game.getPermanent(possibleBlockerId);
  if (possibleBlocker != null) {
    if (possibleBlocker.getBlocking() == 0) {
      return possibleBlocker.getIdName() + "String_Node_Str";
    }
    Set<UUID> forcingAttackers=creatureMustBlockAttackers.get(possibleBlockerId);
    if (forcingAttackers == null) {
      if (possibleBlocker.getBlocking() > 0) {
        CombatGroup combatGroupOfPossibleBlocker=findGroupOfBlocker(possibleBlockerId);
        if (combatGroupOfPossibleBlocker != null) {
          for (          UUID blockedAttackerId : combatGroupOfPossibleBlocker.getAttackers()) {
            if (mustBeBlockedByAtLeastOne.containsKey(blockedAttackerId)) {
              if (combatGroupOfPossibleBlocker.getBlockers().size() == 1) {
                return null;
              }
              Permanent blockedAttacker=game.getPermanent(blockedAttackerId);
              return possibleBlocker.getIdName() + "String_Node_Str" + blockedAttacker.getIdName()+ "String_Node_Str";
            }
            Permanent blockedAttacker=game.getPermanent(blockedAttackerId);
            return possibleBlocker.getIdName() + "String_Node_Str" + blockedAttacker.getIdName()+ "String_Node_Str";
          }
        }
      }
    }
  }
  return null;
}
Program: 158683
Project: 158683
Buggy source:
static private String validateUserName(String userName){
  if (userName.equals("String_Node_Str")) {
    return "String_Node_Str";
  }
  ConfigSettings config=ConfigSettings.getInstance();
  if (userName.length() < config.getMinUserNameLength()) {
    return "String_Node_Str" + config.getMinUserNameLength() + "String_Node_Str";
  }
  if (userName.length() > config.getMaxUserNameLength()) {
    return "String_Node_Str" + config.getMaxUserNameLength() + "String_Node_Str";
  }
  Matcher m=invalidUserNamePattern.matcher(userName);
  if (m.find()) {
    return "String_Node_Str" + userName + "String_Node_Str";
  }
  AuthorizedUser authorizedUser=AuthorizedUserRepository.instance.getByName(userName);
  if (authorizedUser != null) {
    return "String_Node_Str" + userName + "String_Node_Str";
  }
  return null;
}

Fixed version (ground truth):
static private String validateUserName(String userName){
  if (userName.equals("String_Node_Str")) {
    return "String_Node_Str";
  }
  ConfigSettings config=ConfigSettings.getInstance();
  if (userName.length() < config.getMinUserNameLength()) {
    return "String_Node_Str" + config.getMinUserNameLength() + "String_Node_Str";
  }
  if (userName.length() > config.getMaxUserNameLength()) {
    return "String_Node_Str" + config.getMaxUserNameLength() + "String_Node_Str";
  }
  Pattern invalidUserNamePattern=Pattern.compile(ConfigSettings.getInstance().getInvalidUserNamePattern(),Pattern.CASE_INSENSITIVE);
  Matcher m=invalidUserNamePattern.matcher(userName);
  if (m.find()) {
    return "String_Node_Str" + userName + "String_Node_Str";
  }
  AuthorizedUser authorizedUser=AuthorizedUserRepository.instance.getByName(userName);
  if (authorizedUser != null) {
    return "String_Node_Str" + userName + "String_Node_Str";
  }
  return null;
}
Program: 158684
Project: 158684
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  MageObject sourceObject=source.getSourceObject(game);
  if (controller == null || sourceObject == null) {
    return false;
  }
  if (controller.getLibrary().size() > 0) {
    Card card=controller.getLibrary().getFromTop(game);
    if (card != null) {
      Cards cards=new CardsImpl(card);
      controller.revealCards(sourceObject.getIdName(),cards,game);
      if (card.getCardType().contains(CardType.ARTIFACT)) {
        controller.moveCards(card,Zone.HAND,source,game);
      }
 else {
        controller.moveCards(card,Zone.GRAVEYARD,source,game);
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@java.lang.Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  MageObject sourceObject=source.getSourceObject(game);
  if (controller == null || sourceObject == null) {
    return false;
  }
  if (controller.getLibrary().size() > 0) {
    Card card=controller.getLibrary().getFromTop(game);
    if (card != null) {
      Cards cards=new CardsImpl(card);
      controller.revealCards(sourceObject.getIdName(),cards,game);
      if (card.getCardType().contains(CardType.ARTIFACT)) {
        controller.moveCards(card,Zone.HAND,source,game);
      }
 else {
        controller.moveCards(card,Zone.GRAVEYARD,source,game);
      }
    }
  }
  return true;
}
Program: 158685
Project: 158685
Buggy source:
@Override public NeurokFamiliarEffect copy(){
  return new NeurokFamiliarEffect(this);
}

Fixed version (ground truth):
@java.lang.Override public NeurokFamiliarEffect copy(){
  return new NeurokFamiliarEffect(this);
}
Program: 158687
Project: 158687
Buggy source:
public MythicspoilerComSource(){
  sets=new LinkedHashMap<>();
  setsAliases=new HashMap<>();
  setsAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases=new HashMap<>();
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliasesStart=new HashMap<>();
  HashSet<String> names=new HashSet<>();
  names.add("String_Node_Str");
  cardNameAliasesStart.put("String_Node_Str",names);
}

Fixed version (ground truth):
public MythicspoilerComSource(){
  sets=new LinkedHashMap<>();
  setsAliases=new HashMap<>();
  setsAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases=new HashMap<>();
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliases.put("String_Node_Str","String_Node_Str");
  cardNameAliasesStart=new HashMap<>();
  HashSet<String> names=new HashSet<>();
  names.add("String_Node_Str");
  cardNameAliasesStart.put("String_Node_Str",names);
}
Program: 158690
Project: 158690
Buggy source:
/** 
 * Test if a Thragtusk is copied by a Phyrexian Metamorph that leave battlefield ability does not work, if  the copy left all abilities by Turn to Frog
 */
@Test public void testPhyrexianMetamorphTurnToFrog(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",4);
  addCard(Zone.HAND,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",6);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",6);
  addCard(Zone.HAND,playerB,"String_Node_Str",1);
  addCard(Zone.HAND,playerB,"String_Node_Str",1);
  addCard(Zone.HAND,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  castSpell(1,PhaseStep.BEGIN_COMBAT,playerB,"String_Node_Str");
  castSpell(1,PhaseStep.DECLARE_ATTACKERS,playerB,"String_Node_Str","String_Node_Str");
  castSpell(1,PhaseStep.POSTCOMBAT_MAIN,playerB,"String_Node_Str","String_Node_Str");
  setStopAt(1,PhaseStep.END_TURN);
  execute();
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertPermanentCount(playerB,"String_Node_Str",1);
  assertPermanentCount(playerA,"String_Node_Str",0);
  assertGraveyardCount(playerA,"String_Node_Str",1);
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertLife(playerA,25);
  assertLife(playerB,20);
  assertPermanentCount(playerA,"String_Node_Str",0);
}

Fixed version (ground truth):
/** 
 * Test if a Thragtusk is copied by a Phyrexian Metamorph that leave battlefield ability does not work, if the copy left all abilities by Turn to Frog
 */
@Test public void testPhyrexianMetamorphTurnToFrog(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",4);
  addCard(Zone.HAND,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",6);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",6);
  addCard(Zone.HAND,playerB,"String_Node_Str",1);
  addCard(Zone.HAND,playerB,"String_Node_Str",1);
  addCard(Zone.HAND,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  castSpell(1,PhaseStep.BEGIN_COMBAT,playerB,"String_Node_Str");
  castSpell(1,PhaseStep.DECLARE_ATTACKERS,playerB,"String_Node_Str","String_Node_Str");
  castSpell(1,PhaseStep.POSTCOMBAT_MAIN,playerB,"String_Node_Str","String_Node_Str");
  setStopAt(1,PhaseStep.END_TURN);
  execute();
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertPermanentCount(playerB,"String_Node_Str",1);
  assertPermanentCount(playerA,"String_Node_Str",0);
  assertGraveyardCount(playerA,"String_Node_Str",1);
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertLife(playerA,25);
  assertLife(playerB,20);
  assertPermanentCount(playerA,"String_Node_Str",0);
}
Program: 158692
Project: 158692
Buggy source:
@Override public boolean isInUseableZone(Game game,MageObject source,GameEvent event){
  if (event != null && event.getTargetId() != null && event.getTargetId().equals(getSourceId())) {
switch (event.getType()) {
case ZONE_CHANGE:
case DESTROYED_PERMANENT:
      if (event.getType().equals(EventType.DESTROYED_PERMANENT)) {
        source=game.getLastKnownInformation(getSourceId(),Zone.BATTLEFIELD);
      }
 else {
        if (((ZoneChangeEvent)event).getTarget() != null) {
          source=((ZoneChangeEvent)event).getTarget();
        }
 else {
          source=game.getLastKnownInformation(getSourceId(),((ZoneChangeEvent)event).getZone());
        }
      }
case PHASED_OUT:
case PHASED_IN:
    if (this.zone == Zone.ALL || game.getLastKnownInformation(getSourceId(),zone) != null) {
      return this.hasSourceObjectAbility(game,source,event);
    }
}
}
return super.isInUseableZone(game,source,event);
}

Fixed version (ground truth):
@Override public boolean isInUseableZone(Game game,MageObject source,GameEvent event){
  if (event != null && event.getTargetId() != null && event.getTargetId().equals(getSourceId())) {
switch (event.getType()) {
case ZONE_CHANGE:
case DESTROYED_PERMANENT:
      if (isLeavesTheBattlefieldTrigger()) {
        if (event.getType().equals(EventType.DESTROYED_PERMANENT)) {
          source=game.getLastKnownInformation(getSourceId(),Zone.BATTLEFIELD);
        }
 else {
          if (((ZoneChangeEvent)event).getTarget() != null) {
            source=((ZoneChangeEvent)event).getTarget();
          }
 else {
            source=game.getLastKnownInformation(getSourceId(),((ZoneChangeEvent)event).getZone());
          }
        }
      }
case PHASED_OUT:
case PHASED_IN:
    if (this.zone == Zone.ALL || game.getLastKnownInformation(getSourceId(),zone) != null) {
      return this.hasSourceObjectAbility(game,source,event);
    }
}
}
return super.isInUseableZone(game,source,event);
}
Program: 158693
Project: 158693
Buggy source:
public TriggeredAbilityImpl(final TriggeredAbilityImpl ability){
  super(ability);
  this.optional=ability.optional;
}

Fixed version (ground truth):
public TriggeredAbilityImpl(final TriggeredAbilityImpl ability){
  super(ability);
  this.optional=ability.optional;
  this.leavesTheBattlefieldTrigger=ability.leavesTheBattlefieldTrigger;
}
Program: 158694
Project: 158694
Buggy source:
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    EntersTheBattlefieldEvent entersTheBattlefieldEvent=(EntersTheBattlefieldEvent)event;
    controller.moveCards(entersTheBattlefieldEvent.getTarget(),Zone.EXILED,source,game,false,false,false,null);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  Player controller=game.getPlayer(source.getControllerId());
  Card targetCard=game.getCard(event.getTargetId());
  if (targetCard == null) {
    targetCard=((EntersTheBattlefieldEvent)event).getTarget();
  }
  if (controller != null && targetCard != null) {
    controller.moveCards(targetCard,Zone.EXILED,source,game,false,false,false,null);
    return true;
  }
  return false;
}
Program: 158695
Project: 158695
Buggy source:
public int compare(CardView a,CardView b){
  Comparable aCom=null;
  Comparable bCom=null;
  if (column == 0) {
    aCom=Integer.valueOf(1);
    bCom=Integer.valueOf(1);
  }
 else   if (column == 1) {
    aCom=a.getName();
    bCom=b.getName();
    if (aCom.equals(bCom) && a.getExpansionSetCode().equals(b.getExpansionSetCode())) {
      aCom=a.getCardNumber();
      bCom=b.getCardNumber();
    }
  }
 else   if (column == 2) {
    aCom=a.getConvertedManaCost();
    bCom=b.getConvertedManaCost();
  }
 else   if (column == 3) {
    aCom=CardHelper.getColor(a);
    bCom=CardHelper.getColor(b);
  }
 else   if (column == 4) {
    aCom=CardHelper.getType(a);
    bCom=CardHelper.getType(b);
  }
 else   if (column == 5) {
    aCom=new Float(-1);
    bCom=new Float(-1);
    if (CardHelper.isCreature(a))     aCom=new Float(a.getPower() + "String_Node_Str" + a.getToughness());
    if (CardHelper.isCreature(b))     bCom=new Float(b.getPower() + "String_Node_Str" + b.getToughness());
  }
 else   if (column == 6) {
    aCom=a.getRarity().toString();
    bCom=b.getRarity().toString();
  }
 else   if (column == 7) {
    aCom=a.getExpansionSetCode();
    bCom=b.getExpansionSetCode();
  }
  if (ascending)   return aCom.compareTo(bCom);
 else   return bCom.compareTo(aCom);
}

Fixed version (ground truth):
@Override public int compare(CardView a,CardView b){
  Comparable aCom=null;
  Comparable bCom=null;
  if (column == 0) {
    aCom=1;
    bCom=1;
  }
 else   if (column == 1) {
    aCom=a.getName();
    bCom=b.getName();
    if (aCom.equals(bCom) && a.getExpansionSetCode().equals(b.getExpansionSetCode())) {
      aCom=a.getCardNumber();
      bCom=b.getCardNumber();
    }
  }
 else   if (column == 2) {
    aCom=a.getConvertedManaCost();
    bCom=b.getConvertedManaCost();
  }
 else   if (column == 3) {
    aCom=CardHelper.getColor(a);
    bCom=CardHelper.getColor(b);
  }
 else   if (column == 4) {
    aCom=CardHelper.getType(a);
    bCom=CardHelper.getType(b);
  }
 else   if (column == 5) {
    aCom=(float)-1;
    bCom=(float)-1;
    if (CardHelper.isCreature(a)) {
      aCom=new Float(a.getPower() + "String_Node_Str" + (a.getToughness().startsWith("String_Node_Str") ? "String_Node_Str" : a.getToughness()));
    }
    if (CardHelper.isCreature(b)) {
      bCom=new Float(b.getPower() + "String_Node_Str" + (b.getToughness().startsWith("String_Node_Str") ? "String_Node_Str" : b.getToughness()));
    }
  }
 else   if (column == 6) {
    aCom=a.getRarity().toString();
    bCom=b.getRarity().toString();
  }
 else   if (column == 7) {
    aCom=a.getExpansionSetCode();
    bCom=b.getExpansionSetCode();
  }
  if (ascending) {
    return aCom.compareTo(bCom);
  }
 else {
    return bCom.compareTo(aCom);
  }
}
Program: 158697
Project: 158697
Buggy source:
public ExchangeControlTargetEffect(final ExchangeControlTargetEffect effect){
  super(effect);
  this.rule=effect.rule;
  this.withSource=effect.withSource;
  this.withSecondTarget=effect.withSecondTarget;
  this.lockedControllers=new HashMap<UUID,UUID>(effect.lockedControllers);
  this.zoneChangeCounter=new HashMap<UUID,Integer>(effect.zoneChangeCounter);
}

Fixed version (ground truth):
public ExchangeControlTargetEffect(final ExchangeControlTargetEffect effect){
  super(effect);
  this.rule=effect.rule;
  this.withSource=effect.withSource;
  this.withSecondTarget=effect.withSecondTarget;
  this.lockedControllers=new HashMap<>(effect.lockedControllers);
  this.zoneChangeCounter=new HashMap<>(effect.zoneChangeCounter);
}
Program: 158698
Project: 158698
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(this.getTargetPointer().getFirst(game,source));
  Player controller=game.getPlayer(source.getControllerId());
  if (player == null || controller == null) {
    return false;
  }
  Cards cards=new CardsImpl();
  cards.addAll(player.getLibrary().getTopCards(game,7));
  controller.moveCards(cards,Zone.EXILED,source,game);
  if (cards.getCards(new FilterCreatureCard(),game).size() > 0) {
    TargetCard target=new TargetCard(Zone.EXILED,new FilterCreatureCard());
    if (controller.chooseTarget(outcome,cards,target,source,game)) {
      Card card=cards.get(target.getFirstTarget(),game);
      if (card != null) {
        controller.moveCards(cards.getCards(game),Zone.BATTLEFIELD,source,game,false,false,false,null);
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(this.getTargetPointer().getFirst(game,source));
  Player controller=game.getPlayer(source.getControllerId());
  if (player == null || controller == null) {
    return false;
  }
  Cards cards=new CardsImpl();
  cards.addAll(player.getLibrary().getTopCards(game,7));
  controller.moveCards(cards,Zone.EXILED,source,game);
  if (cards.getCards(new FilterCreatureCard(),game).size() > 0) {
    TargetCard target=new TargetCard(Zone.EXILED,new FilterCreatureCard());
    if (controller.chooseTarget(outcome,cards,target,source,game)) {
      Card card=cards.get(target.getFirstTarget(),game);
      if (card != null) {
        controller.moveCards(card,Zone.BATTLEFIELD,source,game,false,false,false,null);
      }
    }
  }
  return true;
}
Program: 158699
Project: 158699
Buggy source:
@Override public WhirlpoolSDrakeTriggeredEffect copy(){
  return new WhirlpoolSDrakeTriggeredEffect(this);
}

Fixed version (ground truth):
@Override public WhirlpoolDrake copy(){
  return new WhirlpoolDrake(this);
}
Program: 158700
Project: 158700
Buggy source:
@Override public WhirlpoolRiderTriggeredEffect copy(){
  return new WhirlpoolRiderTriggeredEffect(this);
}

Fixed version (ground truth):
@Override public WhirlpoolRider copy(){
  return new WhirlpoolRider(this);
}
Program: 158701
Project: 158701
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    for (    UUID playerId : controller.getInRange()) {
      Player player=game.getPlayer(playerId);
      if (player != null) {
        int cardsHand=player.getHand().size();
        if (cardsHand > 0) {
          for (          Card card : player.getHand().getCards(game)) {
            if (card != null) {
              player.removeFromHand(card,game);
              card.moveToZone(Zone.LIBRARY,source.getSourceId(),game,true);
            }
          }
          game.informPlayers(player.getLogName() + "String_Node_Str");
          player.shuffleLibrary(game);
          player.drawCards(cardsHand,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) {
    Map<UUID,Integer> playerCards=new LinkedHashMap<>();
    for (    UUID playerId : game.getState().getPlayersInRange(controller.getId(),game)) {
      Player player=game.getPlayer(playerId);
      if (player != null) {
        int cardsHand=player.getHand().size();
        if (cardsHand > 0) {
          playerCards.put(playerId,cardsHand);
          player.moveCards(player.getHand(),Zone.LIBRARY,source,game);
          player.shuffleLibrary(game);
        }
      }
    }
    for (    Entry<UUID,Integer> entry : playerCards.entrySet()) {
      Player player=game.getPlayer(entry.getKey());
      if (player != null) {
        player.drawCards(entry.getValue(),game);
      }
    }
    return true;
  }
  return false;
}
Program: 158703
Project: 158703
Buggy source:
@Override public boolean isInUseableZone(Game game,MageObject source,GameEvent event){
  Permanent sourcePermanent;
  if (game.getState().getZone(getSourceId()) == Zone.BATTLEFIELD) {
    sourcePermanent=game.getPermanent(getSourceId());
  }
 else {
    sourcePermanent=(Permanent)game.getLastKnownInformation(getSourceId(),Zone.BATTLEFIELD);
  }
  if (sourcePermanent == null) {
    return false;
  }
  return hasSourceObjectAbility(game,sourcePermanent,event);
}

Fixed version (ground truth):
@Override public boolean isInUseableZone(Game game,MageObject source,GameEvent event){
  Permanent sourcePermanent=null;
  if (game.getState().getZone(getSourceId()) == Zone.BATTLEFIELD) {
    sourcePermanent=game.getPermanent(getSourceId());
  }
 else {
    if (game.getShortLivingLKI(sourceId,Zone.BATTLEFIELD)) {
      sourcePermanent=(Permanent)game.getLastKnownInformation(getSourceId(),Zone.BATTLEFIELD);
    }
  }
  if (sourcePermanent == null) {
    return false;
  }
  return hasSourceObjectAbility(game,sourcePermanent,event);
}
Program: 158704
Project: 158704
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getPlayerId().equals(this.getControllerId())) {
    Spell spell=game.getStack().getSpell(event.getTargetId());
    if (isControlledInstantOrSorcery(spell)) {
      this.getTargets().get(0).clearChosen();
      this.getTargets().get(0).add(spell.getId(),game);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getPlayerId().equals(this.getControllerId())) {
    Spell spell=game.getStack().getSpell(event.getTargetId());
    if (isControlledInstantOrSorcery(spell)) {
      for (      Effect effect : getEffects()) {
        effect.setTargetPointer(new FixedTarget(spell.getId()));
      }
      return true;
    }
  }
  return false;
}
Program: 158705
Project: 158705
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Card cardOne=game.getCard(source.getTargets().get(0).getFirstTarget());
  Card cardTwo=game.getCard(source.getTargets().get(1).getFirstTarget());
  if (controller != null) {
    if (cardOne != null) {
      controller.moveCardToExileWithInfo(cardOne,null,"String_Node_Str",source.getSourceId(),game,Zone.GRAVEYARD,true);
    }
    if (cardTwo != null) {
      controller.moveCardToExileWithInfo(cardTwo,null,"String_Node_Str",source.getSourceId(),game,Zone.GRAVEYARD,true);
    }
    boolean castCardOne=true;
    if (cardOne != null && controller.chooseUse(Outcome.Neutral,"String_Node_Str" + cardOne.getName() + "String_Node_Str",source,game)) {
      Card copyOne=game.copyCard(cardOne,source,controller.getId());
      controller.cast(copyOne.getSpellAbility(),game,true);
      castCardOne=false;
    }
    if (cardTwo != null) {
      Card copyTwo=game.copyCard(cardTwo,source,controller.getId());
      controller.cast(copyTwo.getSpellAbility(),game,true);
    }
    if (cardOne != null && castCardOne) {
      Card copyOne=game.copyCard(cardOne,source,controller.getId());
      controller.cast(copyOne.getSpellAbility(),game,true);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Card cardOne=game.getCard(source.getTargets().get(0).getFirstTarget());
  Card cardTwo=game.getCard(source.getTargets().get(1).getFirstTarget());
  if (controller != null) {
    if (cardOne != null) {
      controller.moveCards(cardOne,Zone.EXILED,source,game);
    }
    if (cardTwo != null) {
      controller.moveCards(cardTwo,Zone.EXILED,source,game);
    }
    boolean castCardOne=true;
    if (cardOne != null && controller.chooseUse(Outcome.Neutral,"String_Node_Str" + cardOne.getName() + "String_Node_Str",source,game)) {
      Card copyOne=game.copyCard(cardOne,source,controller.getId());
      controller.cast(copyOne.getSpellAbility(),game,true);
      castCardOne=false;
    }
    if (cardTwo != null) {
      Card copyTwo=game.copyCard(cardTwo,source,controller.getId());
      controller.cast(copyTwo.getSpellAbility(),game,true);
    }
    if (cardOne != null && castCardOne) {
      Card copyOne=game.copyCard(cardOne,source,controller.getId());
      controller.cast(copyOne.getSpellAbility(),game,true);
    }
    return true;
  }
  return false;
}
Program: 158706
Project: 158706
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) {
    MageObject object=game.getObject(event.getSourceId());
    Ability ability=game.getAbility(event.getTargetId(),event.getSourceId());
    if (ability != null && object != null) {
      if (ability.getAbilityType() != AbilityType.MANA && object.getName().equals(game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY))) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  MageObject object=game.getObject(event.getSourceId());
  Ability ability=game.getAbility(event.getTargetId(),event.getSourceId());
  if (ability != null && object != null) {
    if (!ability.getAbilityType().equals(AbilityType.MANA) && object.getName().equals(game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY))) {
      return true;
    }
  }
  return false;
}
Program: 158707
Project: 158707
Buggy source:
/** 
 * Spelltwine Sorcery, 5U (6) Exile target instant or sorcery card from your graveyard and target instant  or sorcery card from an opponent's graveyard. Copy those cards. Cast the  copies if able without paying their mana costs. Exile Spelltwine.
 */
@Test public void testCopyCards(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",6);
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.GRAVEYARD,playerA,"String_Node_Str");
  addCard(Zone.GRAVEYARD,playerB,"String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  addTarget(playerA,"String_Node_Str");
  addTarget(playerA,"String_Node_Str");
  setStopAt(1,PhaseStep.BEGIN_COMBAT);
  execute();
  assertExileCount("String_Node_Str",1);
  assertExileCount("String_Node_Str",1);
  assertExileCount("String_Node_Str",1);
  assertLife(playerB,15);
}

Fixed version (ground truth):
/** 
 * Spelltwine Sorcery, 5U (6) Exile target instant or sorcery card from your graveyard and target instant or sorcery card from an opponent's graveyard. Copy those cards. Cast the copies if able without paying their mana costs. Exile Spelltwine.
 */
@Test public void testCopyCards(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",6);
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.GRAVEYARD,playerA,"String_Node_Str");
  addCard(Zone.GRAVEYARD,playerB,"String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  addTarget(playerA,"String_Node_Str");
  addTarget(playerA,"String_Node_Str");
  setStopAt(1,PhaseStep.BEGIN_COMBAT);
  execute();
  assertExileCount("String_Node_Str",1);
  assertExileCount("String_Node_Str",1);
  assertExileCount("String_Node_Str",1);
  assertLife(playerB,15);
}
Program: 158708
Project: 158708
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Card spellCard=game.getStack().getSpell(source.getSourceId()).getCard();
    if (spellCard != null) {
      controller.moveCards(spellCard,Zone.EXILED,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) {
    Spell spell=game.getStack().getSpell(source.getId());
    if (spell != null && !spell.isCopiedSpell()) {
      Card spellCard=spell.getCard();
      if (spellCard != null) {
        controller.moveCards(spellCard,Zone.EXILED,source,game);
      }
    }
    return true;
  }
  return false;
}