nus-yam/ex-repair huggingface dataset:
Program: 160136
Project: 160136
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanent(this.sourceId);
  if (permanent == null) {
    return false;
  }
  permanent.setName(target.getName());
  permanent.getColor().setColor(target.getColor());
  permanent.getManaCost().clear();
  permanent.getManaCost().add(target.getManaCost());
  permanent.getCardType().clear();
  for (  CardType type : target.getCardType()) {
    permanent.getCardType().add(type);
  }
  permanent.getSubtype().clear();
  for (  String type : target.getSubtype()) {
    permanent.getSubtype().add(type);
  }
  permanent.getSupertype().clear();
  for (  String type : target.getSupertype()) {
    permanent.getSupertype().add(type);
  }
  permanent.getAbilities().clear();
  for (  Ability ability : target.getAbilities()) {
    permanent.addAbility(ability,game);
  }
  permanent.getPower().setValue(target.getPower().getValue());
  permanent.getToughness().setValue(target.getToughness().getValue());
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanent(this.sourceId);
  if (permanent == null) {
    return false;
  }
  permanent.setName(target.getName());
  permanent.getColor().setColor(target.getColor());
  permanent.getManaCost().clear();
  permanent.getManaCost().add(target.getManaCost());
  permanent.getCardType().clear();
  for (  CardType type : target.getCardType()) {
    permanent.getCardType().add(type);
  }
  permanent.getSubtype().clear();
  for (  String type : target.getSubtype()) {
    permanent.getSubtype().add(type);
  }
  permanent.getSupertype().clear();
  for (  String type : target.getSupertype()) {
    permanent.getSupertype().add(type);
  }
  permanent.getAbilities().clear();
  for (  Ability ability : target.getAbilities()) {
    permanent.addAbility(ability,game);
  }
  permanent.getPower().setValue(target.getPower().getValue());
  permanent.getToughness().setValue(target.getToughness().getValue());
  if (target instanceof Permanent) {
    permanent.setTransformed(((Permanent)target).isTransformed());
    permanent.setSecondCardFace(((Permanent)target).getSecondCardFace());
  }
  return true;
}
Program: 160137
Project: 160137
Buggy source:
public ManaPoolView(ManaPool pool){
  this.red=pool.getRed();
  this.green=pool.getGreen();
  this.blue=pool.getBlue();
  this.white=pool.getWhite();
  this.black=pool.getBlack();
  this.colorless=pool.getColorless();
  for (  ConditionalMana mana : pool.getConditionalMana()) {
    this.red=mana.getRed();
    this.green=mana.getGreen();
    this.blue=mana.getBlue();
    this.white=mana.getWhite();
    this.black=mana.getBlack();
    this.colorless=mana.getColorless();
  }
}

Fixed version (ground truth):
public ManaPoolView(ManaPool pool){
  this.red=pool.getRed();
  this.green=pool.getGreen();
  this.blue=pool.getBlue();
  this.white=pool.getWhite();
  this.black=pool.getBlack();
  this.colorless=pool.getColorless();
  for (  ConditionalMana mana : pool.getConditionalMana()) {
    this.red+=mana.getRed();
    this.green+=mana.getGreen();
    this.blue+=mana.getBlue();
    this.white+=mana.getWhite();
    this.black+=mana.getBlack();
    this.colorless+=mana.getColorless();
  }
}
Program: 160138
Project: 160138
Buggy source:
@Override public boolean checkStateAndTriggered(){
  boolean somethingHappened=false;
  while (!isPaused() && !this.isGameOver()) {
    if (!checkStateBasedActions()) {
      if (isPaused() || this.isGameOver() || !checkTriggered()) {
        break;
      }
    }
    somethingHappened=true;
  }
  return somethingHappened;
}

Fixed version (ground truth):
@Override public boolean checkStateAndTriggered(){
  boolean somethingHappened=false;
  while (!isPaused() && !this.isGameOver()) {
    if (!checkStateBasedActions()) {
      if (isPaused() || this.isGameOver() || !checkTriggered()) {
        break;
      }
    }
    somethingHappened=true;
  }
  resetLKI();
  return somethingHappened;
}
Program: 160139
Project: 160139
Buggy source:
public void sortLayout(){
  Plugins.getInstance().sortPermanents(ui,permanents.values());
  if (battlefield == null) {
    return;
  }
  for (  PermanentView permanent : battlefield.values()) {
    if (permanent.getAttachments() != null) {
      groupAttachments(permanent);
    }
  }
  invalidate();
  repaint();
}

Fixed version (ground truth):
public void sortLayout(){
  int height=Plugins.getInstance().sortPermanents(ui,permanents.values());
  BattlefieldPanel.this.jPanel.setPreferredSize(new Dimension(width - 30,height));
  this.jScrollPane.repaint();
  this.jScrollPane.revalidate();
  if (battlefield == null) {
    return;
  }
  for (  PermanentView permanent : battlefield.values()) {
    if (permanent.getAttachments() != null) {
      groupAttachments(permanent);
    }
  }
  invalidate();
  repaint();
}
Program: 160140
Project: 160140
Buggy source:
@Override public void run(){
  Plugins.getInstance().onRemoveCard((MagePermanent)comp,count);
  comp.setVisible(false);
  BattlefieldPanel.this.remove(comp);
}

Fixed version (ground truth):
@Override public void run(){
  Plugins.getInstance().onRemoveCard((MagePermanent)comp,count);
  comp.setVisible(false);
  BattlefieldPanel.this.jPanel.remove(comp);
}
Program: 160141
Project: 160141
Buggy source:
/** 
 * Creates new form BattlefieldPanel 
 */
