nus-yam/ex-repair huggingface dataset:
Program: 159683
Project: 159683
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);
    }
 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 {
      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 {
      MageFrame.getPreferences().put("String_Node_Str",file.getCanonicalPath());
    }
 catch (    IOException ex) {
    }
  }
  fcSelectDeck.setSelectedFile(null);
}
Program: 159684
Project: 159684
Buggy source:
@Override public void adjustCosts(Ability ability,Game game){
  int count=game.getBattlefield().getAllActivePermanents(filter,ability.getControllerId(),game).size();
  if (count > 0) {
    CardUtil.adjustCost((SpellAbility)ability,count);
  }
}

Fixed version (ground truth):
@Override public void adjustCosts(Ability ability,Game game){
  if (ability instanceof SpellAbility) {
    int count=game.getBattlefield().getAllActivePermanents(filter,ability.getControllerId(),game).size();
    if (count > 0) {
      CardUtil.adjustCost((SpellAbility)ability,count);
    }
  }
}
Program: 159686
Project: 159686
Buggy source:
@Override public void watch(GameEvent event,Game game){
  if (event.getType() == EventType.DAMAGED_PLAYER) {
    DamagedPlayerEvent dEvent=(DamagedPlayerEvent)event;
    if (dEvent.isCombatDamage()) {
      Permanent creature=game.getPermanent(dEvent.getSourceId());
      if (creature != null) {
        Set<String> subtypes=damagingSubtypes.get(creature.getControllerId());
        if (subtypes == null) {
          subtypes=new LinkedHashSet<String>();
        }
        subtypes.addAll(creature.getSubtype());
        damagingSubtypes.put(creature.getControllerId(),subtypes);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void watch(GameEvent event,Game game){
  if (event.getType() == EventType.DAMAGED_PLAYER) {
    DamagedPlayerEvent dEvent=(DamagedPlayerEvent)event;
    if (dEvent.isCombatDamage()) {
      Permanent creature=game.getPermanent(dEvent.getSourceId());
      if (creature != null && !allSubtypes.contains(creature.getControllerId())) {
        if (creature.getAbilities().containsKey(ChangelingAbility.getInstance().getId())) {
          allSubtypes.add(creature.getControllerId());
        }
 else {
          Set<String> subtypes=damagingSubtypes.get(creature.getControllerId());
          if (subtypes == null) {
            subtypes=new LinkedHashSet<String>();
          }
          subtypes.addAll(creature.getSubtype());
          damagingSubtypes.put(creature.getControllerId(),subtypes);
        }
      }
    }
  }
}
Program: 159687
Project: 159687
Buggy source:
@Override public void reset(){
  super.reset();
  damagingSubtypes.clear();
}

Fixed version (ground truth):
@Override public void reset(){
  super.reset();
  damagingSubtypes.clear();
  allSubtypes.clear();
}
Program: 159689
Project: 159689
Buggy source:
/** 
 * Filters out splice effects that are not active.
 * @param game
 * @return
 */
private List<SpliceCardEffect> getApplicableSpliceCardEffects(Game game){
  List<SpliceCardEffect> spliceEffects=new ArrayList<SpliceCardEffect>();
  for (  SpliceCardEffect effect : spliceCardEffects) {
    HashSet<Ability> abilities=spliceCardEffects.getAbility(effect.getId());
    for (    Ability ability : abilities) {
      if (!(ability instanceof StaticAbility) || ability.isInUseableZone(game,null,false)) {
        if (effect.getDuration() != Duration.OneUse || !effect.isUsed()) {
          spliceEffects.add(effect);
          break;
        }
      }
    }
  }
  return spliceEffects;
}

Fixed version (ground truth):
/** 
 * Filters out splice effects that are not active.
 * @param game
 * @return
 */
private List<SpliceCardEffect> getApplicableSpliceCardEffects(Game game,UUID playerId){
  List<SpliceCardEffect> spliceEffects=new ArrayList<SpliceCardEffect>();
  for (  SpliceCardEffect effect : spliceCardEffects) {
    HashSet<Ability> abilities=spliceCardEffects.getAbility(effect.getId());
    for (    Ability ability : abilities) {
      if (ability.getControllerId().equals(playerId) && (!(ability instanceof StaticAbility) || ability.isInUseableZone(game,null,false))) {
        if (effect.getDuration() != Duration.OneUse || !effect.isUsed()) {
          spliceEffects.add(effect);
          break;
        }
      }
    }
  }
  return spliceEffects;
}
Program: 159690
Project: 159690
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player you=game.getPlayer(source.getControllerId());
  FilterCard filter=new FilterCard("String_Node_Str");
  filter.add(new CardTypePredicate(CardType.ARTIFACT));
  if (you != null && you.getHand().count(filter,game) > 0 && you.chooseUse(Outcome.Discard,"String_Node_Str",game)) {
    Cost cost=new DiscardTargetCost(new TargetCardInHand(filter));
    if (cost.canPay(you.getId(),you.getId(),game)) {
      if (!cost.pay(source,game,you.getId(),you.getId(),false)) {
        you.discard(2,source,game);
      }
      return true;
    }
  }
  if (you != null && you.getHand().count(filter,game) == 0) {
    you.discard(2,source,game);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player you=game.getPlayer(source.getControllerId());
  FilterCard filter=new FilterCard("String_Node_Str");
  filter.add(new CardTypePredicate(CardType.ARTIFACT));
  if (you != null && you.getHand().count(filter,game) > 0 && you.chooseUse(Outcome.Discard,"String_Node_Str",game)) {
    Cost cost=new DiscardTargetCost(new TargetCardInHand(filter));
    if (cost.canPay(source.getSourceId(),you.getId(),game)) {
      if (cost.pay(source,game,source.getSourceId(),you.getId(),false)) {
        return true;
      }
    }
  }
  if (you != null) {
    you.discard(2,source,game);
    return true;
  }
  return false;
}
Program: 159693
Project: 159693
Buggy source:
public CardInfo(Card card){
  this.name=card.getName();
  this.cardNumber=card.getCardNumber();
  this.setCode=card.getExpansionSetCode();
  this.className=card.getClass().getCanonicalName();
  this.power=card.getPower().toString();
  this.toughness=card.getToughness().toString();
  this.convertedManaCost=card.getManaCost().convertedManaCost();
  this.rarity=card.getRarity();
  this.splitCard=card.isSplitCard();
  this.flipCard=card.isFlipCard();
  this.flipCardName=card.getFlipCardName();
  this.doubleFaced=card.canTransform();
  this.nightCard=card.isNightCard();
  Card secondSide=card.getSecondCardFace();
  if (secondSide != null) {
    this.secondSideName=secondSide.getName();
  }
  this.blue=card.getColor().isBlue();
  this.black=card.getColor().isBlack();
  this.green=card.getColor().isGreen();
  this.red=card.getColor().isRed();
  this.white=card.getColor().isWhite();
  this.setTypes(card.getCardType());
  this.setSubtypes(card.getSubtype());
  this.setSuperTypes(card.getSupertype());
  this.setManaCosts(card.getManaCost().getSymbols());
  this.setRules(card.getRules());
}

Fixed version (ground truth):
public CardInfo(Card card){
  this.name=card.getName();
  this.cardNumber=card.getCardNumber();
  this.setCode=card.getExpansionSetCode();
  this.className=card.getClass().getCanonicalName();
  this.power=card.getPower().toString();
  this.toughness=card.getToughness().toString();
  this.convertedManaCost=card.getManaCost().convertedManaCost();
  this.rarity=card.getRarity();
  this.splitCard=card.isSplitCard();
  this.flipCard=card.isFlipCard();
  this.flipCardName=card.getFlipCardName();
  this.doubleFaced=card.canTransform() && card.getSecondCardFace() != null;
  this.nightCard=card.isNightCard();
  Card secondSide=card.getSecondCardFace();
  if (secondSide != null) {
    this.secondSideName=secondSide.getName();
  }
  this.blue=card.getColor().isBlue();
  this.black=card.getColor().isBlack();
  this.green=card.getColor().isGreen();
  this.red=card.getColor().isRed();
  this.white=card.getColor().isWhite();
  this.setTypes(card.getCardType());
  this.setSubtypes(card.getSubtype());
  this.setSuperTypes(card.getSupertype());
  this.setManaCosts(card.getManaCost().getSymbols());
  this.setRules(card.getRules());
}
Program: 159695
Project: 159695
Buggy source:
@Override public boolean apply(Game game,Ability source){
switch (controller) {
case ANY:
    for (    UUID playerId : game.getPlayer(source.getControllerId()).getInRange()) {
      Player player=game.getPlayer(playerId);
      if (player != null) {
        player.damage(amount.calculate(game,source),source.getId(),game,false,true);
      }
    }
  break;
case OPPONENT:
for (UUID playerId : game.getOpponents(source.getControllerId())) {
  Player player=game.getPlayer(playerId);
  if (player != null) {
    player.damage(amount.calculate(game,source),source.getId(),game,false,true);
  }
}
break;
default :
throw new UnsupportedOperationException("String_Node_Str");
}
return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
switch (controller) {
case ANY:
    for (    UUID playerId : game.getPlayer(source.getControllerId()).getInRange()) {
      Player player=game.getPlayer(playerId);
      if (player != null) {
        player.damage(amount.calculate(game,source),source.getSourceId(),game,false,true);
      }
    }
  break;
case OPPONENT:
for (UUID playerId : game.getOpponents(source.getControllerId())) {
  Player player=game.getPlayer(playerId);
  if (player != null) {
    player.damage(amount.calculate(game,source),source.getSourceId(),game,false,true);
  }
}
break;
default :
throw new UnsupportedOperationException("String_Node_Str");
}
return true;
}
Program: 159696
Project: 159696
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player targetPlayer=game.getPlayer(source.getFirstTarget());
  if (targetPlayer == null) {
    return false;
  }
  Player you=game.getPlayer(source.getControllerId());
  FilterControlledPermanent filter=new FilterControlledPermanent();
  filter.add(new SubtypePredicate("String_Node_Str"));
  int numberOfAllies=game.getBattlefield().countAll(filter,you.getId(),game);
  Cards cardsInHand=new CardsImpl(Zone.PICK);
  cardsInHand.addAll(targetPlayer.getHand());
  int count=Math.min(cardsInHand.size(),numberOfAllies);
  TargetCard target=new TargetCard(count,Zone.PICK,new FilterCard());
  target.setRequired(true);
  Cards revealedCards=new CardsImpl();
  if (targetPlayer.choose(Outcome.DrawCard,cardsInHand,target,game)) {
    List<UUID> targets=target.getTargets();
    for (    UUID targetId : targets) {
      Card card=game.getCard(targetId);
      if (card != null) {
        revealedCards.add(card);
      }
    }
  }
  TargetCard targetInHand=new TargetCard(Zone.PICK,new FilterCard("String_Node_Str"));
  targetInHand.setRequired(true);
  if (!revealedCards.isEmpty()) {
    targetPlayer.revealCards("String_Node_Str",revealedCards,game);
    you.choose(Outcome.Neutral,revealedCards,targetInHand,game);
    Card card=revealedCards.get(targetInHand.getFirstTarget(),game);
    if (card != null) {
      targetPlayer.discard(card,source,game);
      game.informPlayers(targetPlayer + "String_Node_Str" + card.getName());
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player targetPlayer=game.getPlayer(source.getFirstTarget());
  if (targetPlayer == null) {
    return false;
  }
  Player you=game.getPlayer(source.getControllerId());
  FilterControlledPermanent filter=new FilterControlledPermanent();
  filter.add(new SubtypePredicate("String_Node_Str"));
  int numberOfAllies=game.getBattlefield().countAll(filter,you.getId(),game);
  Cards cardsInHand=new CardsImpl(Zone.PICK);
  cardsInHand.addAll(targetPlayer.getHand());
  int count=Math.min(cardsInHand.size(),numberOfAllies);
  TargetCard target=new TargetCard(count,Zone.PICK,new FilterCard());
  target.setRequired(true);
  Cards revealedCards=new CardsImpl();
  if (targetPlayer.choose(Outcome.DrawCard,cardsInHand,target,game)) {
    List<UUID> targets=target.getTargets();
    for (    UUID targetId : targets) {
      Card card=game.getCard(targetId);
      if (card != null) {
        revealedCards.add(card);
      }
    }
  }
  TargetCard targetInHand=new TargetCard(Zone.PICK,new FilterCard("String_Node_Str"));
  targetInHand.setRequired(true);
  if (!revealedCards.isEmpty()) {
    targetPlayer.revealCards("String_Node_Str",revealedCards,game);
    you.choose(Outcome.Neutral,revealedCards,targetInHand,game);
    Card card=revealedCards.get(targetInHand.getFirstTarget(),game);
    if (card != null) {
      targetPlayer.discard(card,source,game);
      game.informPlayers(new StringBuilder("String_Node_Str").append(targetPlayer.getName()).append("String_Node_Str").append(card.getName()).toString());
    }
  }
  return true;
}
Program: 159697
Project: 159697
Buggy source:
@Override public boolean apply(Game game,Ability source){
  UUID targetId=source.getFirstTarget();
  if (targetId != null) {
    game.getState().getTurnMods().add(new TurnMod(targetId,TurnPhase.COMBAT,null,true));
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(getTargetPointer().getFirst(game,source));
  if (player != null) {
    game.getState().getTurnMods().add(new TurnMod(player.getId(),TurnPhase.COMBAT,null,true));
    return true;
  }
  return false;
}
Program: 159698
Project: 159698
Buggy source:
public SkipNextCombatEffect(SkipNextCombatEffect effect){
  super(effect);
}

Fixed version (ground truth):
public SkipNextCombatEffect(final SkipNextCombatEffect effect){
  super(effect);
}
Program: 159699
Project: 159699
Buggy source:
@Override public SkipNextCombatEffect copy(){
  return new SkipNextCombatEffect();
}

Fixed version (ground truth):
@Override public SkipNextCombatEffect copy(){
  return new SkipNextCombatEffect(this);
}
Program: 159700
Project: 159700
Buggy source:
@Override public String getDescription(){
  if (extend.equals("String_Node_Str") || extend.equals("String_Node_Str"))   return "String_Node_Str";
  if (extend.equals("String_Node_Str") || extend.equals("String_Node_Str"))   return "String_Node_Str";
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String getDescription(){
  if (extend.equals("String_Node_Str"))   return "String_Node_Str";
  if (extend.equals("String_Node_Str"))   return "String_Node_Str";
  if (extend.equals("String_Node_Str") || extend.equals("String_Node_Str"))   return "String_Node_Str";
  return "String_Node_Str";
}
Program: 159701
Project: 159701
Buggy source:
private BufferedImage loadbuffer_selected() throws IOException {
  BufferedImage res;
  String path=PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE,"String_Node_Str");
  if (path != null) {
    res=ImageIO.read(new File(path));
    return res;
  }
  return null;
}

Fixed version (ground truth):
private BufferedImage loadbuffer_selected() throws IOException {
  BufferedImage res;
  String path=PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE,"String_Node_Str");
  if (path != null && !path.equals("String_Node_Str")) {
    try {
      res=ImageIO.read(new File(path));
      return res;
    }
 catch (    Exception e) {
      res=null;
    }
  }
  return null;
}
Program: 159702
Project: 159702
Buggy source:
public void applyInGame(Map<String,JComponent> ui){
  BufferedImage background;
  try {
    if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE_DEFAULT,"String_Node_Str").equals("String_Node_Str")) {
      background=loadbuffer_default();
    }
 else     if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE_RANDOM,"String_Node_Str").equals("String_Node_Str")) {
      background=loadbuffer_random();
    }
 else     if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE,"String_Node_Str") != null) {
      background=loadbuffer_selected();
    }
 else {
      background=loadbuffer_default();
    }
    if (background == null) {
      throw new FileNotFoundException("String_Node_Str");
    }
    if (ui.containsKey("String_Node_Str") && ui.containsKey("String_Node_Str")) {
      ImagePanel bgPanel=new ImagePanel(background,ImagePanel.TILED);
      unsetOpaque(ui.get("String_Node_Str"));
      unsetOpaque(ui.get("String_Node_Str"));
      unsetOpaque(ui.get("String_Node_Str"));
      unsetOpaque(ui.get("String_Node_Str"));
      unsetOpaque(ui.get("String_Node_Str"));
      unsetOpaque(ui.get("String_Node_Str"));
      ui.get("String_Node_Str").remove(ui.get("String_Node_Str"));
      bgPanel.add(ui.get("String_Node_Str"));
      ui.get("String_Node_Str").add(bgPanel);
    }
 else {
      log.error("String_Node_Str");
    }
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    return;
  }
}

