nus-yam/ex-repair huggingface dataset:
Program: 158309
Project: 158309
Buggy source:
public CardSetInfo(String name,String expansionSetCode,String cardNumber,Rarity rarity,CardGraphicInfo graphicInfo){
  this.name=name;
  this.expansionSetCode=expansionSetCode;
  this.cardNumber=cardNumber;
  this.rarity=rarity;
  this.graphicInfo=graphicInfo;
}

Fixed version (ground truth):
public CardSetInfo(String name,String expansionSetCode,String cardNumber,Rarity rarity,CardGraphicInfo graphicInfo){
  this.name=name;
  this.expansionSetCode=expansionSetCode;
  this.cardNumber=cardNumber;
  this.rarity=rarity;
  if (graphicInfo == null && Rarity.LAND.equals(rarity)) {
    this.graphicInfo=new CardGraphicInfo(null,true);
  }
 else {
    this.graphicInfo=graphicInfo;
  }
}
Program: 158310
Project: 158310
Buggy source:
public SetCardInfo(String name,String cardNumber,Rarity rarity,Class<?> cardClass,CardGraphicInfo graphicInfo){
  this.name=name;
  this.cardNumber=cardNumber;
  this.rarity=rarity;
  this.cardClass=cardClass;
  this.usesVariousArt=false;
  this.graphicInfo=graphicInfo;
}

Fixed version (ground truth):
public SetCardInfo(String name,String cardNumber,Rarity rarity,Class<?> cardClass,CardGraphicInfo graphicInfo){
  this.name=name;
  this.cardNumber=cardNumber;
  this.rarity=rarity;
  this.cardClass=cardClass;
  if (graphicInfo != null) {
    this.usesVariousArt=graphicInfo.getUsesVariousArt();
  }
 else {
    usesVariousArt=false;
  }
  this.graphicInfo=graphicInfo;
}
Program: 158312
Project: 158312
Buggy source:
/** 
 * Returns the image appropriate to display for a card in a picture panel, but only it was ALREADY LOADED. That is, the call is immediate and will not block on file IO.
 * @param card
 * @param width
 * @param height
 * @return 
 */
public static BufferedImage tryGetImage(CardView card,int width,int height){
  if (Constants.THUMBNAIL_SIZE_FULL.width + 10 > width) {
    return tryGetThumbnail(card);
  }
  String key=getKey(card,card.getName(),Integer.toString(width));
  BufferedImage original=tryGetImage(key);
  if (original == null) {
    LOGGER.debug(key + "String_Node_Str");
    return null;
  }
  double scale=Math.min((double)width / original.getWidth(),(double)height / original.getHeight());
  if (scale >= 1) {
    return original;
  }
  return TransformedImageCache.getResizedImage(original,(int)(original.getWidth() * scale),(int)(original.getHeight() * scale));
}

Fixed version (ground truth):
/** 
 * Returns the image appropriate to display for a card in a picture panel, but only it was ALREADY LOADED. That is, the call is immediate and will not block on file IO.
 * @param card
 * @param width
 * @param height
 * @return
 */
public static BufferedImage tryGetImage(CardView card,int width,int height){
  if (Constants.THUMBNAIL_SIZE_FULL.width + 10 > width) {
    return tryGetThumbnail(card);
  }
  String key=getKey(card,card.getName(),Integer.toString(width));
  BufferedImage original=tryGetImage(key);
  if (original == null) {
    LOGGER.debug(key + "String_Node_Str");
    return null;
  }
  double scale=Math.min((double)width / original.getWidth(),(double)height / original.getHeight());
  if (scale >= 1) {
    return original;
  }
  return TransformedImageCache.getResizedImage(original,(int)(original.getWidth() * scale),(int)(original.getHeight() * scale));
}
Program: 158314
Project: 158314
Buggy source:
public Ooze2Token(){
  super("String_Node_Str","String_Node_Str");
  cardType.add(CardType.CREATURE);
  subtype.add("String_Node_Str");
  color.setGreen(true);
  power=new MageInt(2);
  toughness=new MageInt(2);
  this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new OozeToken(new MageInt(1),new MageInt(1)),2),false));
}

Fixed version (ground truth):
public Ooze2Token(){
  super("String_Node_Str","String_Node_Str");
  cardType.add(CardType.CREATURE);
  subtype.add("String_Node_Str");
  color.setGreen(true);
  power=new MageInt(2);
  toughness=new MageInt(2);
  this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new OozeToken(1,1),2),false));
}
Program: 158315
Project: 158315
Buggy source:
private void showImage(int row){
  CardView card=view.get(row);
  if (!card.getId().equals(bigCard.getCardId())) {
    if (!MageFrame.isLite()) {
      Image image=Plugins.getInstance().getOriginalImage(card);
      if (image != null && image instanceof BufferedImage) {
        bigCard.setCard(card.getId(),EnlargeMode.NORMAL,image,new ArrayList<String>(),false);
      }
 else {
        drawCardText(card);
      }
    }
 else {
      drawCardText(card);
    }
  }
}