public BattlefieldPanel(JScrollPane jScrollPane){
  ui.put("String_Node_Str",jScrollPane);
  ui.put("String_Node_Str",this);
  initComponents();
  addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      sortLayout();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Creates new form BattlefieldPanel 
 */
public BattlefieldPanel(){
  ui.put("String_Node_Str",this);
  initComponents();
  addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      int width=e.getComponent().getWidth();
      int height=e.getComponent().getHeight();
      BattlefieldPanel.this.jScrollPane.setSize(width,height);
      BattlefieldPanel.this.width=width;
      sortLayout();
    }
  }
);
}
Program: 160142
Project: 160142
Buggy source:
private void addPermanent(PermanentView permanent,final int count){
  if (cardDimension == null) {
    cardDimension=new Dimension(Config.dimensions.frameWidth,Config.dimensions.frameHeight);
  }
  final MagePermanent perm=Plugins.getInstance().getMagePermanent(permanent,bigCard,cardDimension,gameId,true);
  if (!Plugins.getInstance().isCardPluginLoaded()) {
    perm.setBounds(findEmptySpace(new Dimension(Config.dimensions.frameWidth,Config.dimensions.frameHeight)));
  }
 else {
  }
  permanents.put(permanent.getId(),perm);
  BattlefieldPanel.this.add(perm,10);
  if (!Plugins.getInstance().isCardPluginLoaded()) {
    moveToFront(perm);
    perm.update(permanent);
  }
 else {
    Plugins.getInstance().onAddCard(perm,1);
  }
}

Fixed version (ground truth):
private void addPermanent(PermanentView permanent,final int count){
  if (cardDimension == null) {
    cardDimension=new Dimension(Config.dimensions.frameWidth,Config.dimensions.frameHeight);
  }
  final MagePermanent perm=Plugins.getInstance().getMagePermanent(permanent,bigCard,cardDimension,gameId,true);
  if (!Plugins.getInstance().isCardPluginLoaded()) {
    perm.setBounds(findEmptySpace(new Dimension(Config.dimensions.frameWidth,Config.dimensions.frameHeight)));
  }
 else {
  }
  permanents.put(permanent.getId(),perm);
  this.jPanel.add(perm);
  if (!Plugins.getInstance().isCardPluginLoaded()) {
    moveToFront(perm);
    perm.update(permanent);
  }
 else {
    Plugins.getInstance().onAddCard(perm,1);
  }
}
Program: 160143
Project: 160143
Buggy source:
private void initComponents(){
  setOpaque(true);
}

Fixed version (ground truth):
private void initComponents(){
  setOpaque(true);
  jPanel=new JPanel();
  jPanel.setLayout(null);
  jScrollPane=new JScrollPane(jPanel);
  Border empty=new EmptyBorder(0,0,0,0);
  jScrollPane.setBorder(empty);
  jScrollPane.setViewportBorder(empty);
  this.add(jScrollPane);
}
Program: 160144
Project: 160144
Buggy source:
@Override public void componentResized(ComponentEvent e){
  sortLayout();
}

Fixed version (ground truth):
@Override public void componentResized(ComponentEvent e){
  int width=e.getComponent().getWidth();
  int height=e.getComponent().getHeight();
  BattlefieldPanel.this.jScrollPane.setSize(width,height);
  BattlefieldPanel.this.width=width;
  sortLayout();
}
Program: 160145
Project: 160145
Buggy source:
private void removePermanent(UUID permanentId,final int count){
  for (  Component c : this.getComponents()) {
    final Component comp=c;
    if (comp instanceof Permanent) {
      if (((Permanent)comp).getPermanentId().equals(permanentId)) {
        comp.setVisible(false);
        this.remove(comp);
      }
    }
 else     if (comp instanceof MagePermanent) {
      if (((MagePermanent)comp).getOriginal().getId().equals(permanentId)) {
        Thread t=new Thread(new Runnable(){
          @Override public void run(){
            Plugins.getInstance().onRemoveCard((MagePermanent)comp,count);
            comp.setVisible(false);
            BattlefieldPanel.this.remove(comp);
          }
        }
);
        t.start();
      }
    }
  }
}

Fixed version (ground truth):
private void removePermanent(UUID permanentId,final int count){
  for (  Component c : this.jPanel.getComponents()) {
    final Component comp=c;
    if (comp instanceof Permanent) {
      if (((Permanent)comp).getPermanentId().equals(permanentId)) {
        comp.setVisible(false);
        this.jPanel.remove(comp);
      }
    }
 else     if (comp instanceof MagePermanent) {
      if (((MagePermanent)comp).getOriginal().getId().equals(permanentId)) {
        Thread t=new Thread(new Runnable(){
          @Override public void run(){
            Plugins.getInstance().onRemoveCard((MagePermanent)comp,count);
            comp.setVisible(false);
            BattlefieldPanel.this.jPanel.remove(comp);
          }
        }
);
        t.start();
      }
    }
  }
}
Program: 160147
Project: 160147
Buggy source:
public void sizePlayer(boolean smallMode){
  this.playerPanel.sizePlayerPanel(smallMode);
  if (smallMode) {
    this.playerPanel.setPreferredSize(new Dimension(92,160));
    this.jScrollPane1.setPreferredSize(new Dimension(160,160));
  }
 else {
    this.playerPanel.setPreferredSize(new Dimension(92,212));
    this.jScrollPane1.setPreferredSize(new Dimension(160,212));
  }
}

Fixed version (ground truth):
public void sizePlayer(boolean smallMode){
  this.playerPanel.sizePlayerPanel(smallMode);
  if (smallMode) {
    this.playerPanel.setPreferredSize(new Dimension(92,160));
    this.battlefieldPanel.setPreferredSize(new Dimension(160,160));
  }
 else {
    this.playerPanel.setPreferredSize(new Dimension(92,212));
    this.battlefieldPanel.setPreferredSize(new Dimension(160,212));
  }
}
Program: 160148
Project: 160148
Buggy source:
private void initComponents(){
  setBorder(BorderFactory.createLineBorder(new Color(0,0,0,0)));
  playerPanel=new PlayerPanelExt();
  btnCheat=new javax.swing.JButton();
  jScrollPane1=new javax.swing.JScrollPane();
  battlefieldPanel=new mage.client.game.BattlefieldPanel(jScrollPane1);
  btnCheat.setText("String_Node_Str");
  btnCheat.addActionListener(new java.awt.event.ActionListener(){
    @Override public void actionPerformed(    java.awt.event.ActionEvent evt){
      btnCheatActionPerformed(evt);
    }
  }
);
  jScrollPane1.setViewportView(battlefieldPanel);
  Border empty=new EmptyBorder(0,0,0,0);
  jScrollPane1.setBorder(empty);
  jScrollPane1.setViewportBorder(empty);
  javax.swing.GroupLayout layout=new javax.swing.GroupLayout(this);
  layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(playerPanel,GroupLayout.PREFERRED_SIZE,GroupLayout.DEFAULT_SIZE,GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addComponent(jScrollPane1,0,GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE));
  layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(playerPanel,GroupLayout.PREFERRED_SIZE,GroupLayout.DEFAULT_SIZE,GroupLayout.PREFERRED_SIZE).addComponent(jScrollPane1,GroupLayout.DEFAULT_SIZE,160,Short.MAX_VALUE));
  this.setLayout(layout);
}