Fixed version (ground truth):
public void applyInGame(Map<String,JComponent> ui){
  BufferedImage background;
  try {
    if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE_DEFAULT,"String_Node_Str").equals("String_Node_Str")) {
      background=loadbuffer_default();
    }
 else     if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE_RANDOM,"String_Node_Str").equals("String_Node_Str")) {
      background=loadbuffer_random();
    }
 else     if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE,"String_Node_Str") != null) {
      background=loadbuffer_selected();
    }
 else {
      background=loadbuffer_default();
    }
    if (background == null) {
      background=loadbuffer_default();
    }
    if (background == null) {
      throw new FileNotFoundException("String_Node_Str");
    }
    if (ui.containsKey("String_Node_Str") && ui.containsKey("String_Node_Str")) {
      ImagePanel bgPanel=new ImagePanel(background,ImagePanel.TILED);
      unsetOpaque(ui.get("String_Node_Str"));
      unsetOpaque(ui.get("String_Node_Str"));
      unsetOpaque(ui.get("String_Node_Str"));
      unsetOpaque(ui.get("String_Node_Str"));
      unsetOpaque(ui.get("String_Node_Str"));
      unsetOpaque(ui.get("String_Node_Str"));
      ui.get("String_Node_Str").remove(ui.get("String_Node_Str"));
      bgPanel.add(ui.get("String_Node_Str"));
      ui.get("String_Node_Str").add(bgPanel);
    }
 else {
      log.error("String_Node_Str");
    }
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    return;
  }
}
Program: 159704
Project: 159704
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent seasinger=game.getBattlefield().getPermanent(source.getSourceId());
  if (seasinger != null) {
    return seasinger.isTapped();
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Permanent input,Game game){
  return (game.getBattlefield().countAll(filter,input.getControllerId(),game) > 0);
}
Program: 159705
Project: 159705
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent creature=game.getPermanent(getTargetPointer().getFirst(game,source));
  if (creature != null) {
    Player controller=game.getPlayer(creature.getControllerId());
    if (controller != null) {
      int power=creature.getPower().getValue();
      if (creature.destroy(source.getSourceId(),game,false)) {
        Effect effect=new PutLibraryIntoGraveTargetEffect(power);
        effect.setTargetPointer(new FixedTarget(controller.getId()));
        return effect.apply(game,source);
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent creature=game.getPermanent(getTargetPointer().getFirst(game,source));
  if (creature != null) {
    Player controller=game.getPlayer(creature.getControllerId());
    if (controller != null) {
      int power=creature.getPower().getValue();
      creature.destroy(source.getSourceId(),game,false);
      Effect effect=new PutLibraryIntoGraveTargetEffect(power);
      effect.setTargetPointer(new FixedTarget(controller.getId()));
      return effect.apply(game,source);
    }
  }
  return false;
}
Program: 159707
Project: 159707
Buggy source:
@Override public MulDayaChannelers copy(){
  return new MulDayaChannelers(this);
}

Fixed version (ground truth):
@Override public MulDayaChannelersActivateIfConditionManaAbility copy(){
  return new MulDayaChannelersActivateIfConditionManaAbility(this);
}
Program: 159708
Project: 159708
Buggy source:
RenegadeDoppelgangerEffect(final RenegadeDoppelgangerEffect effect){
  super(effect);
}

Fixed version (ground truth):
public RenegadeDoppelgangerEffect(final RenegadeDoppelgangerEffect effect){
  super(effect);
}
Program: 159709
Project: 159709
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent creature=game.getPermanent(targetPointer.getFirst(game,source));
  Permanent permanent=game.getPermanent(source.getSourceId());
  if (creature == null || permanent == null) {
    return false;
  }
  game.copyPermanent(creature,permanent,source,new EmptyApplyToPermanent());
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanent(source.getSourceId());
  Permanent targetCreature=game.getPermanent(targetPointer.getFirst(game,source));
  if (targetCreature == null) {
    targetCreature=(Permanent)game.getLastKnownInformation(getTargetPointer().getFirst(game,source),Zone.BATTLEFIELD);
  }
  if (targetCreature == null || permanent == null) {
    return false;
  }
  game.copyPermanent(Duration.EndOfTurn,targetCreature,permanent,source,new EmptyApplyToPermanent());
  return false;
}
Program: 159710
Project: 159710
Buggy source:
/** 
 * This version supports copying of copies of any depth.
 * @param copyFromPermanent
 * @param copyToPermanent
 * @param source
 * @param applier
 */
Permanent copyPermanent(Permanent copyFromPermanent,Permanent copyToPermanent,Ability source,ApplyToPermanent applier);

Fixed version (ground truth):
Permanent copyPermanent(Duration duration,Permanent copyFromPermanent,Permanent copyToPermanent,Ability source,ApplyToPermanent applier);
Program: 159711
Project: 159711
Buggy source:
@Override public Permanent copyPermanent(Permanent copyFromPermanent,Permanent copyToPermanent,Ability source,ApplyToPermanent applier){
  Permanent permanent=copyFromPermanent.copy();
  permanent.reset(this);
  permanent.assignNewId();
  if (copyFromPermanent.isTransformed()) {
    TransformAbility.transform(permanent,copyFromPermanent.getSecondCardFace(),this);
  }
  applier.apply(this,permanent);
  Ability newAbility=source.copy();
  CopyEffect newEffect=new CopyEffect(permanent,copyToPermanent.getId());
  newEffect.newId();
  newEffect.setTimestamp();
  newEffect.init(newAbility,this);
  for (  Effect effect : getState().getContinuousEffects().getLayeredEffects(this)) {
    if (effect instanceof CopyEffect) {
      CopyEffect copyEffect=(CopyEffect)effect;
      if (copyEffect.getSourceId().equals(copyFromPermanent.getId())) {
        MageObject object=((CopyEffect)effect).getTarget();
        if (object instanceof Permanent) {
          Permanent original=(Permanent)object;
          original=original.copy();
          applier.apply(this,original);
          newEffect.setTarget(object);
        }
      }
    }
  }
  state.addEffect(newEffect,newAbility);
  return permanent;
}

Fixed version (ground truth):
@Override public Permanent copyPermanent(Duration duration,Permanent copyFromPermanent,Permanent copyToPermanent,Ability source,ApplyToPermanent applier){
  Permanent permanent=copyFromPermanent.copy();
  permanent.reset(this);
  permanent.assignNewId();
  if (copyFromPermanent.isTransformed()) {
    TransformAbility.transform(permanent,copyFromPermanent.getSecondCardFace(),this);
  }
  applier.apply(this,permanent);
  Ability newAbility=source.copy();
  CopyEffect newEffect=new CopyEffect(duration,permanent,copyToPermanent.getId());
  newEffect.newId();
  newEffect.setTimestamp();
  newEffect.init(newAbility,this);
  for (  Effect effect : getState().getContinuousEffects().getLayeredEffects(this)) {
    if (effect instanceof CopyEffect) {
      CopyEffect copyEffect=(CopyEffect)effect;
      if (copyEffect.getSourceId().equals(copyFromPermanent.getId())) {
        MageObject object=((CopyEffect)effect).getTarget();
        if (object instanceof Permanent) {
          Permanent original=(Permanent)object;
          original=original.copy();
          applier.apply(this,original);
          newEffect.setTarget(object);
        }
      }
    }
  }
  state.addEffect(newEffect,newAbility);
  return permanent;
}
Program: 159712
Project: 159712
Buggy source:
private boolean open(){
  filepath=Constants.BASE_MUSICS_PATH;
  filelist.removeAll();
  File filedir=new File(filepath);
  File[] fileread=filedir.listFiles();
  if (fileread.length == 0)   return false;
  String filename;
  for (  File f : fileread) {
    filename=f.getName().toLowerCase();
    if (filename.endsWith("String_Node_Str") || filename.endsWith("String_Node_Str")) {
      filelist.add(filename);
    }
  }
  if (filelist.getItemCount() == 0)   return false;
  return true;
}

Fixed version (ground truth):
private boolean open(){
  filepath=Constants.BASE_MUSICS_PATH;
  filelist.removeAll();
  File filedir=new File(filepath);
  File[] fileread=filedir.listFiles();
  if (fileread == null)   return false;
  if (fileread.length == 0)   return false;
  String filename;
  for (  File f : fileread) {
    filename=f.getName().toLowerCase();
    if (filename.endsWith("String_Node_Str") || filename.endsWith("String_Node_Str")) {
      filelist.add(filename);
    }
  }
  if (filelist.getItemCount() == 0)   return false;
  return true;
}
Program: 159713
Project: 159713
Buggy source:
private ModernMasters(){
  super("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",new GregorianCalendar(2016,6,7).getTime(),SetType.REPRINT);
  this.hasBoosters=true;
  this.numBoosterLands=0;
  this.numBoosterCommon=11;
  this.numBoosterUncommon=3;
  this.numBoosterRare=1;
  this.ratioBoosterMythic=8;
}

Fixed version (ground truth):
private ModernMasters(){
  super("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",new GregorianCalendar(2016,6,7).getTime(),SetType.REPRINT);
  this.hasBasicLands=false;
  this.hasBoosters=true;
  this.numBoosterLands=0;
  this.numBoosterCommon=11;
  this.numBoosterUncommon=3;
  this.numBoosterRare=1;
  this.ratioBoosterMythic=8;
}
Program: 159714
Project: 159714
Buggy source:
/** 
 * Gives back the set codes from the sets that include basic lands. If the input set itself does not incluse basic lands, but it has a parent set, only this parent set code is added to the return sets.
 * @param setCodes
 * @return - setCodes that have basic lands
 */
public static Set<String> getSetsWithBasicLandsAsCodes(Set<String> setCodes){
  Set<String> landSets=new LinkedHashSet<String>();
  if (setCodes != null && !setCodes.isEmpty()) {
    for (    String setCode : setCodes) {
      ExpansionSet expansionSet=Sets.findSet(setCode);
      if (expansionSet.hasBasicLands()) {
        landSets.add(setCode);
      }
 else       if (expansionSet.getParentSet() != null && !landSets.contains(expansionSet.getParentSet().getCode())) {
        landSets.add(expansionSet.getParentSet().getCode());
      }
    }
  }
  return landSets;
}

Fixed version (ground truth):
/** 
 * Gives back the set codes from the sets that include basic lands. If the input set itself does not incluse basic lands, but it has a parent set, only this parent set code is added to the return sets.
 * @param setCodes
 * @return - setCodes that have basic lands
 */
public static Set<String> getSetsWithBasicLandsAsCodes(Set<String> setCodes){
  Set<String> landSets=new LinkedHashSet<String>();
  if (setCodes != null && !setCodes.isEmpty()) {
    for (    String setCode : setCodes) {
      ExpansionSet expansionSet=Sets.findSet(setCode);
      if (expansionSet.hasBasicLands()) {
        landSets.add(setCode);
      }
 else       if (expansionSet.getParentSet() != null && !landSets.contains(expansionSet.getParentSet().getCode())) {
        landSets.add(expansionSet.getParentSet().getCode());
      }
    }
  }
  if (landSets.isEmpty()) {
    Random generator=new Random();
    int maxRndValue=0;
    String selectedSetCode=null;
    for (    ExpansionSet set : Sets.getInstance().getSortedByReleaseDate()) {
      if (set.hasBasicLands) {
        int rndValue=generator.nextInt(100);
        if (rndValue >= maxRndValue) {
          maxRndValue=rndValue;
          selectedSetCode=set.getCode();
        }
      }
    }
    if (selectedSetCode != null) {
      landSets.add(selectedSetCode);
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  return landSets;
}
Program: 159715
Project: 159715
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getType() == EventType.ZONE_CHANGE) {
    ZoneChangeEvent zEvent=(ZoneChangeEvent)event;
    if ((fromZone == null || zEvent.getFromZone() == fromZone) && (toZone == null || zEvent.getToZone() == toZone)) {
      Permanent perm=game.getPermanent(event.getTargetId());
      if (perm != null && filter.match(perm,sourceId,controllerId,game)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getType() == EventType.ZONE_CHANGE) {
    ZoneChangeEvent zEvent=(ZoneChangeEvent)event;
    if ((fromZone == null || zEvent.getFromZone() == fromZone) && (toZone == null || zEvent.getToZone() == toZone)) {
      Permanent perm;
      if (zEvent.getTarget() != null) {
        perm=zEvent.getTarget();
      }
 else {
        perm=game.getPermanent(event.getTargetId());
      }
      if (perm != null && filter.match(perm,sourceId,controllerId,game)) {
        return true;
      }
    }
  }
  return false;
}
Program: 159716
Project: 159716
Buggy source:
public boolean canTarget(MageObject source,Game game){
  if (filter instanceof FilterPermanent) {
    if (source instanceof Permanent)     return !filter.match(source,game);
    return true;
  }
  if (filter instanceof FilterSpell) {
    if (source instanceof Spell)     return !filter.match(source,game);
    return true;
  }
  if (filter instanceof FilterCard) {
    if (source instanceof Card)     return !filter.match(source,game);
    return true;
  }
  if (filter instanceof FilterObject) {
    return !filter.match(source,game);
  }
  return true;
}

Fixed version (ground truth):
public boolean canTarget(MageObject source,Game game){
  if (filter instanceof FilterPermanent) {
    if (source instanceof Permanent) {
      return !filter.match(source,game);
    }
    return true;
  }
  if (filter instanceof FilterSpell) {
    if (source instanceof Spell) {
      return !filter.match(source,game);
    }
    return true;
  }
  if (filter instanceof FilterCard) {
    if (source instanceof Card) {
      return !filter.match(source,game);
    }
    return true;
  }
  if (filter instanceof FilterObject) {
    return !filter.match(source,game);
  }
  return true;
}
Program: 159717
Project: 159717
Buggy source:
@Override public boolean canTarget(UUID id,UUID playerId,Ability ability,Game game){
  Card card=game.getCard(id);
  if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD)   if (game.getPlayer(playerId).getGraveyard().contains(id)) {
    return filter.match(card,game);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canTarget(UUID id,UUID playerId,Ability ability,Game game){
  Card card=game.getCard(id);
  if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
    if (game.getPlayer(playerId).getGraveyard().contains(id)) {
      return filter.match(card,game);
    }
  }
  return false;
}
Program: 159718
Project: 159718
Buggy source:
/** 
 * Checks if there are enough   {@link Card} that can be selected.
 * @param sourceControllerId - controller of the select event
 * @param game
 * @return - true if enough valid {@link Card} exist
 */
@Override public boolean canChoose(UUID sourceControllerId,Game game){
  if (game.getPlayer(sourceControllerId).getGraveyard().count(filter,game) >= this.minNumberOfTargets)   return true;
  return false;
}

Fixed version (ground truth):
@Override public boolean canChoose(UUID sourceId,UUID sourceControllerId,Game game){
  return canChoose(sourceControllerId,game);
}
Program: 159719
Project: 159719
Buggy source:
@Override public boolean apply(Game game,Ability source){
  StackObject spell=game.getStack().getStackObject(targetPointer.getFirst(game,source));
  if (spell != null) {
    Player player=game.getPlayer(spell.getControllerId());
    if (player != null) {
      Cost costToPay=cost.copy();
      if (cost == null) {
        costToPay=new GenericManaCost(genericMana.calculate(game,source));
      }
      costToPay.clearPaid();
      if (!costToPay.pay(source,game,spell.getSourceId(),spell.getControllerId(),false)) {
        return game.getStack().counter(source.getFirstTarget(),source.getSourceId(),game);
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  StackObject spell=game.getStack().getStackObject(targetPointer.getFirst(game,source));
  if (spell != null) {
    Player player=game.getPlayer(spell.getControllerId());
    if (player != null) {
      Cost costToPay;
      if (cost != null) {
        costToPay=cost.copy();
      }
 else {
        costToPay=new GenericManaCost(genericMana.calculate(game,source));
      }
      costToPay.clearPaid();
      if (!costToPay.pay(source,game,spell.getSourceId(),spell.getControllerId(),false)) {
        return game.getStack().counter(source.getFirstTarget(),source.getSourceId(),game);
      }
    }
  }
  return false;
}
Program: 159720
Project: 159720
Buggy source:
@Override public boolean apply(Game game,Ability source){
  if (source.getTargets().size() > 1) {
    for (    Target target : source.getTargets()) {
      for (      UUID targetId : target.getTargets()) {
        Permanent permanent=game.getPermanent(targetId);
        if (permanent != null) {
          permanent.damage(amount.calculate(game,source),source.getSourceId(),game,preventable,false);
        }
        Player player=game.getPlayer(targetId);
        if (player != null) {
          player.damage(amount.calculate(game,source),source.getSourceId(),game,false,preventable);
        }
      }
    }
    return true;
  }
  Permanent permanent=game.getPermanent(targetPointer.getFirst(game,source));
  if (permanent != null) {
    permanent.damage(amount.calculate(game,source),source.getSourceId(),game,preventable,false);
    return true;
  }
  Player player=game.getPlayer(targetPointer.getFirst(game,source));
  if (player != null) {
    player.damage(amount.calculate(game,source),source.getSourceId(),game,false,preventable);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  if (source.getTargets().size() > 1) {
    for (    Target target : source.getTargets()) {
      for (      UUID targetId : target.getTargets()) {
        Permanent permanent=game.getPermanent(targetId);
        if (permanent != null) {
          permanent.damage(amount.calculate(game,source),source.getSourceId(),game,preventable,false);
        }
        Player player=game.getPlayer(targetId);
        if (player != null) {
          player.damage(amount.calculate(game,source),source.getSourceId(),game,false,preventable);
        }
      }
    }
    return true;
  }
  for (  UUID targetId : this.getTargetPointer().getTargets(game,source)) {
    Permanent permanent=game.getPermanent(targetId);
    if (permanent != null) {
      permanent.damage(amount.calculate(game,source),source.getSourceId(),game,preventable,false);
    }
 else {
      Player player=game.getPlayer(targetPointer.getFirst(game,source));
      if (player != null) {
        player.damage(amount.calculate(game,source),source.getSourceId(),game,false,preventable);
      }
    }
  }
  return true;
}
Program: 159721
Project: 159721
Buggy source:
@Override public void setFilter(FilterMana filter){
}

Fixed version (ground truth):
/** 
 * Not Supported
 * @param filter
 */
@Override public void setFilter(FilterMana filter){
}
Program: 159722
Project: 159722
Buggy source:
@Override public void setFilter(FilterMana filter){
}

Fixed version (ground truth):
/** 
 * Not Supported
 * @param filter
 */
@Override public void setFilter(FilterMana filter){
}
Program: 159723
Project: 159723
Buggy source:
@Override public void setFilter(FilterMana filter){
}

Fixed version (ground truth):
/** 
 * Not Supported
 * @param filter
 */
@Override public void setFilter(FilterMana filter){
}
Program: 159724
Project: 159724
Buggy source:
@Override public void setFilter(FilterMana filter){
}

Fixed version (ground truth):
/** 
 * Not Supported
 * @param filter
 */
@Override public void setFilter(FilterMana filter){
}
Program: 159725
Project: 159725
Buggy source:
@Override public void setFilter(FilterMana filter){
}

Fixed version (ground truth):
/** 
 * Not Supported
 * @param filter
 */
@Override public void setFilter(FilterMana filter){
}
Program: 159727
Project: 159727
Buggy source:
@Override public void setFilter(FilterMana filter){
}

Fixed version (ground truth):
/** 
 * Not Supported
 * @param filter
 */
@Override public void setFilter(FilterMana filter){
}
Program: 159728
Project: 159728
Buggy source:
@Override public void setFilter(FilterMana filter){
}

Fixed version (ground truth):
/** 
 * Not Supported
 * @param filter
 */
@Override public void setFilter(FilterMana filter){
}
Program: 159729
Project: 159729
Buggy source:
@Override public void setFilter(FilterMana filter){
}

Fixed version (ground truth):
/** 
 * Not Supported
 * @param filter
 */
@Override public void setFilter(FilterMana filter){
}
Program: 159730
Project: 159730
Buggy source:
@Override public void setFilter(FilterMana filter){
}

Fixed version (ground truth):
/** 
 * Not Supported
 * @param filter
 */
@Override public void setFilter(FilterMana filter){
}
Program: 159731
Project: 159731
Buggy source:
@Override public boolean apply(Game game,Ability source){
  if (source.getTargets().size() > 1) {
    for (    Target target : source.getTargets()) {
      for (      UUID targetId : target.getTargets()) {
        Permanent permanent=game.getPermanent(targetId);
        if (permanent != null) {
          permanent.damage(amount.calculate(game,source),source.getSourceId(),game,preventable,false);
        }
        Player player=game.getPlayer(targetId);
        if (player != null) {
          player.damage(amount.calculate(game,source),source.getSourceId(),game,false,preventable);
        }
      }
    }
    return true;
  }
  for (  UUID targetId : this.getTargetPointer().getTargets(game,source)) {
    Permanent permanent=game.getPermanent(targetId);
    if (permanent != null) {
      permanent.damage(amount.calculate(game,source),source.getSourceId(),game,preventable,false);
    }
 else {
      Player player=game.getPlayer(targetPointer.getFirst(game,source));
      if (player != null) {
        player.damage(amount.calculate(game,source),source.getSourceId(),game,false,preventable);
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  if (source.getTargets().size() > 1) {
    for (    Target target : source.getTargets()) {
      for (      UUID targetId : target.getTargets()) {
        Permanent permanent=game.getPermanent(targetId);
        if (permanent != null) {
          permanent.damage(amount.calculate(game,source),source.getSourceId(),game,preventable,false);
        }
        Player player=game.getPlayer(targetId);
        if (player != null) {
          player.damage(amount.calculate(game,source),source.getSourceId(),game,false,preventable);
        }
      }
    }
    return true;
  }
  for (  UUID targetId : this.getTargetPointer().getTargets(game,source)) {
    Permanent permanent=game.getPermanent(targetId);
    if (permanent != null) {
      permanent.damage(amount.calculate(game,source),source.getSourceId(),game,preventable,false);
    }
 else {
      Player player=game.getPlayer(targetId);
      if (player != null) {
        player.damage(amount.calculate(game,source),source.getSourceId(),game,false,preventable);
      }
    }
  }
  return true;
}
Program: 159732
Project: 159732
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER && event.getTargetId().equals(source.getControllerId())) {
    return true;
  }
  return false;
}
Program: 159733
Project: 159733
Buggy source:
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER) {
    Player player=game.getPlayer(event.getPlayerId());
    if (player != null) {
      ManaCostsImpl propagandaTax=new ManaCostsImpl("String_Node_Str");
      if (propagandaTax.canPay(source.getSourceId(),event.getPlayerId(),game) && player.chooseUse(Constants.Outcome.Neutral,"String_Node_Str",game)) {
        if (propagandaTax.payOrRollback(source,game,this.getId(),event.getPlayerId())) {
          return false;
        }
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  Player player=game.getPlayer(event.getPlayerId());
  if (player != null) {
    ManaCostsImpl propagandaTax=new ManaCostsImpl("String_Node_Str");
    if (propagandaTax.canPay(source.getSourceId(),event.getPlayerId(),game) && player.chooseUse(Outcome.Neutral,"String_Node_Str",game)) {
      if (propagandaTax.payOrRollback(source,game,this.getId(),event.getPlayerId())) {
        return false;
      }
    }
    return true;
  }
  return false;
}
Program: 159734
Project: 159734
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player != null) {
    FilterCard filter=new FilterCard("String_Node_Str");
    filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT),new CardTypePredicate(CardType.SORCERY)));
    Card[] cards=player.getGraveyard().getCards(filter,game).toArray(new Card[0]);
    if (cards.length > 0) {
      Random rnd=new Random();
      Card card=cards[rnd.nextInt(cards.length)];
      card.moveToZone(Zone.HAND,source.getId(),game,true);
      game.informPlayers(card.getName() + "String_Node_Str" + player.getName());
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player != null) {
    FilterCard filter=new FilterCard("String_Node_Str");
    filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT),new CardTypePredicate(CardType.SORCERY)));
    Card[] cards=player.getGraveyard().getCards(filter,game).toArray(new Card[0]);
    if (cards.length > 0) {
      Random rnd=new Random();
      Card card=cards[rnd.nextInt(cards.length)];
      card.moveToZone(Zone.HAND,source.getId(),game,true);
      game.informPlayers(new StringBuilder("String_Node_Str").append(card.getName()).append("String_Node_Str").append(player.getName()).toString());
      return true;
    }
  }
  return false;
}
Program: 159735
Project: 159735
Buggy source:
public void selectBlockers(Game game){
  if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARING_BLOCKERS,attackerId,attackerId))) {
    Player player=game.getPlayer(attackerId);
    checkBlockRequirementsBefore(player,game);
    for (    UUID defenderId : getPlayerDefenders(game)) {
      boolean choose=true;
      Player defender=game.getPlayer(defenderId);
      while (choose) {
        game.getPlayer(defenderId).selectBlockers(game,defenderId);
        if (game.isPaused() || game.isGameOver()) {
          return;
        }
        if (!checkBlockRestrictions(game.getPlayer(defenderId),game)) {
          if (player.isHuman()) {
            continue;
          }
        }
        choose=!checkBlockRequirementsAfter(defender,defender,game);
      }
      game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS,defenderId,defenderId));
    }
    TraceUtil.traceCombatIfNeeded(game,this);
  }
}