Fixed version (ground truth):
private void showImage(int row){
  CardView card=view.get(row);
  if (!card.getId().equals(bigCard.getCardId())) {
    if (!MageFrame.isLite()) {
      Image image=Plugins.getInstance().getOriginalImage(card);
      if (image != null && image instanceof BufferedImage) {
        bigCard.setCard(card.getId(),EnlargeMode.NORMAL,image,new ArrayList<>(),false);
      }
 else {
        drawCardText(card);
      }
    }
 else {
      drawCardText(card);
    }
  }
}
Program: 158316
Project: 158316
Buggy source:
@Override public boolean joinTable(UUID roomId,UUID tableId,String playerName,String playerType,int skill,DeckCardLists deckList,String password){
  try {
    if (isConnected()) {
      return server.joinTable(sessionId,roomId,tableId,playerName,playerType,skill,deckList,password);
    }
  }
 catch (  InvalidDeckException iex) {
    handleInvalidDeckException(iex);
  }
catch (  GameException ex) {
    handleGameException(ex);
  }
catch (  MageException ex) {
    handleMageException(ex);
  }
catch (  Throwable t) {
    handleThrowable(t);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean joinTable(UUID roomId,UUID tableId,String playerName,String playerType,int skill,DeckCardLists deckList,String password){
  try {
    if (isConnected()) {
      deckList.setCardLayout(null);
      deckList.setSideboardLayout(null);
      return server.joinTable(sessionId,roomId,tableId,playerName,playerType,skill,deckList,password);
    }
  }
 catch (  InvalidDeckException iex) {
    handleInvalidDeckException(iex);
  }
catch (  GameException ex) {
    handleGameException(ex);
  }
catch (  MageException ex) {
    handleMageException(ex);
  }
catch (  Throwable t) {
    handleThrowable(t);
  }
  return false;
}
Program: 158317
Project: 158317
Buggy source:
@Override public boolean updateDeck(UUID tableId,DeckCardLists deck){
  try {
    if (isConnected()) {
      server.updateDeck(sessionId,tableId,deck);
      return true;
    }
  }
 catch (  GameException ex) {
    handleGameException(ex);
  }
catch (  MageException ex) {
    handleMageException(ex);
  }
catch (  Throwable t) {
    handleThrowable(t);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean updateDeck(UUID tableId,DeckCardLists deck){
  try {
    if (isConnected()) {
      deck.setCardLayout(null);
      deck.setSideboardLayout(null);
      server.updateDeck(sessionId,tableId,deck);
      return true;
    }
  }
 catch (  GameException ex) {
    handleGameException(ex);
  }
catch (  MageException ex) {
    handleMageException(ex);
  }
catch (  Throwable t) {
    handleThrowable(t);
  }
  return false;
}
Program: 158318
Project: 158318
Buggy source:
@Override public boolean submitDeck(UUID tableId,DeckCardLists deck){
  try {
    if (isConnected()) {
      return server.submitDeck(sessionId,tableId,deck);
    }
  }
 catch (  GameException ex) {
    handleGameException(ex);
  }
catch (  MageException ex) {
    handleMageException(ex);
  }
catch (  Throwable t) {
    handleThrowable(t);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean submitDeck(UUID tableId,DeckCardLists deck){
  try {
    if (isConnected()) {
      deck.setCardLayout(null);
      deck.setSideboardLayout(null);
      return server.submitDeck(sessionId,tableId,deck);
    }
  }
 catch (  GameException ex) {
    handleGameException(ex);
  }
catch (  MageException ex) {
    handleMageException(ex);
  }
catch (  Throwable t) {
    handleThrowable(t);
  }
  return false;
}
Program: 158319
Project: 158319
Buggy source:
@Override public boolean joinTournamentTable(UUID roomId,UUID tableId,String playerName,String playerType,int skill,DeckCardLists deckList,String password){
  try {
    if (isConnected()) {
      return server.joinTournamentTable(sessionId,roomId,tableId,playerName,playerType,skill,deckList,password);
    }
  }
 catch (  GameException ex) {
    handleGameException(ex);
  }
catch (  MageException ex) {
    handleMageException(ex);
  }
catch (  Throwable t) {
    handleThrowable(t);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean joinTournamentTable(UUID roomId,UUID tableId,String playerName,String playerType,int skill,DeckCardLists deckList,String password){
  try {
    if (isConnected()) {
      deckList.setCardLayout(null);
      deckList.setSideboardLayout(null);
      return server.joinTournamentTable(sessionId,roomId,tableId,playerName,playerType,skill,deckList,password);
    }
  }
 catch (  GameException ex) {
    handleGameException(ex);
  }
catch (  MageException ex) {
    handleMageException(ex);
  }
catch (  Throwable t) {
    handleThrowable(t);
  }
  return false;
}
Program: 158321
Project: 158321
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanent(targetPointer.getFirst(game,source));
  if (permanent != null) {
    if (permanent.moveToZone(Zone.LIBRARY,source.getSourceId(),game,true)) {
      game.getPlayer(permanent.getOwnerId()).shuffleLibrary(source,game);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanent(targetPointer.getFirst(game,source));
  Player controller=game.getPlayer(source.getControllerId());
  if (permanent != null && controller != null) {
    if (controller.moveCards(permanent,Zone.LIBRARY,source,game)) {
      game.getPlayer(permanent.getOwnerId()).shuffleLibrary(source,game);
    }
    return true;
  }
  return false;
}
Program: 158322
Project: 158322
Buggy source:
/** 
 * Set a flag to know, that the ability is only created adn used to check  what's playbable for the player.
 */
void setCheckPlayableMode();

Fixed version (ground truth):
/** 
 * Set a flag to know, that the ability is only created adn used to check what's playbable for the player.
 */
void setCheckPlayableMode();
Program: 158324
Project: 158324
Buggy source:
@Override public void init(Ability source,Game game){
  super.init(source,game);
  if (chooseLandType) {
    Player controller=game.getPlayer(source.getControllerId());
    if (controller != null) {
      Choice choice=new ChoiceBasicLandType();
      controller.choose(outcome,choice,game);
      landTypes.add(choice.getChoice());
    }
 else {
      this.discard();
    }
  }
  if (!loseOther) {
    for (    UUID targetPermanent : targetPointer.getTargets(game,source)) {
      Permanent land=game.getPermanent(targetPermanent);
      if (land != null) {
        for (        String type : land.getSubtype(game)) {
          if (!landTypes.contains(type)) {
            landTypes.add(type);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void init(Ability source,Game game){
  super.init(source,game);
  if (chooseLandType) {
    Player controller=game.getPlayer(source.getControllerId());
    if (controller != null) {
      Choice choice=new ChoiceBasicLandType();
      controller.choose(outcome,choice,game);
      landTypes.add(choice.getChoice());
    }
 else {
      this.discard();
    }
  }
  if (loseOther) {
    landTypesToAdd.addAll(landTypes);
  }
}
Program: 158325
Project: 158325
Buggy source:
public BecomesBasicLandTargetEffect(final BecomesBasicLandTargetEffect effect){
  super(effect);
  this.landTypes.addAll(effect.landTypes);
  this.chooseLandType=effect.chooseLandType;
  this.loseOther=effect.loseOther;
}

Fixed version (ground truth):
public BecomesBasicLandTargetEffect(final BecomesBasicLandTargetEffect effect){
  super(effect);
  this.landTypes.addAll(effect.landTypes);
  this.landTypesToAdd.addAll(effect.landTypesToAdd);
  this.chooseLandType=effect.chooseLandType;
  this.loseOther=effect.loseOther;
}
Program: 158326
Project: 158326
Buggy source:
@Override public boolean apply(Layer layer,SubLayer sublayer,Ability source,Game game){
  for (  UUID targetPermanent : targetPointer.getTargets(game,source)) {
    Permanent land=game.getPermanent(targetPermanent);
    if (land != null) {
switch (layer) {
case TypeChangingEffects_4:
        if (!land.getCardType().contains(CardType.LAND)) {
          land.getCardType().add(CardType.LAND);
        }
      land.removeAllAbilities(source.getSourceId(),game);
    land.getSubtype(game).removeAll(CardRepository.instance.getLandTypes());
  land.getSubtype(game).addAll(landTypes);
break;
case AbilityAddingRemovingEffects_6:
for (String landType : landTypes) {
switch (landType) {
case "String_Node_Str":
  land.addAbility(new BlackManaAbility(),source.getSourceId(),game);
break;
case "String_Node_Str":
land.addAbility(new RedManaAbility(),source.getSourceId(),game);
break;
case "String_Node_Str":
land.addAbility(new GreenManaAbility(),source.getSourceId(),game);
break;
case "String_Node_Str":
land.addAbility(new BlueManaAbility(),source.getSourceId(),game);
break;
case "String_Node_Str":
land.addAbility(new WhiteManaAbility(),source.getSourceId(),game);
break;
}
}
break;
}
}
}
return true;
}

Fixed version (ground truth):
@Override public boolean apply(Layer layer,SubLayer sublayer,Ability source,Game game){
  for (  UUID targetPermanent : targetPointer.getTargets(game,source)) {
    Permanent land=game.getPermanent(targetPermanent);
    if (land != null) {
switch (layer) {
case TypeChangingEffects_4:
        if (!land.getCardType().contains(CardType.LAND)) {
          land.getCardType().add(CardType.LAND);
        }
      if (loseOther) {
        land.removeAllAbilities(source.getSourceId(),game);
        land.getSubtype(game).removeAll(CardRepository.instance.getLandTypes());
        land.getSubtype(game).addAll(landTypes);
      }
 else {
        landTypesToAdd.clear();
        for (        String subtype : landTypes) {
          if (!land.getSubtype(game).contains(subtype)) {
            land.getSubtype(game).add(subtype);
            landTypesToAdd.add(subtype);
          }
        }
      }
    break;
case AbilityAddingRemovingEffects_6:
  for (  String landType : landTypesToAdd) {
switch (landType) {
case "String_Node_Str":
      land.addAbility(new BlackManaAbility(),source.getSourceId(),game);
    break;
case "String_Node_Str":
  land.addAbility(new RedManaAbility(),source.getSourceId(),game);
break;
case "String_Node_Str":
land.addAbility(new GreenManaAbility(),source.getSourceId(),game);
break;
case "String_Node_Str":
land.addAbility(new BlueManaAbility(),source.getSourceId(),game);
break;
case "String_Node_Str":
land.addAbility(new WhiteManaAbility(),source.getSourceId(),game);
break;
}
}
break;
}
}
}
return true;
}
Program: 158327
Project: 158327
Buggy source:
public String saveDeck(Deck deck){
  try {
    String tempDir=System.getProperty("String_Node_Str");
    String deckName="String_Node_Str" + dateFormat.format(new Date());
    File tmp=new File(tempDir + File.separator + deckName+ "String_Node_Str");
    tmp.createNewFile();
    deck.setName(deckName);
    Sets.saveDeck(tmp.getAbsolutePath(),deck.getDeckCardLists());
    cleanUp();
    return tmp.getAbsolutePath();
  }
 catch (  Exception e) {
    JOptionPane.showMessageDialog(null,"String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
public String saveDeck(Deck deck){
  try {
    String tempDir=System.getProperty("String_Node_Str");
    String deckName="String_Node_Str" + dateFormat.format(new Date());
    File tmp=new File(tempDir + File.separator + deckName+ "String_Node_Str");
    tmp.createNewFile();
    deck.setName(deckName);
    Sets.saveDeck(tmp.getAbsolutePath(),deck.getDeckCardLists());
    cleanUp();
    return tmp.getAbsolutePath();
  }
 catch (  Exception e) {
    MageFrame.getInstance().showError("String_Node_Str");
  }
  return null;
}
Program: 158328
Project: 158328
Buggy source:
private static boolean loadSymbolsImages(int size){
  boolean fileErrors=false;
  HashMap<String,BufferedImage> sizedSymbols=new HashMap<>();
  String resourcePath=Constants.RESOURCE_PATH_MANA_SMALL;
  if (size > 25) {
    resourcePath=Constants.RESOURCE_PATH_MANA_LARGE;
  }
 else   if (size > 15) {
    resourcePath=Constants.RESOURCE_PATH_MANA_MEDIUM;
  }
  for (  String symbol : symbols) {
    File file=new File(getSymbolsPath() + resourcePath + "String_Node_Str"+ symbol+ "String_Node_Str");
    try {
      if (size == 15 || size == 25) {
        BufferedImage notResized=ImageIO.read(file);
        sizedSymbols.put(symbol,notResized);
      }
 else {
        Rectangle r=new Rectangle(size,size);
        BufferedImage image=ImageIO.read(file);
        BufferedImage resized=ImageHelper.getResizedImage(image,r);
        sizedSymbols.put(symbol,resized);
      }
    }
 catch (    IOException e) {
      LOGGER.error("String_Node_Str" + symbol);
      fileErrors=true;
    }
  }
  manaImages.put(size,sizedSymbols);
  return !fileErrors;
}

Fixed version (ground truth):
private static boolean loadSymbolsImages(int size){
  boolean fileErrors=false;
  HashMap<String,BufferedImage> sizedSymbols=new HashMap<>();
  String resourcePath=Constants.RESOURCE_PATH_MANA_SMALL;
  if (size > 25) {
    resourcePath=Constants.RESOURCE_PATH_MANA_LARGE;
  }
 else   if (size > 15) {
    resourcePath=Constants.RESOURCE_PATH_MANA_MEDIUM;
  }
  for (  String symbol : symbols) {
    File file=new File(getSymbolsPath() + resourcePath + "String_Node_Str"+ symbol+ "String_Node_Str");
    try {
      if (size == 15 || size == 25) {
        BufferedImage notResized=ImageIO.read(file);
        sizedSymbols.put(symbol,notResized);
      }
 else {
        Rectangle r=new Rectangle(size,size);
        BufferedImage image=ImageIO.read(file);
        if (image != null) {
          BufferedImage resized=ImageHelper.getResizedImage(image,r);
          sizedSymbols.put(symbol,resized);
        }
      }
    }
 catch (    IOException e) {
      LOGGER.error("String_Node_Str" + symbol);
      fileErrors=true;
    }
  }
  manaImages.put(size,sizedSymbols);
  return !fileErrors;
}
Program: 158329
Project: 158329
Buggy source:
public void addSet(ExpansionSet set){
  if (containsKey(set.getCode()))   throw new IllegalArgumentException("String_Node_Str" + set.getCode() + "String_Node_Str");
  this.put(set.getCode(),set);
  if (set.isCustomSet())   customSets.add(set.getCode());
}

Fixed version (ground truth):
public void addSet(ExpansionSet set){
  if (containsKey(set.getCode())) {
    throw new IllegalArgumentException("String_Node_Str" + set.getCode() + "String_Node_Str");
  }
  this.put(set.getCode(),set);
  if (set.isCustomSet()) {
    customSets.add(set.getCode());
  }
}
Program: 158330
Project: 158330
Buggy source:
private static void writeCardLayout(PrintWriter out,DeckCardLayout layout){
  List<List<List<DeckCardInfo>>> cardGrid=layout.getCards();
  int height=cardGrid.size();
  int width=(height > 0) ? cardGrid.get(0).size() : 0;
  out.print("String_Node_Str" + height + "String_Node_Str"+ width+ "String_Node_Str");
  out.print(layout.getSettings());
  out.print("String_Node_Str");
  for (  List<List<DeckCardInfo>> row : cardGrid) {
    for (    List<DeckCardInfo> stack : row) {
      out.print("String_Node_Str");
      for (int i=0; i < stack.size(); ++i) {
        DeckCardInfo info=stack.get(i);
        out.printf("String_Node_Str",info.getSetCode(),info.getCardNum());
        if (i != stack.size() - 1) {
          out.print("String_Node_Str");
        }
      }
      out.print("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private static void writeCardLayout(PrintWriter out,DeckCardLayout layout){
  if (layout == null) {
    return;
  }
  List<List<List<DeckCardInfo>>> cardGrid=layout.getCards();
  int height=cardGrid.size();
  int width=(height > 0) ? cardGrid.get(0).size() : 0;
  out.print("String_Node_Str" + height + "String_Node_Str"+ width+ "String_Node_Str");
  out.print(layout.getSettings());
  out.print("String_Node_Str");
  for (  List<List<DeckCardInfo>> row : cardGrid) {
    for (    List<DeckCardInfo> stack : row) {
      out.print("String_Node_Str");
      for (int i=0; i < stack.size(); ++i) {
        DeckCardInfo info=stack.get(i);
        out.printf("String_Node_Str",info.getSetCode(),info.getCardNum());
        if (i != stack.size() - 1) {
          out.print("String_Node_Str");
        }
      }
      out.print("String_Node_Str");
    }
  }
}
Program: 158331
Project: 158331
Buggy source:
@Override public String getText(Mode mode){
  if (staticText != null && !staticText.isEmpty()) {
    return staticText;
  }
  Target target=mode.getTargets().get(0);
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  if (target.getNumberOfTargets() == 0) {
    sb.append("String_Node_Str");
  }
  if (target.getMaxNumberOfTargets() > 1 || target.getNumberOfTargets() == 0) {
    sb.append(target.getMaxNumberOfTargets()).append("String_Node_Str").append(target.getTargetName()).append("String_Node_Str");
  }
 else {
    if (!target.getTargetName().startsWith("String_Node_Str")) {
      sb.append("String_Node_Str");
    }
    sb.append(target.getTargetName());
  }
  return sb.toString();
}

Fixed version (ground truth):
@Override public String getText(Mode mode){
  if (staticText != null && !staticText.isEmpty()) {
    return staticText;
  }
  Target target=mode.getTargets().get(0);
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  if (target.getNumberOfTargets() == 0) {
    sb.append("String_Node_Str");
  }
  if (target.getMaxNumberOfTargets() > 1 || target.getNumberOfTargets() == 0) {
    sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append("String_Node_Str").append(target.getTargetName()).append("String_Node_Str");
  }
 else {
    if (!target.getTargetName().startsWith("String_Node_Str")) {
      sb.append("String_Node_Str");
    }
    sb.append(target.getTargetName());
  }
  return sb.toString();
}
Program: 158332
Project: 158332
Buggy source:
@Override public boolean canAttack(Game game){
  return true;
}

Fixed version (ground truth):
@Override public boolean canAttack(Game game){
  Ability source=(Ability)getValue("String_Node_Str");
  return game.getBattlefield().count(filter,source.getSourceId(),source.getControllerId(),game) > 0 || HateCondition.getInstance().apply(game,source);
}
Program: 158333
Project: 158333
Buggy source:
@Override public boolean applies(Permanent permanent,Ability source,Game game){
  if (permanent.getId().equals(source.getSourceId())) {
    LifeLossOtherFromCombatWatcher watcher=(LifeLossOtherFromCombatWatcher)game.getState().getWatchers().get("String_Node_Str");
    return watcher != null && watcher.opponentLostLifeOtherFromCombat(source.getControllerId());
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(Permanent permanent,Ability source,Game game){
  if (permanent.getId().equals(source.getSourceId())) {
    setValue("String_Node_Str",source);
    return true;
  }
  return false;
}
Program: 158334
Project: 158334
Buggy source:
@Override public boolean canBlock(Permanent attacker,Permanent blocker,Ability source,Game game){
  return false;
}

Fixed version (ground truth):
@Override public boolean canBlock(Permanent attacker,Permanent blocker,Ability source,Game game){
  return game.getBattlefield().count(filter,source.getSourceId(),source.getControllerId(),game) > 0;
}
Program: 158335
Project: 158335
Buggy source:
@Override public Terentatek2RestrictionEffect copy(){
  return new Terentatek2RestrictionEffect(this);
}

Fixed version (ground truth):
@Override public Terentatek1RestrictionEffect copy(){
  return new Terentatek1RestrictionEffect(this);
}
Program: 158336
Project: 158336
Buggy source:
@Override public boolean apply(Game game,Ability source){
  LifeLossOtherFromCombatWatcher watcher=(LifeLossOtherFromCombatWatcher)game.getState().getWatchers().get(LifeLossOtherFromCombatWatcher.class.getName());
  return watcher != null && watcher.opponentLostLifeOtherFromCombat(source.getControllerId());
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  LifeLossOtherFromCombatWatcher watcher=(LifeLossOtherFromCombatWatcher)game.getState().getWatchers().get(LifeLossOtherFromCombatWatcher.class.getName());
  return watcher != null && watcher.opponentLostLifeOtherFromCombat(source.getControllerId(),game);
}
Program: 158337
Project: 158337
Buggy source:
@Override public boolean pay(Ability ability,Game game,UUID sourceId,UUID controllerId,boolean noMana,Cost costToPay){
  this.cards.clear();
  this.targets.clearChosen();
  Player player=game.getPlayer(controllerId);
  if (player == null) {
    return false;
  }
  int amount=this.getTargets().get(0).getNumberOfTargets();
  if (randomDiscard) {
    this.cards.addAll(player.discard(amount,true,ability,game).getCards(game));
  }
 else {
    if (targets.choose(Outcome.Discard,controllerId,sourceId,game)) {
      for (      UUID targetId : targets.get(0).getTargets()) {
        Card card=player.getHand().get(targetId,game);
        if (card == null) {
          return false;
        }
        player.discard(card,ability,game);
        this.cards.add(card);
      }
    }
  }
  paid=cards.size() >= amount;
  return paid;
}

Fixed version (ground truth):
@Override public boolean pay(Ability ability,Game game,UUID sourceId,UUID controllerId,boolean noMana,Cost costToPay){
  this.cards.clear();
  this.targets.clearChosen();
  Player player=game.getPlayer(controllerId);
  if (player == null) {
    return false;
  }
  int amount=this.getTargets().get(0).getNumberOfTargets();
  if (randomDiscard) {
    this.cards.addAll(player.discard(amount,true,ability,game).getCards(game));
  }
 else   if (targets.choose(Outcome.Discard,controllerId,sourceId,game)) {
    for (    UUID targetId : targets.get(0).getTargets()) {
      Card card=player.getHand().get(targetId,game);
      if (card == null) {
        return false;
      }
      player.discard(card,ability,game);
      this.cards.add(card);
    }
  }
  paid=cards.size() >= amount;
  return paid;
}
Program: 158338
Project: 158338
Buggy source:
public boolean opponentLostLifeOtherFromCombat(UUID playerId){
  return (!players.contains(playerId) && players.size() > 0) || (players.contains(playerId) && players.size() > 1);
}

Fixed version (ground truth):
public boolean opponentLostLifeOtherFromCombat(UUID playerId,Game game){
  Player player=game.getPlayer(playerId);
  if (player != null) {
    if (players.stream().anyMatch((damagedPlayerId) -> (player.hasOpponent(damagedPlayerId,game)))) {
      return true;
    }
  }
  return false;
}
Program: 158339
Project: 158339
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  Permanent permanent=game.getPermanent(event.getTargetId());
  if (permanent != null && filterTarget.match(permanent,source.getSourceId(),source.getControllerId(),game)) {
    StackObject stackObject=game.getStack().getStackObject(event.getSourceId());
    MageObject sourceObject;
    if (stackObject instanceof StackAbility) {
      sourceObject=((StackAbility)stackObject).getSourceObject(game);
    }
 else {
      sourceObject=stackObject;
    }
    if (sourceObject != null && filterSource.match(sourceObject,game)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  Permanent permanent=game.getPermanent(event.getTargetId());
  if (permanent != null && filterTarget.match(permanent,source.getSourceId(),source.getControllerId(),game)) {
    StackObject stackObject=game.getStack().getStackObject(event.getSourceId());
    MageObject sourceObject;
    if (stackObject instanceof StackAbility) {
      if (filterSource instanceof FilterSpell) {
        return false;
      }
      sourceObject=((StackAbility)stackObject).getSourceObject(game);
    }
 else {
      sourceObject=stackObject;
    }
    if (sourceObject != null && filterSource.match(sourceObject,game)) {
      return true;
    }
  }
  return false;
}
Program: 158340
Project: 158340
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    FilterCard filter=new FilterCard();
    filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal,source.getManaCostsToPay().getX()));
    TargetCardInExile target=new TargetCardInExile(filter,CardUtil.getCardExileZoneId(game,source));
    Cards cards=game.getExile().getExileZone(CardUtil.getCardExileZoneId(game,source));
    if (cards.size() > 0 && controller.choose(Outcome.PlayForFree,cards,target,game)) {
      Card card=game.getCard(target.getFirstTarget());
      if (card != null) {
        game.getExile().removeCard(card,game);
        controller.cast(card.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());
  if (controller != null) {
    FilterCard filter=new FilterCard();
    filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal,source.getManaCostsToPay().getX()));
    TargetCardInExile target=new TargetCardInExile(filter,CardUtil.getCardExileZoneId(game,source));
    Cards cards=game.getExile().getExileZone(CardUtil.getCardExileZoneId(game,source));
    if (cards.size() > 0 && controller.choose(Outcome.PlayForFree,cards,target,game)) {
      Card card=game.getCard(target.getFirstTarget());
      if (card != null) {
        controller.cast(card.getSpellAbility(),game,true);
      }
    }
    return true;
  }
  return false;
}
Program: 158342
Project: 158342
Buggy source:
public static void ensureLists(){
  if (getSetsByFormat(ConstructedFormats.STANDARD) == null) {
    buildLists();
  }
}

Fixed version (ground truth):
public static void ensureLists(){
  if (underlyingSetCodesPerFormat.isEmpty()) {
    buildLists();
  }
}
Program: 158345
Project: 158345
Buggy source:
public void userLostConnection(){
  boolean lockSet=false;
  try {
    if (lock.tryLock(5000,TimeUnit.MILLISECONDS)) {
      lockSet=true;
      logger.debug("String_Node_Str" + sessionId);
    }
 else {
      logger.error("String_Node_Str" + userId);
    }
    User user=UserManager.getInstance().getUser(userId);
    if (user == null || !user.isConnected()) {
      return;
    }
    if (!user.getSessionId().equals(sessionId)) {
      logger.info("String_Node_Str" + user.getName());
      return;
    }
    UserManager.getInstance().disconnect(userId,DisconnectReason.LostConnection);
  }
 catch (  InterruptedException ex) {
    logger.error("String_Node_Str" + userId,ex);
  }
 finally {
    if (lockSet) {
      lock.unlock();
      logger.trace("String_Node_Str" + sessionId);
    }
  }
}

Fixed version (ground truth):
public void userLostConnection(){
  boolean lockSet=false;
  try {
    if (lock.tryLock(5000,TimeUnit.MILLISECONDS)) {
      lockSet=true;
      logger.debug("String_Node_Str" + sessionId);
    }
 else {
      logger.error("String_Node_Str" + userId + "String_Node_Str"+ lock.getHoldCount());
    }
    User user=UserManager.getInstance().getUser(userId);
    if (user == null || !user.isConnected()) {
      return;
    }
    if (!user.getSessionId().equals(sessionId)) {
      logger.info("String_Node_Str" + user.getName());
      return;
    }
    UserManager.getInstance().disconnect(userId,DisconnectReason.LostConnection);
  }
 catch (  InterruptedException ex) {
    logger.error("String_Node_Str" + userId,ex);
  }
 finally {
    if (lockSet) {
      lock.unlock();
      logger.trace("String_Node_Str" + sessionId);
    }
  }
}
Program: 158346
Project: 158346
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Mana parley=getMana(game,source);
    if (parley.getAny() > 0) {
      controller.getManaPool().addMana(parley,game,source);
      controller.gainLife(parley.getAny(),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) {
    Mana parley=getMana(game,source);
    if (parley.getGreen() > 0) {
      controller.getManaPool().addMana(parley,game,source);
      controller.gainLife(parley.getAny(),game);
    }
    return true;
  }
  return false;
}
Program: 158348
Project: 158348
Buggy source:
public static void main(String[] args){
  GUISizeHelper.calculateGUISizes();
  Plugins.getInstance().loadPlugins();
  JFrame frame=new JFrame();
  frame.setTitle("String_Node_Str");
  frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  frame.setBackground(Color.BLUE);
  DragCardGrid grid=new DragCardGrid();
  grid.setPreferredSize(new Dimension(800,600));
  frame.add(grid,BorderLayout.CENTER);
  frame.pack();
  frame.setVisible(true);
}

Fixed version (ground truth):
public static void main(String[] args){
  JFrame frame=new JFrame();
  try {
    UIManager.setLookAndFeel("String_Node_Str");
  }
 catch (  UnsupportedLookAndFeelException|ClassNotFoundException|IllegalAccessException|InstantiationException e) {
  }
  frame.setVisible(true);
  JFileChooser choose=new JFileChooser();
  choose.setAcceptAllFileFilterUsed(false);
  choose.addChoosableFileFilter(new DeckFilter());
  choose.showOpenDialog(frame);
  LOGGER.info("String_Node_Str" + choose.getSelectedFile());
  String st="String_Node_Str";
  try {
    st=choose.getSelectedFile().getCanonicalPath();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  LOGGER.info("String_Node_Str" + st);
  choose.setSelectedFile(new File(st));
  choose.showOpenDialog(frame);
  LOGGER.info("String_Node_Str" + choose.getSelectedFile());
  frame.setVisible(false);
}
Program: 158349
Project: 158349
Buggy source:
public void setCards(CardsView cardsView,BigCard bigCard){
  if (bigCard != null) {
    lastBigCard=bigCard;
  }
  boolean didModify=false;
  for (int i=0; i < cardGrid.size(); ++i) {
    ArrayList<ArrayList<CardView>> gridRow=cardGrid.get(i);
    for (int j=0; j < gridRow.size(); ++j) {
      ArrayList<CardView> stack=gridRow.get(j);
      for (int k=0; k < stack.size(); ++k) {
        CardView card=stack.get(k);
        if (!cardsView.containsKey(card.getId())) {
          removeCardView(card);
          stack.remove(k--);
          didModify=true;
        }
      }
    }
  }
  for (  CardView newCard : cardsView.values()) {
    if (!cardViews.containsKey(newCard.getId())) {
      addCardView(newCard);
      try {
        sortIntoGrid(newCard);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
      didModify=true;
    }
  }
  if (didModify) {
    trimGrid();
    layoutGrid();
    cardScroll.revalidate();
    repaint();
  }
}

Fixed version (ground truth):
public void setCards(CardsView cardsView,BigCard bigCard){
  if (bigCard != null) {
    lastBigCard=bigCard;
  }
  boolean didModify=false;
  for (int i=0; i < cardGrid.size(); ++i) {
    ArrayList<ArrayList<CardView>> gridRow=cardGrid.get(i);
    for (int j=0; j < gridRow.size(); ++j) {
      ArrayList<CardView> stack=gridRow.get(j);
      for (int k=0; k < stack.size(); ++k) {
        CardView card=stack.get(k);
        if (!cardsView.containsKey(card.getId())) {
          removeCardView(card);
          stack.remove(k--);
          didModify=true;
        }
      }
    }
  }
  if (didModify) {
    trimGrid();
  }
  for (  CardView newCard : cardsView.values()) {
    if (!cardViews.containsKey(newCard.getId())) {
      addCardView(newCard);
      try {
        sortIntoGrid(newCard);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
      didModify=true;
    }
  }
  if (didModify) {
    layoutGrid();
    cardScroll.revalidate();
    repaint();
  }
}
Program: 158350
Project: 158350
Buggy source:
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt){
  String lastFolder=MageFrame.getPreferences().get("String_Node_Str","String_Node_Str");
  if (!lastFolder.isEmpty()) {
    fcSelectDeck.setCurrentDirectory(new File(lastFolder));
  }
  deck.setName(this.txtDeckName.getText());
  int ret=fcSelectDeck.showSaveDialog(this);
  if (ret == JFileChooser.APPROVE_OPTION) {
    File file=fcSelectDeck.getSelectedFile();
    try {
      String fileName=file.getPath();
      if (!fileName.endsWith("String_Node_Str")) {
        fileName+="String_Node_Str";
      }
      setCursor(new Cursor(Cursor.WAIT_CURSOR));
      Sets.saveDeck(fileName,deck.getDeckCardLists());
    }
 catch (    Exception ex) {
      logger.fatal(ex);
    }
 finally {
      setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
    try {
      MageFrame.getPreferences().put("String_Node_Str",file.getCanonicalPath());
    }
 catch (    IOException ex) {
    }
  }
}

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

Fixed version (ground truth):
private void btnLoadActionPerformed(java.awt.event.ActionEvent evt){
  String lastFolder=MageFrame.getPreferences().get("String_Node_Str","String_Node_Str");
  if (!lastFolder.isEmpty()) {
    fcSelectDeck.setCurrentDirectory(new File(lastFolder));
  }
  int ret=fcSelectDeck.showOpenDialog(this);
  if (ret == JFileChooser.APPROVE_OPTION) {
    File file=fcSelectDeck.getSelectedFile();
{
      if (file == null) {
        if (!lastFolder.isEmpty()) {
          file=new File(lastFolder);
        }
      }
    }
    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);
    }
 finally {
      setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
    refreshDeck();
    try {
      if (file != null) {
        MageFrame.getPreferences().put("String_Node_Str",file.getCanonicalPath());
      }
    }
 catch (    IOException ex) {
    }
  }
  fcSelectDeck.setSelectedFile(null);
}
Program: 158352
Project: 158352
Buggy source:
private Card retrieveTemporaryCard(SimpleCardView cardView){
  Card card=temporaryCards.get(cardView.getId());
  if (card == null) {
    card=CardRepository.instance.findCard(cardView.getExpansionSetCode(),cardView.getCardNumber()).getCard();
  }
 else {
    temporaryCards.remove(cardView.getId());
  }
  return card;
}

Fixed version (ground truth):
private Card retrieveTemporaryCard(SimpleCardView cardView){
  Card card=temporaryCards.get(cardView.getId());
  if (card == null) {
    Logger.getLogger(DeckEditorPanel.class).info("String_Node_Str" + cardView.getCardNumber() + "String_Node_Str");
    card=CardRepository.instance.findCard(cardView.getExpansionSetCode(),cardView.getCardNumber()).getCard();
  }
 else {
    temporaryCards.remove(cardView.getId());
  }
  return card;
}
Program: 158353
Project: 158353
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player defendingPlayer=game.getPlayer(getTargetPointer().getFirst(game,source));
  if (defendingPlayer != null) {
    Target target=new TargetControlledPermanent(2);
    defendingPlayer.chooseTarget(outcome,target,source,game);
    defendingPlayer.moveCards(new CardsImpl(target.getTargets()),Zone.EXILED,source,game);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player defendingPlayer=game.getPlayer(getTargetPointer().getFirst(game,source));
  if (defendingPlayer != null) {
    Target target=new TargetControlledPermanent(2);
    defendingPlayer.chooseTarget(outcome,target,source,game);
    Cards toExile=new CardsImpl();
    target.getTargets().stream().map((targetId) -> game.getPermanent(targetId)).filter((permanent) -> (permanent != null)).forEach((permanent) -> {
      toExile.add(permanent);
    }
);
    defendingPlayer.moveCards(toExile,Zone.EXILED,source,game);
    return true;
  }
  return false;
}
Program: 158354
Project: 158354
Buggy source:
public DarkDecisionMayPlayExiledEffect(final DarkDecisionMayPlayExiledEffect effect){
  super(effect);
  this.card=effect.card;
}

Fixed version (ground truth):
public DarkDecisionMayPlayExiledEffect(final DarkDecisionMayPlayExiledEffect effect){
  super(effect);
}
Program: 158355
Project: 158355
Buggy source:
@Override public boolean applies(UUID sourceId,Ability source,UUID affectedControllerId,Game game){
  Card card=game.getCard(sourceId);
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null && card != null && game.getState().getZone(sourceId) == Zone.EXILED && this.card.equals(sourceId)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(UUID objectId,Ability source,UUID affectedControllerId,Game game){
  if (objectId.equals(getTargetPointer().getFirst(game,source)) && affectedControllerId.equals(source.getSourceId())) {
    ExileZone exileZone=game.getExile().getExileZone(source.getSourceId());
    return exileZone != null && exileZone.contains(getTargetPointer().getFirst(game,source));
  }
  return false;
}
Program: 158356
Project: 158356
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player != null) {
    NonArtifactCreaturesDiedWatcher watcher=(NonArtifactCreaturesDiedWatcher)game.getState().getWatchers().get("String_Node_Str");
    if (watcher != null && watcher.conditionMet()) {
      Permanent permanent=game.getPermanentEntering(source.getSourceId());
      if (permanent != null) {
        permanent.addCounters(CounterType.P1P1.createInstance(1),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) {
    NonArtifactCreaturesDiedWatcher watcher=(NonArtifactCreaturesDiedWatcher)game.getState().getWatchers().get("String_Node_Str");
    if (watcher != null && watcher.conditionMet()) {
      Permanent permanent=game.getPermanentEntering(source.getSourceId());
      if (permanent != null) {
        permanent.addCounters(CounterType.P1P1.createInstance(1),game);
      }
    }
    return true;
  }
  return false;
}
Program: 158357
Project: 158357
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Set<Card> cards=controller.getGraveyard().getCards(filterCard,game);
    for (    Card card : cards) {
      if (card != null) {
        RepairAbility ability=new RepairAbility(6);
        ability.setSourceId(card.getId());
        ability.setControllerId(card.getOwnerId());
        game.getState().addOtherAbility(card,ability);
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Set<Card> cards=controller.getGraveyard().getCards(filterCard,game);
    cards.stream().forEach((card) -> {
      game.getState().addOtherAbility(card,new RepairAbility(6));
    }
);
    return true;
  }
  return false;
}
Program: 158358
Project: 158358
Buggy source:
public YodaEmblem(){
  this.setName("String_Node_Str");
  Effect effect=new GainAbilityControlledEffect(HexproofAbility.getInstance(),Duration.EndOfGame);
  effect.setText("String_Node_Str");
  Ability ability=new SimpleStaticAbility(Zone.COMMAND,effect);
  effect=new GainAbilityControllerEffect(HexproofAbility.getInstance(),Duration.EndOfGame);
  effect.setText("String_Node_Str");
  ability.addEffect(effect);
  getAbilities().add(ability);
}

Fixed version (ground truth):
public YodaEmblem(){
  this.setName("String_Node_Str");
  Effect effect=new GainAbilityControllerEffect(HexproofAbility.getInstance(),Duration.EndOfGame);
  effect.setText("String_Node_Str");
  Ability ability=new SimpleStaticAbility(Zone.COMMAND,effect);
  effect=new GainAbilityControlledEffect(HexproofAbility.getInstance(),Duration.EndOfGame,new FilterCreaturePermanent());
  effect.setText("String_Node_Str");
  ability.addEffect(effect);
  getAbilities().add(ability);
}
Program: 158359
Project: 158359
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player targetPlayer=game.getPlayer(source.getFirstTarget());
  if (targetPlayer != null && !targetPlayer.getHand().isEmpty()) {
    Cards revealed=new CardsImpl();
    Card card=targetPlayer.getHand().getRandom(game);
    revealed.add(card);
    targetPlayer.revealCards("String_Node_Str",revealed,game);
    targetPlayer.loseLife(card.getConvertedManaCost(),game);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player targetPlayer=game.getPlayer(source.getFirstTarget());
  if (targetPlayer != null && !targetPlayer.getHand().isEmpty()) {
    Cards revealed=new CardsImpl();
    Card card=targetPlayer.getHand().getRandom(game);
    revealed.add(card);
    targetPlayer.revealCards("String_Node_Str",revealed,game);
    targetPlayer.loseLife(card.getConvertedManaCost(),game,false);
    return true;
  }
  return false;
}