Fixed version (ground truth):
private void initComponents(){
  setBorder(BorderFactory.createLineBorder(new Color(0,0,0,0)));
  playerPanel=new PlayerPanelExt();
  btnCheat=new javax.swing.JButton();
  battlefieldPanel=new mage.client.game.BattlefieldPanel();
  btnCheat.setText("String_Node_Str");
  btnCheat.addActionListener(new java.awt.event.ActionListener(){
    @Override public void actionPerformed(    java.awt.event.ActionEvent evt){
      btnCheatActionPerformed(evt);
    }
  }
);
  javax.swing.GroupLayout layout=new javax.swing.GroupLayout(this);
  layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(playerPanel,GroupLayout.PREFERRED_SIZE,GroupLayout.DEFAULT_SIZE,GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addComponent(battlefieldPanel,0,GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE));
  layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(playerPanel,GroupLayout.PREFERRED_SIZE,GroupLayout.DEFAULT_SIZE,GroupLayout.PREFERRED_SIZE).addComponent(battlefieldPanel,GroupLayout.DEFAULT_SIZE,160,Short.MAX_VALUE));
  this.setLayout(layout);
}
Program: 160149
Project: 160149
Buggy source:
void sortPermanents(Map<String,JComponent> ui,Collection<MagePermanent> permanents);

Fixed version (ground truth):
int sortPermanents(Map<String,JComponent> ui,Collection<MagePermanent> permanents);
Program: 160150
Project: 160150
Buggy source:
@Override public void sortPermanents(Map<String,JComponent> ui,Collection<MagePermanent> permanents){
  sortingOptions.put("String_Node_Str",PreferencesDialog.getCachedValue("String_Node_Str","String_Node_Str"));
  if (this.cardPlugin != null)   this.cardPlugin.sortPermanents(ui,permanents,sortingOptions);
}

Fixed version (ground truth):
@Override public int sortPermanents(Map<String,JComponent> ui,Collection<MagePermanent> permanents){
  sortingOptions.put("String_Node_Str",PreferencesDialog.getCachedValue("String_Node_Str","String_Node_Str"));
  if (this.cardPlugin != null)   return this.cardPlugin.sortPermanents(ui,permanents,sortingOptions);
  return -1;
}
Program: 160152
Project: 160152
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Card card=game.getCard(source.getSourceId());
  if (card != null && (card.getCardType().contains(CardType.ARTIFACT) || card.getCardType().contains(CardType.CREATURE))) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  if (source instanceof SpellAbility) {
    Card card=game.getCard(source.getSourceId());
    if (card != null && (card.getCardType().contains(CardType.ARTIFACT) || card.getCardType().contains(CardType.CREATURE))) {
      return true;
    }
  }
  return false;
}
Program: 160153
Project: 160153
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player == null)   return false;
  if (player.searchLibrary(target,game)) {
    if (target.getTargets().size() > 0) {
      for (      UUID cardId : (List<UUID>)target.getTargets()) {
        Card card=player.getLibrary().getCard(cardId,game);
        if (card != null) {
          if (card.putOntoBattlefield(game,Zone.HAND,source.getId(),source.getControllerId())) {
            if (tapped) {
              Permanent permanent=game.getPermanent(card.getId());
              if (permanent != null)               permanent.setTapped(true);
            }
          }
        }
      }
    }
    player.shuffleLibrary(game);
    return true;
  }
  if (forceShuffle)   player.shuffleLibrary(game);
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player == null)   return false;
  if (player.searchLibrary(target,game)) {
    if (target.getTargets().size() > 0) {
      for (      UUID cardId : (List<UUID>)target.getTargets()) {
        Card card=player.getLibrary().getCard(cardId,game);
        if (card != null) {
          if (card.putOntoBattlefield(game,Zone.LIBRARY,source.getId(),source.getControllerId())) {
            if (tapped) {
              Permanent permanent=game.getPermanent(card.getId());
              if (permanent != null)               permanent.setTapped(true);
            }
          }
        }
      }
    }
    player.shuffleLibrary(game);
    return true;
  }
  if (forceShuffle)   player.shuffleLibrary(game);
  return false;
}
Program: 160154
Project: 160154
Buggy source:
@Override public boolean putOntoBattlefield(Game game,Zone fromZone,UUID sourceId,UUID controllerId){
  ZoneChangeEvent event=new ZoneChangeEvent(this.objectId,sourceId,controllerId,fromZone,Zone.BATTLEFIELD);
  if (!game.replaceEvent(event)) {
    if (fromZone != null) {
switch (fromZone) {
case GRAVEYARD:
        game.getPlayer(ownerId).removeFromGraveyard(this,game);
      break;
case HAND:
    game.getPlayer(ownerId).removeFromHand(this,game);
  break;
case LIBRARY:
game.getPlayer(ownerId).removeFromLibrary(this,game);
break;
default :
}
game.rememberLKI(objectId,event.getFromZone(),this);
}
PermanentCard permanent=new PermanentCard(this,controllerId);
game.getBattlefield().addPermanent(permanent);
game.setZone(objectId,Zone.BATTLEFIELD);
game.applyEffects();
permanent.entersBattlefield(sourceId,game);
game.applyEffects();
game.fireEvent(new ZoneChangeEvent(permanent,controllerId,fromZone,Zone.BATTLEFIELD));
return true;
}
return false;
}