Fixed version (ground truth):
public void selectBlockers(Game game){
  if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARING_BLOCKERS,attackerId,attackerId))) {
    Player player=game.getPlayer(attackerId);
    checkBlockRequirementsBefore(player,game);
    for (    UUID defenderId : getPlayerDefenders(game)) {
      boolean choose=true;
      Player defender=game.getPlayer(defenderId);
      while (choose) {
        game.getPlayer(defenderId).selectBlockers(game,defenderId);
        if (game.isPaused() || game.isGameOver()) {
          return;
        }
        if (!checkBlockRestrictions(game.getPlayer(defenderId),game)) {
          if (defender.isHuman()) {
            continue;
          }
        }
        choose=!checkBlockRequirementsAfter(defender,defender,game);
      }
      game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS,defenderId,defenderId));
    }
    TraceUtil.traceCombatIfNeeded(game,this);
  }
}
Program: 159736
Project: 159736
Buggy source:
@Override public boolean applies(Permanent permanent,Ability source,Game game){
  if (filter.match(permanent,source.getSourceId(),source.getControllerId(),game)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(Permanent permanent,Ability source,Game game){
  for (  FixedTarget fixedTarget : this.detainedObjects) {
    UUID targetId=fixedTarget.getFirst(game,source);
    if (targetId != null && targetId.equals(permanent.getId())) {
      return true;
    }
  }
  return false;
}
Program: 159737
Project: 159737
Buggy source:
@Override public boolean apply(Game game,Ability source){
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  List<FixedTarget> detainedObjects=new ArrayList<FixedTarget>();
  for (  Permanent permanent : game.getBattlefield().getActivePermanents(filter,source.getControllerId(),source.getSourceId(),game)) {
    game.informPlayers("String_Node_Str" + permanent.getName());
    FixedTarget fixedTarget=new FixedTarget(permanent.getId());
    fixedTarget.init(game,source);
    detainedObjects.add(fixedTarget);
  }
  game.addEffect(new DetainAllRestrictionEffect(detainedObjects),source);
  return false;
}