Fixed version (ground truth):
@Override public boolean putOntoBattlefield(Game game,Zone fromZone,UUID sourceId,UUID controllerId){
  ZoneChangeEvent event=new ZoneChangeEvent(this.objectId,sourceId,controllerId,fromZone,Zone.BATTLEFIELD);
  if (!game.replaceEvent(event)) {
    if (fromZone != null) {
      boolean removed=false;
switch (fromZone) {
case GRAVEYARD:
        removed=game.getPlayer(ownerId).removeFromGraveyard(this,game);
      break;
case HAND:
    removed=game.getPlayer(ownerId).removeFromHand(this,game);
  break;
case LIBRARY:
removed=game.getPlayer(ownerId).removeFromLibrary(this,game);
break;
default :
}
game.rememberLKI(objectId,event.getFromZone(),this);
if (!removed) {
logger.warn("String_Node_Str" + getName() + "String_Node_Str"+ fromZone);
}
}
PermanentCard permanent=new PermanentCard(this,controllerId);
game.getBattlefield().addPermanent(permanent);
game.setZone(objectId,Zone.BATTLEFIELD);
game.applyEffects();
permanent.entersBattlefield(sourceId,game);
game.applyEffects();
game.fireEvent(new ZoneChangeEvent(permanent,controllerId,fromZone,Zone.BATTLEFIELD));
return true;
}
return false;
}
Program: 160155
Project: 160155
Buggy source:
private static void loadPhases(Preferences prefs){
  load(prefs,dialog.checkBoxUpkeepYou,UPKEEP_YOU);
  load(prefs,dialog.checkBoxDrawYou,DRAW_YOU);
  load(prefs,dialog.checkBoxMainYou,MAIN_YOU);
  load(prefs,dialog.checkBoxBeforeCYou,BEFORE_COMBAT_YOU);
  load(prefs,dialog.checkBoxEndOfCYou,END_OF_COMBAT_YOU);
  load(prefs,dialog.checkBoxMain2You,MAIN_2_YOU);
  load(prefs,dialog.checkBoxEndTurnYou,END_OF_TURN_YOU);
  load(prefs,dialog.checkBoxUpkeepOthers,UPKEEP_OTHERS);
  load(prefs,dialog.checkBoxDrawOthers,DRAW_OTHERS);
  load(prefs,dialog.checkBoxMainOthers,MAIN_OTHERS);
  load(prefs,dialog.checkBoxBeforeCOthers,BEFORE_COMBAT_OTHERS);
  load(prefs,dialog.checkBoxEndOfCOthers,END_OF_COMBAT_OTHERS);
  load(prefs,dialog.checkBoxMain2Others,MAIN_2_OTHERS);
  load(prefs,dialog.checkBoxEndTurnOthers,END_OF_TURN_OTHERS);
  load(prefs,dialog.displayBigCardsInHand,KEY_HAND_USE_BIG_CARDS,"String_Node_Str");
  load(prefs,dialog.showToolTipsInHand,KEY_HAND_SHOW_TOOLTIPS,"String_Node_Str");
  load(prefs,dialog.nonLandPermanentsInOnePile,KEY_PERMANENTS_IN_ONE_PILE,"String_Node_Str");
}

Fixed version (ground truth):
private static void loadPhases(Preferences prefs){
  load(prefs,dialog.checkBoxUpkeepYou,UPKEEP_YOU);
  load(prefs,dialog.checkBoxDrawYou,DRAW_YOU);
  load(prefs,dialog.checkBoxMainYou,MAIN_YOU);
  load(prefs,dialog.checkBoxBeforeCYou,BEFORE_COMBAT_YOU);
  load(prefs,dialog.checkBoxEndOfCYou,END_OF_COMBAT_YOU);
  load(prefs,dialog.checkBoxMain2You,MAIN_2_YOU);
  load(prefs,dialog.checkBoxEndTurnYou,END_OF_TURN_YOU);
  load(prefs,dialog.checkBoxUpkeepOthers,UPKEEP_OTHERS);
  load(prefs,dialog.checkBoxDrawOthers,DRAW_OTHERS);
  load(prefs,dialog.checkBoxMainOthers,MAIN_OTHERS);
  load(prefs,dialog.checkBoxBeforeCOthers,BEFORE_COMBAT_OTHERS);
  load(prefs,dialog.checkBoxEndOfCOthers,END_OF_COMBAT_OTHERS);
  load(prefs,dialog.checkBoxMain2Others,MAIN_2_OTHERS);
  load(prefs,dialog.checkBoxEndTurnOthers,END_OF_TURN_OTHERS);
  load(prefs,dialog.displayBigCardsInHand,KEY_HAND_USE_BIG_CARDS,"String_Node_Str");
  load(prefs,dialog.showToolTipsInAnyZone,KEY_SHOW_TOOLTIPS_ANY_ZONE,"String_Node_Str");
  load(prefs,dialog.nonLandPermanentsInOnePile,KEY_PERMANENTS_IN_ONE_PILE,"String_Node_Str");
}
Program: 160159
Project: 160159
Buggy source:
public void updateSize(String size){
  if (size.equals("String_Node_Str")) {
    this.conf=new _3x3Configuration();
  }
 else   if (size.equals("String_Node_Str")) {
    this.conf=new _4x4Configuration();
  }
 else {
    return;
  }
  setSize(conf.WIDTH,conf.HEIGHT);
  setPreferredSize(new Dimension(conf.WIDTH,conf.HEIGHT));
  setMinimumSize(new Dimension(conf.WIDTH,conf.HEIGHT));
  pageRight.setBounds(conf.WIDTH - 2 * LEFT_RIGHT_PAGES_WIDTH - 64,0,64,64);
  addSetTabs();
  showCards();
}

Fixed version (ground truth):
public void updateSize(String size){
  if (size.equals(LAYOUT_3x3)) {
    this.conf=new _3x3Configuration();
  }
 else   if (size.equals(LAYOUT_4x4)) {
    this.conf=new _4x4Configuration();
  }
 else {
    return;
  }
  currentPage=0;
  pageLeft.setVisible(false);
  setSize(conf.WIDTH,conf.HEIGHT);
  setPreferredSize(new Dimension(conf.WIDTH,conf.HEIGHT));
  setMinimumSize(new Dimension(conf.WIDTH,conf.HEIGHT));
  pageRight.setBounds(conf.WIDTH - 2 * LEFT_RIGHT_PAGES_WIDTH - 64,0,64,64);
  addSetTabs();
  showCards();
}
Program: 160160
Project: 160160
Buggy source:
@Override public void beginStep(Game game,UUID activePlayerId){
  Player activePlayer=game.getPlayer(activePlayerId);
  activePlayer.drawCards(1,game);
  super.beginStep(game,activePlayerId);
}

Fixed version (ground truth):
@Override public void beginStep(Game game,UUID activePlayerId){
  Player activePlayer=game.getPlayer(activePlayerId);
  activePlayer.drawCards(1,game);
  game.applyEffects();
  super.beginStep(game,activePlayerId);
}
Program: 160161
Project: 160161
Buggy source:
@Override public boolean isInUseableZone(Game game){
  Zone test=game.getState().getZone(sourceId);
  return test != null && zone.match(test);
}

Fixed version (ground truth):
@Override public boolean isInUseableZone(Game game){
  MageObject lkiTest=game.getLastKnownInformation(getSourceId(),zone);
  if (lkiTest != null) {
    return true;
  }
  Zone test=game.getState().getZone(sourceId);
  return test != null && zone.match(test);
}
Program: 160162
Project: 160162
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) {
    ZoneChangeEvent zEvent=(ZoneChangeEvent)event;
    if (zEvent.getFromZone() == Constants.Zone.BATTLEFIELD && zEvent.getToZone() == Constants.Zone.GRAVEYARD) {
      Permanent p=(Permanent)game.getLastKnownInformation(event.getTargetId(),Constants.Zone.BATTLEFIELD);
      if (p != null && p.getControllerId().equals(this.controllerId)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) {
    ZoneChangeEvent zEvent=(ZoneChangeEvent)event;
    if (zEvent.getFromZone() == Constants.Zone.BATTLEFIELD && zEvent.getToZone() == Constants.Zone.GRAVEYARD) {
      Permanent p=(Permanent)game.getLastKnownInformation(event.getTargetId(),Constants.Zone.BATTLEFIELD);
      if (p != null && p.getControllerId().equals(this.controllerId) && filter.match(p)) {
        return true;
      }
    }
  }
  return false;
}
Program: 160163
Project: 160163
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
    UUID sourceId=getSourceId();
    if (game.getPermanent(sourceId) == null) {
      if (game.getLastKnownInformation(sourceId,Constants.Zone.BATTLEFIELD) == null) {
        return false;
      }
    }
    ZoneChangeEvent zEvent=(ZoneChangeEvent)event;
    Permanent permanent=zEvent.getTarget();
    if (permanent != null && permanent.getCardType().contains(Constants.CardType.CREATURE) && zEvent.isDiesEvent() && permanent.getControllerId().equals(this.getControllerId())) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
    UUID sourceId=getSourceId();
    if (game.getPermanent(sourceId) == null) {
      if (game.getLastKnownInformation(sourceId,Constants.Zone.BATTLEFIELD) == null) {
        return false;
      }
    }
    ZoneChangeEvent zEvent=(ZoneChangeEvent)event;
    Permanent permanent=zEvent.getTarget();
    if (permanent != null && permanent.getCardType().contains(Constants.CardType.CREATURE) && zEvent.isDiesEvent() && permanent.getControllerId().equals(this.getControllerId()) && filter != null && filter.match(permanent)) {
      return true;
    }
  }
  return false;
}
Program: 160164
Project: 160164
Buggy source:
@Override public int damage(int damage,UUID sourceId,Game game,boolean combatDamage,boolean preventable){
  if (damage > 0 && canDamage(game.getObject(sourceId))) {
    GameEvent event=new DamagePlayerEvent(playerId,sourceId,playerId,damage,preventable,combatDamage);
    if (!game.replaceEvent(event)) {
      int actualDamage=event.getAmount();
      if (actualDamage > 0) {
        Permanent source=game.getPermanent(sourceId);
        if (source != null && (source.getAbilities().containsKey(InfectAbility.getInstance().getId()))) {
          addCounters(CounterType.POISON.createInstance(actualDamage),game);
        }
 else {
          this.loseLife(actualDamage,game);
        }
        if (source != null && source.getAbilities().containsKey(LifelinkAbility.getInstance().getId())) {
          Player player=game.getPlayer(source.getControllerId());
          player.gainLife(damage,game);
        }
        game.fireEvent(new DamagedPlayerEvent(playerId,sourceId,playerId,actualDamage,combatDamage));
        return actualDamage;
      }
    }
  }
  return 0;
}

Fixed version (ground truth):
@Override public int damage(int damage,UUID sourceId,Game game,boolean combatDamage,boolean preventable){
  if (damage > 0 && canDamage(game.getObject(sourceId))) {
    GameEvent event=new DamagePlayerEvent(playerId,sourceId,playerId,damage,preventable,combatDamage);
    if (!game.replaceEvent(event)) {
      int actualDamage=event.getAmount();
      if (actualDamage > 0) {
        Permanent source=game.getPermanent(sourceId);
        if (source == null) {
          MageObject lastKnownInformation=game.getLastKnownInformation(sourceId,Zone.BATTLEFIELD);
          if (lastKnownInformation instanceof Permanent) {
            source=(Permanent)lastKnownInformation;
          }
        }
        if (source != null && (source.getAbilities().containsKey(InfectAbility.getInstance().getId()))) {
          addCounters(CounterType.POISON.createInstance(actualDamage),game);
        }
 else {
          this.loseLife(actualDamage,game);
        }
        if (source != null && source.getAbilities().containsKey(LifelinkAbility.getInstance().getId())) {
          Player player=game.getPlayer(source.getControllerId());
          player.gainLife(damage,game);
        }
        game.fireEvent(new DamagedPlayerEvent(playerId,sourceId,playerId,actualDamage,combatDamage));
        return actualDamage;
      }
    }
  }
  return 0;
}
Program: 160165
Project: 160165
Buggy source:
public void setAllowBadMoves(boolean allowBadMoves){
}

Fixed version (ground truth):
@Override public void setAllowBadMoves(boolean allowBadMoves){
}
Program: 160167
Project: 160167
Buggy source:
private void runEmbeddedMageServer(){
  if (embeddedMageServerAction != null) {
    embeddedMageServerAction.execute();
  }
}

Fixed version (ground truth):
private void runEmbeddedMageServer(){
  if (embeddedMageServerAction != null) {
    try {
      embeddedMageServerAction.execute();
    }
 catch (    MageException e) {
      logger.error(e);
    }
  }
}
Program: 160168
Project: 160168
Buggy source:
@Override public void run(){
  if (SessionManager.getInstance().isValidSession(sessionId)) {
    try {
      action.execute();
    }
 catch (    MageException me) {
      throw new RuntimeException(me);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (SessionManager.getInstance().isValidSession(sessionId)) {
    try {
      action.execute();
    }
 catch (    MageException me) {
      throw new RuntimeException(me);
    }
  }
 else {
    LogServiceImpl.instance.log(LogKeys.KEY_NOT_VALID_SESSION_INTERNAL,actionName,sessionId);
  }
}
Program: 160169
Project: 160169
Buggy source:
protected void execute(final String actionName,final String sessionId,final Action action) throws MageException {
  if (SessionManager.getInstance().isValidSession(sessionId)) {
    try {
      callExecutor.execute(new Runnable(){
        @Override public void run(){
          if (SessionManager.getInstance().isValidSession(sessionId)) {
            try {
              action.execute();
            }
 catch (            MageException me) {
              throw new RuntimeException(me);
            }
          }
        }
      }
);
    }
 catch (    Exception ex) {
      handleException(ex);
    }
  }
 else {
    LogServiceImpl.instance.log(LogKeys.KEY_NOT_VALID_SESSION,actionName,sessionId);
  }
}

Fixed version (ground truth):
protected void execute(final String actionName,final String sessionId,final Action action) throws MageException {
  if (SessionManager.getInstance().isValidSession(sessionId)) {
    try {
      callExecutor.execute(new Runnable(){
        @Override public void run(){
          if (SessionManager.getInstance().isValidSession(sessionId)) {
            try {
              action.execute();
            }
 catch (            MageException me) {
              throw new RuntimeException(me);
            }
          }
 else {
            LogServiceImpl.instance.log(LogKeys.KEY_NOT_VALID_SESSION_INTERNAL,actionName,sessionId);
          }
        }
      }
);
    }
 catch (    Exception ex) {
      handleException(ex);
    }
  }
 else {
    LogServiceImpl.instance.log(LogKeys.KEY_NOT_VALID_SESSION,actionName,sessionId);
  }
}
Program: 160170
Project: 160170
Buggy source:
public boolean updateProjectRelease(ProjectRelease release){
  boolean found=false;
  List<ProjectRelease> releases=getProjectReleases();
  for (int i=0; i < releases.size(); i++) {
    ProjectRelease projectRelease=releases.get(i);
    if (release.getRepository() != null && release.getRepository().equals(projectRelease.getRepository())) {
      release.setRepository(projectRelease.getRepository());
    }
    if (projectRelease.getVersion().equals(release)) {
      releases.set(i,release);
      found=true;
      break;
    }
  }
  if (!found) {
    releases.add(release);
  }
  release.replaceVersionPattern();
  return found;
}

Fixed version (ground truth):
public boolean updateProjectRelease(ProjectRelease release){
  boolean found=false;
  List<ProjectRelease> releases=getProjectReleases();
  for (int i=0; i < releases.size(); i++) {
    ProjectRelease projectRelease=releases.get(i);
    if (release.getRepository() != null && release.getRepository().equals(projectRelease.getRepository())) {
      release.setRepository(projectRelease.getRepository());
    }
    if (projectRelease.getVersion().equals(release.getVersion())) {
      releases.set(i,release);
      found=true;
      break;
    }
  }
  if (!found) {
    releases.add(release);
  }
  release.replaceVersionPattern();
  return found;
}
Program: 160171
Project: 160171
Buggy source:
@Test public void projectMetadata_updateProject() throws Exception {
  Project project=service.getProject("String_Node_Str");
  List<Map<String,Object>> releases=new ArrayList<>();
  for (  ProjectRelease release : project.getProjectReleases()) {
    release=release.createWithVersionPattern();
    Map<String,Object> map=getRelease(release);
    releases.add(map);
  }
  project.getProjectReleases().iterator().next().setVersion("String_Node_Str");
  mockMvc.perform(MockMvcRequestBuilders.put("String_Node_Str").content(mapper.writeValueAsString(releases)).contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith("String_Node_Str")).andDo(docs("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void projectMetadata_updateProject() throws Exception {
  Project project=service.getProject("String_Node_Str");
  List<Map<String,Object>> releases=new ArrayList<>();
  for (  ProjectRelease release : project.getProjectReleases()) {
    release=release.createWithVersionPattern();
    Map<String,Object> map=getRelease(release);
    releases.add(map);
  }
  releases.iterator().next().put("String_Node_Str","String_Node_Str");
  mockMvc.perform(MockMvcRequestBuilders.put("String_Node_Str").content(mapper.writeValueAsString(releases)).contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith("String_Node_Str")).andDo(docs("String_Node_Str"));
  entityManager.flush();
}
Program: 160172
Project: 160172
Buggy source:
public List<ProjectRelease> getProjectReleases(){
  return releaseList;
}

Fixed version (ground truth):
public List<ProjectRelease> getProjectReleases(){
  releaseList.sort((release1,release2) -> {
    if (release1.getVersion() == null || release2.getVersion() == null) {
      return 0;
    }
    return release1.getVersion().compareTo(release2.getVersion());
  }
);
  releaseList.sort(ProjectRelease::compareTo);
  return releaseList;
}
Program: 160173
Project: 160173
Buggy source:
@Override public int compareTo(ProjectRelease other){
  return versionName.compareTo(other.versionName);
}

Fixed version (ground truth):
@Override public int compareTo(ProjectRelease other){
  if (this.getVersion() == null || other.getVersion() == null) {
    return 0;
  }
  Pattern pattern=Pattern.compile("String_Node_Str");
  Matcher thisMatcher=pattern.matcher(this.getVersion());
  Matcher otherMatcher=pattern.matcher(other.getVersion());
  int versionDiff=0;
  boolean thisFind=thisMatcher.find();
  boolean otherFind=otherMatcher.find();
  while (thisFind && otherFind) {
    int thisFoundVersion=Integer.parseInt(thisMatcher.group(0));
    int otherFoundVersion=Integer.parseInt(otherMatcher.group(0));
    versionDiff=otherFoundVersion - thisFoundVersion;
    if (versionDiff != 0) {
      return versionDiff;
    }
    thisFind=thisMatcher.find();
    otherFind=otherMatcher.find();
  }
  if (thisFind) {
    return -1;
  }
  if (otherFind) {
    return 1;
  }
  return versionDiff;
}
Program: 160174
Project: 160174
Buggy source:
private void updateMemberProfile(MemberProfile profile,MemberProfile existingProfile){
  existingProfile.setSpeakerdeckUsername(profile.getSpeakerdeckUsername());
  existingProfile.setTwitterUsername(profile.getTwitterUsername());
  existingProfile.setBio(profile.getBio());
  existingProfile.setName(profile.getName());
  existingProfile.setJobTitle(profile.getJobTitle());
  existingProfile.setTwitterUsername(profile.getTwitterUsername());
  existingProfile.setSpeakerdeckUsername(profile.getSpeakerdeckUsername());
  existingProfile.setLanyrdUsername(profile.getLanyrdUsername());
  existingProfile.setGplusId(profile.getGplusId());
  existingProfile.setLocation(profile.getLocation());
  existingProfile.setGeoLocation(profile.getGeoLocation());
  existingProfile.setVideoEmbeds(profile.getVideoEmbeds());
  existingProfile.setGravatarEmail(profile.getGravatarEmail());
  existingProfile.setHidden(profile.isHidden());
  if (!StringUtils.isEmpty(profile.getGravatarEmail())) {
    Md5PasswordEncoder encoder=new Md5PasswordEncoder();
    String hashedEmail=encoder.encodePassword(profile.getGravatarEmail(),null);
    existingProfile.setAvatarUrl(String.format("String_Node_Str",hashedEmail));
  }
  teamRepository.save(existingProfile);
  try {
    searchService.saveToIndex(mapper.map(existingProfile));
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + existingProfile.getId(),e);
  }
}

Fixed version (ground truth):
private void updateMemberProfile(MemberProfile profile,MemberProfile existingProfile){
  existingProfile.setSpeakerdeckUsername(profile.getSpeakerdeckUsername());
  existingProfile.setTwitterUsername(profile.getTwitterUsername());
  existingProfile.setBio(profile.getBio());
  existingProfile.setName(profile.getName());
  existingProfile.setJobTitle(profile.getJobTitle());
  existingProfile.setTwitterUsername(profile.getTwitterUsername());
  existingProfile.setSpeakerdeckUsername(profile.getSpeakerdeckUsername());
  existingProfile.setLanyrdUsername(profile.getLanyrdUsername());
  existingProfile.setGplusId(profile.getGplusId());
  existingProfile.setLocation(profile.getLocation());
  existingProfile.setGeoLocation(profile.getGeoLocation());
  existingProfile.setVideoEmbeds(profile.getVideoEmbeds());
  existingProfile.setGravatarEmail(profile.getGravatarEmail());
  existingProfile.setHidden(profile.isHidden());
  updateAvatarUrlwithGravatar(existingProfile);
  teamRepository.save(existingProfile);
  try {
    searchService.saveToIndex(mapper.map(existingProfile));
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + existingProfile.getId(),e);
  }
}
Program: 160175
Project: 160175
Buggy source:
public MemberProfile createOrUpdateMemberProfile(Long githubId,String username,String avatarUrl,String name){
  MemberProfile profile=teamRepository.findByGithubId(githubId);
  if (profile == null) {
    profile=new MemberProfile();
    profile.setGithubId(githubId);
    profile.setUsername(username);
    profile.setHidden(true);
  }
  profile.setAvatarUrl(avatarUrl);
  profile.setName(name);
  profile.setGithubUsername(username);
  return teamRepository.save(profile);
}

Fixed version (ground truth):
public MemberProfile createOrUpdateMemberProfile(Long githubId,String username,String avatarUrl,String name){
  MemberProfile profile=teamRepository.findByGithubId(githubId);
  if (profile == null) {
    profile=new MemberProfile();
    profile.setGithubId(githubId);
    profile.setUsername(username);
    profile.setHidden(true);
  }
  profile.setAvatarUrl(avatarUrl);
  profile.setName(name);
  profile.setGithubUsername(username);
  updateAvatarUrlwithGravatar(profile);
  return teamRepository.save(profile);
}
Program: 160176
Project: 160176
Buggy source:
@CacheEvict(value=CACHE_NAME,key="String_Node_Str") public void deletePost(Post post){
  postRepository.delete(post);
}

Fixed version (ground truth):
@CacheEvict(value=CACHE_NAME,key="String_Node_Str",condition="String_Node_Str") public void deletePost(Post post){
  postRepository.delete(post);
}
Program: 160177
Project: 160177
Buggy source:
@CacheEvict(value=CACHE_NAME,key="String_Node_Str") public void updatePost(Post post,PostForm postForm){
  postFormAdapter.updatePostFromPostForm(post,postForm);
  postRepository.save(post);
  saveToIndex(post);
}

Fixed version (ground truth):
@CacheEvict(value=CACHE_NAME,key="String_Node_Str",condition="String_Node_Str") public void updatePost(Post post,PostForm postForm){
  postFormAdapter.updatePostFromPostForm(post,postForm);
  postRepository.save(post);
  saveToIndex(post);
}
Program: 160178
Project: 160178
Buggy source:
@Test public void showsAllGgtsGaDownloads() throws Exception {
  MvcResult mvcResult=mockMvc.perform(get("String_Node_Str")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith("String_Node_Str")).andReturn();
  Document document=Jsoup.parse(mvcResult.getResponse().getContentAsString());
  assertThat(document.select("String_Node_Str").text(),equalTo("String_Node_Str"));
  assertThat(document.text(),containsString("String_Node_Str"));
  assertThat(document.select("String_Node_Str").text(),containsString("String_Node_Str"));
  assertThat(document.select("String_Node_Str").attr("String_Node_Str"),containsString("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void showsAllGgtsGaDownloads() throws Exception {
  MvcResult mvcResult=mockMvc.perform(get("String_Node_Str")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith("String_Node_Str")).andReturn();
  Document document=Jsoup.parse(mvcResult.getResponse().getContentAsString());
  assertThat(document.select("String_Node_Str").text(),equalTo("String_Node_Str"));
  assertThat(document.select("String_Node_Str").text(),allOf(containsString("String_Node_Str"),containsString("String_Node_Str")));
  assertThat(document.select("String_Node_Str").text(),containsString("String_Node_Str"));
  assertThat(document.select("String_Node_Str").attr("String_Node_Str"),allOf(containsString("String_Node_Str"),containsString("String_Node_Str"),containsString("String_Node_Str")));
}
Program: 160179
Project: 160179
Buggy source:
@Test public void hidesStsMilestoneDownloadsIfNotAvailable() throws Exception {
  String responseXml=Fixtures.load("String_Node_Str");
  stub(restTemplate.getForObject(anyString(),eq(String.class))).toReturn(responseXml);
  MvcResult mvcResult=mockMvc.perform(get("String_Node_Str")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith("String_Node_Str")).andReturn();
  Document document=Jsoup.parse(mvcResult.getResponse().getContentAsString());
  assertThat(document.text(),not(containsString("String_Node_Str")));
  assertThat(document.select("String_Node_Str").attr("String_Node_Str"),not(containsString("String_Node_Str")));
}

Fixed version (ground truth):
@Test public void hidesStsMilestoneDownloadsIfNotAvailable() throws Exception {
  String responseXml=Fixtures.load("String_Node_Str");
  stub(restTemplate.getForObject(anyString(),eq(String.class))).toReturn(responseXml);
  MvcResult mvcResult=mockMvc.perform(get("String_Node_Str")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith("String_Node_Str")).andReturn();
  Document document=Jsoup.parse(mvcResult.getResponse().getContentAsString());
  assertThat(document.select("String_Node_Str").text(),not(allOf(containsString("String_Node_Str"),containsString("String_Node_Str"))));
  assertThat(document.select("String_Node_Str").attr("String_Node_Str"),not(allOf(containsString("String_Node_Str"),containsString("String_Node_Str"),containsString("String_Node_Str"))));
}
Program: 160180
Project: 160180
Buggy source:
@Test public void showsAllGgtsMilestoneDownloads() throws Exception {
  MvcResult mvcResult=mockMvc.perform(get("String_Node_Str")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith("String_Node_Str")).andReturn();
  Document document=Jsoup.parse(mvcResult.getResponse().getContentAsString());
  assertThat(document.text(),containsString("String_Node_Str"));
  assertThat(document.select("String_Node_Str").attr("String_Node_Str"),containsString("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void showsAllGgtsMilestoneDownloads() throws Exception {
  MvcResult mvcResult=mockMvc.perform(get("String_Node_Str")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith("String_Node_Str")).andReturn();
  Document document=Jsoup.parse(mvcResult.getResponse().getContentAsString());
  assertThat(document.select("String_Node_Str").text(),allOf(containsString("String_Node_Str"),containsString("String_Node_Str")));
  assertThat(document.select("String_Node_Str").attr("String_Node_Str"),allOf(containsString("String_Node_Str"),containsString("String_Node_Str"),containsString("String_Node_Str")));
}
Program: 160181
Project: 160181
Buggy source:
@Test public void hidesGgtsMilestoneDownloadsIfNotAvailable() throws Exception {
  String responseXml=Fixtures.load("String_Node_Str");
  stub(restTemplate.getForObject(anyString(),eq(String.class))).toReturn(responseXml);
  MvcResult mvcResult=mockMvc.perform(get("String_Node_Str")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith("String_Node_Str")).andReturn();
  Document document=Jsoup.parse(mvcResult.getResponse().getContentAsString());
  assertThat(document.text(),not(containsString("String_Node_Str")));
  assertThat(document.select("String_Node_Str").attr("String_Node_Str"),not(containsString("String_Node_Str")));
}

Fixed version (ground truth):
@Test public void hidesGgtsMilestoneDownloadsIfNotAvailable() throws Exception {
  String responseXml=Fixtures.load("String_Node_Str");
  stub(restTemplate.getForObject(anyString(),eq(String.class))).toReturn(responseXml);
  MvcResult mvcResult=mockMvc.perform(get("String_Node_Str")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith("String_Node_Str")).andReturn();
  Document document=Jsoup.parse(mvcResult.getResponse().getContentAsString());
  assertThat(document.select("String_Node_Str").text(),not(allOf(containsString("String_Node_Str"),containsString("String_Node_Str"))));
  assertThat(document.select("String_Node_Str").attr("String_Node_Str"),not(allOf(containsString("String_Node_Str"),containsString("String_Node_Str"),containsString("String_Node_Str"))));
}
Program: 160182
Project: 160182
Buggy source:
@Test public void showsAllStsGaDownloads() throws Exception {
  MvcResult mvcResult=mockMvc.perform(get("String_Node_Str")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith("String_Node_Str")).andReturn();
  Document document=Jsoup.parse(mvcResult.getResponse().getContentAsString());
  assertThat(document.select("String_Node_Str").text(),equalTo("String_Node_Str"));
  assertThat(document.text(),containsString("String_Node_Str"));
  assertThat(document.select("String_Node_Str").text(),containsString("String_Node_Str"));
  assertThat(document.select("String_Node_Str").attr("String_Node_Str"),containsString("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void showsAllStsGaDownloads() throws Exception {
  MvcResult mvcResult=mockMvc.perform(get("String_Node_Str")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith("String_Node_Str")).andReturn();
  Document document=Jsoup.parse(mvcResult.getResponse().getContentAsString());
  assertThat(document.select("String_Node_Str").text(),equalTo("String_Node_Str"));
  assertThat(document.select("String_Node_Str").text(),allOf(containsString("String_Node_Str"),containsString("String_Node_Str")));
  assertThat(document.select("String_Node_Str").text(),containsString("String_Node_Str"));
  assertThat(document.select("String_Node_Str").attr("String_Node_Str"),allOf(containsString("String_Node_Str"),containsString("String_Node_Str"),containsString("String_Node_Str")));
}
Program: 160183
Project: 160183
Buggy source:
@Test public void showsAllStsMilestoneDownloads() throws Exception {
  MvcResult mvcResult=mockMvc.perform(get("String_Node_Str")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith("String_Node_Str")).andReturn();
  Document document=Jsoup.parse(mvcResult.getResponse().getContentAsString());
  assertThat(document.text(),containsString("String_Node_Str"));
  assertThat(document.select("String_Node_Str").attr("String_Node_Str"),containsString("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void showsAllStsMilestoneDownloads() throws Exception {
  MvcResult mvcResult=mockMvc.perform(get("String_Node_Str")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith("String_Node_Str")).andReturn();
  Document document=Jsoup.parse(mvcResult.getResponse().getContentAsString());
  assertThat(document.select("String_Node_Str").text(),allOf(containsString("String_Node_Str"),containsString("String_Node_Str")));
  assertThat(document.select("String_Node_Str").attr("String_Node_Str"),allOf(containsString("String_Node_Str"),containsString("String_Node_Str"),containsString("String_Node_Str")));
}