nus-yam/ex-repair huggingface dataset:
Program: 158577
Project: 158577
Buggy source:
private void btnImportActionPerformed(java.awt.event.ActionEvent evt){
  String lastFolder=MageFrame.getPreferences().get("String_Node_Str","String_Node_Str");
  if (!lastFolder.isEmpty()) {
    fcImportDeck.setCurrentDirectory(new File(lastFolder));
  }
  int ret=fcImportDeck.showOpenDialog(this);
  if (ret == JFileChooser.APPROVE_OPTION) {
    File file=fcImportDeck.getSelectedFile();
    try {
      setCursor(new Cursor(Cursor.WAIT_CURSOR));
      DeckImporter importer=DeckImporterUtil.getDeckImporter(file.getPath());
      if (importer != null) {
        deck=Deck.load(importer.importDeck(file.getPath()));
        String errors=importer.getErrors();
        if (!errors.isEmpty()) {
          JOptionPane.showMessageDialog(MageFrame.getDesktop(),errors,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
        }
      }
 else {
        JOptionPane.showMessageDialog(MageFrame.getDesktop(),"String_Node_Str","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) {
    }
  }
  fcImportDeck.setSelectedFile(null);
}

Fixed version (ground truth):
private void btnImportActionPerformed(java.awt.event.ActionEvent evt){
  String lastFolder=MageFrame.getPreferences().get("String_Node_Str","String_Node_Str");
  if (!lastFolder.isEmpty()) {
    fcImportDeck.setCurrentDirectory(new File(lastFolder));
  }
  int ret=fcImportDeck.showOpenDialog(this);
  if (ret == JFileChooser.APPROVE_OPTION) {
    File file=fcImportDeck.getSelectedFile();
    try {
      setCursor(new Cursor(Cursor.WAIT_CURSOR));
      DeckImporter importer=DeckImporterUtil.getDeckImporter(file.getPath());
      if (importer != null) {
        deck=Deck.load(importer.importDeck(file.getPath()));
        String errors=importer.getErrors();
        if (!errors.isEmpty()) {
          JOptionPane.showMessageDialog(MageFrame.getDesktop(),errors,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
        }
      }
 else {
        JOptionPane.showMessageDialog(MageFrame.getDesktop(),"String_Node_Str","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) {
    }
  }
  fcImportDeck.setSelectedFile(null);
}
Program: 158578
Project: 158578
Buggy source:
@Override protected void done(){
  try {
    get();
  }
 catch (  InterruptedException|ExecutionException ex) {
    LOGGER.fatal("String_Node_Str",ex);
  }
catch (  CancellationException ex) {
  }
}

Fixed version (ground truth):
@Override protected void done(){
  try {
    get();
  }
 catch (  InterruptedException|ExecutionException ex) {
    logger.fatal("String_Node_Str",ex);
  }
catch (  CancellationException ex) {
  }
}
Program: 158579
Project: 158579
Buggy source:
@Test public void testMageRingNetwork2(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCounters(1,PhaseStep.UPKEEP,playerA,"String_Node_Str",CounterType.STORAGE,4);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  setStopAt(1,PhaseStep.DRAW);
  execute();
  ManaOptions manaOptions=playerA.getAvailableManaTest(currentGame);
  Assert.assertEquals("String_Node_Str",2,manaOptions.size());
  Assert.assertEquals("String_Node_Str",getManaOption(0,manaOptions));
  Assert.assertEquals("String_Node_Str",getManaOption(1,manaOptions));
}

Fixed version (ground truth):
@Test public void testMageRingNetwork2(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCounters(1,PhaseStep.UPKEEP,playerA,"String_Node_Str",CounterType.STORAGE,4);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  setStopAt(1,PhaseStep.DRAW);
  execute();
  ManaOptions manaOptions=playerA.getAvailableManaTest(currentGame);
  Assert.assertEquals("String_Node_Str",1,manaOptions.size());
  Assert.assertEquals("String_Node_Str",getManaOption(0,manaOptions));
}
Program: 158580
Project: 158580
Buggy source:
/** 
 * Subtracts the passed in mana values from this instance. The difference between this and   {@code subtract()} is that if we do not have theavailable generic mana to pay, we take mana from our colored mana pools.
 * @param mana mana values to subtract
 * @throws ArithmeticException thrown if there is not enough availablecolored mana to pay the generic cost
 */
public void subtractCost(final Mana mana) throws ArithmeticException {
  red-=mana.red;
  green-=mana.green;
  blue-=mana.blue;
  white-=mana.white;
  black-=mana.black;
  any-=mana.any;
  generic-=mana.generic;
  colorless-=mana.colorless;
  while (generic < 0) {
    int oldColorless=generic;
    if (red > 0) {
      red--;
      generic++;
      continue;
    }
    if (green > 0) {
      green--;
      generic++;
      continue;
    }
    if (blue > 0) {
      blue--;
      generic++;
      continue;
    }
    if (white > 0) {
      white--;
      generic++;
      continue;
    }
    if (black > 0) {
      black--;
      generic++;
    }
    if (colorless > 0) {
      colorless--;
      generic++;
    }
    if (any > 0) {
      any--;
      generic++;
    }
    if (oldColorless == generic) {
      throw new ArithmeticException("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Subtracts the passed in mana values from this instance. The difference between this and   {@code subtract()} is that if we do not have theavailable generic mana to pay, we take mana from our colored mana pools.
 * @param mana mana values to subtract
 * @throws ArithmeticException thrown if there is not enough availablecolored mana to pay the generic cost
 */
public void subtractCost(final Mana mana) throws ArithmeticException {
  red-=mana.red;
  green-=mana.green;
  blue-=mana.blue;
  white-=mana.white;
  black-=mana.black;
  any-=mana.any;
  generic-=mana.generic;
  colorless-=mana.colorless;
  while (generic < 0) {
    int oldColorless=generic;
    if (red > 0) {
      red--;
      generic++;
      continue;
    }
    if (green > 0) {
      green--;
      generic++;
      continue;
    }
    if (blue > 0) {
      blue--;
      generic++;
      continue;
    }
    if (white > 0) {
      white--;
      generic++;
      continue;
    }
    if (black > 0) {
      black--;
      generic++;
      continue;
    }
    if (colorless > 0) {
      colorless--;
      generic++;
      continue;
    }
    if (any > 0) {
      any--;
      generic++;
      continue;
    }
    if (oldColorless == generic) {
      throw new ArithmeticException("String_Node_Str");
    }
  }
}
Program: 158582
Project: 158582
Buggy source:
@Override public boolean resolve(Game game){
  if (isOptional()) {
    MageObject object=game.getObject(getSourceId());
    Player player=game.getPlayer(this.getControllerId());
    if (player != null) {
      if (!player.chooseUse(getEffects().get(0).getOutcome(),(object != null ? this.getRule(object.getLogName()) : this.getRule()),this,game)) {
        return false;
      }
    }
 else {
      return false;
    }
  }
  if (checkInterveningIfClause(game)) {
    return super.resolve(game);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean resolve(Game game){
  if (isOptional()) {
    MageObject object=game.getObject(getSourceId());
    Player player=game.getPlayer(this.getControllerId());
    if (player != null && object != null) {
      if (!player.chooseUse(getEffects().get(0).getOutcome(),(object != null ? this.getRule(object.getLogName()) : this.getRule()),this,game)) {
        return false;
      }
    }
 else {
      return false;
    }
  }
  if (checkInterveningIfClause(game)) {
    return super.resolve(game);
  }
  return false;
}
Program: 158583
Project: 158583
Buggy source:
@Override public String getRule(){
  String superRule=super.getRule(true);
  StringBuilder sb=new StringBuilder();
  if (!superRule.isEmpty()) {
    String ruleLow=superRule.toLowerCase();
    if (isOptional()) {
      if (ruleLow.startsWith("String_Node_Str")) {
        if (!ruleLow.startsWith("String_Node_Str")) {
          StringBuilder newRule=new StringBuilder(superRule);
          newRule.insert(4,"String_Node_Str");
          superRule=newRule.toString();
        }
      }
 else {
        if (this.getTargets().isEmpty() || ruleLow.startsWith("String_Node_Str") || ruleLow.startsWith("String_Node_Str")|| ruleLow.startsWith("String_Node_Str")|| ruleLow.startsWith("String_Node_Str")|| ruleLow.startsWith("String_Node_Str")|| ruleLow.startsWith("String_Node_Str")|| ruleLow.startsWith("String_Node_Str")|| ruleLow.startsWith("String_Node_Str")) {
          sb.append("String_Node_Str");
        }
 else {
          if (!ruleLow.startsWith("String_Node_Str")) {
            sb.append("String_Node_Str");
          }
        }
      }
    }
    sb.append(superRule);
  }
  return sb.toString();
}

Fixed version (ground truth):
@Override public String getRule(){
  String superRule=super.getRule(true);
  StringBuilder sb=new StringBuilder();
  if (!superRule.isEmpty()) {
    String ruleLow=superRule.toLowerCase();
    if (isOptional()) {
      if (ruleLow.startsWith("String_Node_Str")) {
        if (!ruleLow.startsWith("String_Node_Str")) {
          StringBuilder newRule=new StringBuilder(superRule);
          newRule.insert(4,"String_Node_Str");
          superRule=newRule.toString();
        }
      }
 else       if (this.getTargets().isEmpty() || ruleLow.startsWith("String_Node_Str") || ruleLow.startsWith("String_Node_Str")|| ruleLow.startsWith("String_Node_Str")|| ruleLow.startsWith("String_Node_Str")|| ruleLow.startsWith("String_Node_Str")|| ruleLow.startsWith("String_Node_Str")|| ruleLow.startsWith("String_Node_Str")|| ruleLow.startsWith("String_Node_Str")) {
        sb.append("String_Node_Str");
      }
 else       if (!ruleLow.startsWith("String_Node_Str")) {
        sb.append("String_Node_Str");
      }
    }
    sb.append(superRule);
  }
  return sb.toString();
}
Program: 158584
Project: 158584
Buggy source:
@Override public boolean isInUseableZone(Game game,MageObject source,GameEvent event){
  if (event != null && event.getTargetId() != null && event.getTargetId().equals(getSourceId())) {
switch (event.getType()) {
case ZONE_CHANGE:
case DESTROYED_PERMANENT:
      if (isLeavesTheBattlefieldTrigger()) {
        if (event.getType().equals(EventType.DESTROYED_PERMANENT)) {
          source=game.getLastKnownInformation(getSourceId(),Zone.BATTLEFIELD);
        }
 else {
          if (((ZoneChangeEvent)event).getTarget() != null) {
            source=((ZoneChangeEvent)event).getTarget();
          }
 else {
            source=game.getLastKnownInformation(getSourceId(),((ZoneChangeEvent)event).getZone());
          }
        }
      }
case PHASED_OUT:
case PHASED_IN:
    if (this.zone == Zone.ALL || game.getLastKnownInformation(getSourceId(),zone) != null) {
      return this.hasSourceObjectAbility(game,source,event);
    }
}
}
return super.isInUseableZone(game,source,event);
}

Fixed version (ground truth):
@Override public boolean isInUseableZone(Game game,MageObject source,GameEvent event){
  if (event != null && event.getTargetId() != null && event.getTargetId().equals(getSourceId())) {
switch (event.getType()) {
case ZONE_CHANGE:
case DESTROYED_PERMANENT:
      if (isLeavesTheBattlefieldTrigger()) {
        if (event.getType().equals(EventType.DESTROYED_PERMANENT)) {
          source=game.getLastKnownInformation(getSourceId(),Zone.BATTLEFIELD);
        }
 else         if (((ZoneChangeEvent)event).getTarget() != null) {
          source=((ZoneChangeEvent)event).getTarget();
        }
 else {
          source=game.getLastKnownInformation(getSourceId(),((ZoneChangeEvent)event).getZone());
        }
      }
case PHASED_OUT:
case PHASED_IN:
    if (this.zone == Zone.ALL || game.getLastKnownInformation(getSourceId(),zone) != null) {
      return this.hasSourceObjectAbility(game,source,event);
    }
}
}
return super.isInUseableZone(game,source,event);
}
Program: 158585
Project: 158585
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Spell spell=game.getStack().getSpell(targetPointer.getFirst(game,source));
  if (spell != null) {
    Spell copy=spell.copySpell();
    copy.setControllerId(source.getControllerId());
    copy.setCopiedSpell(true);
    game.getStack().push(copy);
    copy.chooseNewTargets(game,source.getControllerId());
    Player player=game.getPlayer(source.getControllerId());
    String activateMessage=copy.getActivatedMessage(game);
    if (activateMessage.startsWith("String_Node_Str")) {
      activateMessage=activateMessage.substring(6);
    }
    game.informPlayers(player.getLogName() + "String_Node_Str" + activateMessage);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Spell spell=game.getStack().getSpell(targetPointer.getFirst(game,source));
  if (spell != null) {
    Spell copy=spell.copySpell(source.getControllerId());
    game.getStack().push(copy);
    copy.chooseNewTargets(game,source.getControllerId());
    Player player=game.getPlayer(source.getControllerId());
    String activateMessage=copy.getActivatedMessage(game);
    if (activateMessage.startsWith("String_Node_Str")) {
      activateMessage=activateMessage.substring(6);
    }
    game.informPlayers(player.getLogName() + "String_Node_Str" + activateMessage);
    return true;
  }
  return false;
}
Program: 158586
Project: 158586
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getPlayerId().equals(this.getControllerId())) {
    Spell spell=game.getStack().getSpell(event.getTargetId());
    if (isControlledInstantOrSorcery(spell)) {
      boolean targetsSource=false;
      for (      Mode mode : spell.getSpellAbility().getModes().getSelectedModes()) {
        for (        Target target : mode.getTargets()) {
          for (          UUID targetId : target.getTargets()) {
            if (targetId.equals(getSourceId())) {
              targetsSource=true;
            }
 else {
              return false;
            }
          }
        }
      }
      if (targetsSource) {
        this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId()));
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getPlayerId().equals(this.getControllerId())) {
    Spell spell=game.getStack().getSpell(event.getTargetId());
    if (isControlledInstantOrSorcery(spell)) {
      boolean targetsSource=false;
      for (      Ability ability : spell.getSpellAbilities()) {
        for (        Mode mode : ability.getModes().getSelectedModes()) {
          for (          Target target : mode.getTargets()) {
            if (!target.isNotTarget()) {
              for (              UUID targetId : target.getTargets()) {
                if (targetId.equals(getSourceId())) {
                  targetsSource=true;
                }
 else {
                  return false;
                }
              }
            }
          }
        }
      }
      if (targetsSource) {
        this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId()));
        return true;
      }
    }
  }
  return false;
}
Program: 158588
Project: 158588
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Spell spell=game.getStack().getSpell(targetPointer.getFirst(game,source));
  if (spell != null) {
    Spell copy=spell.copySpell();
    copy.setControllerId(source.getControllerId());
    copy.setCopiedSpell(true);
    game.getStack().push(copy);
    copy.chooseNewTargets(game,source.getControllerId());
    Player player=game.getPlayer(source.getControllerId());
    String activateMessage=copy.getActivatedMessage(game);
    if (activateMessage.startsWith("String_Node_Str")) {
      activateMessage=activateMessage.substring(6);
    }
    game.informPlayers(player.getLogName() + "String_Node_Str" + activateMessage);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Spell spell=game.getStack().getSpell(targetPointer.getFirst(game,source));
  if (spell != null) {
    Spell copy=spell.copySpell(source.getControllerId());
    ;
    game.getStack().push(copy);
    copy.chooseNewTargets(game,source.getControllerId());
    Player player=game.getPlayer(source.getControllerId());
    String activateMessage=copy.getActivatedMessage(game);
    if (activateMessage.startsWith("String_Node_Str")) {
      activateMessage=activateMessage.substring(6);
    }
    game.informPlayers(player.getLogName() + "String_Node_Str" + activateMessage);
    return true;
  }
  return false;
}
Program: 158589
Project: 158589
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Spell spell=game.getStack().getSpell(source.getFirstTarget());
  Player you=game.getPlayer(source.getControllerId());
  if (spell != null && you != null && you.chooseUse(Outcome.Benefit,"String_Node_Str" + spell.getName() + "String_Node_Str",source,game)) {
    spell.chooseNewTargets(game,you.getId());
  }
  if (spell != null) {
    Spell copy=spell.copySpell();
    copy.setControllerId(source.getControllerId());
    copy.setCopiedSpell(true);
    game.getStack().push(copy);
    if (you != null && you.chooseUse(Outcome.Benefit,"String_Node_Str" + spell.getName() + "String_Node_Str",source,game)) {
      return copy.chooseNewTargets(game,you.getId());
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Spell spell=game.getStack().getSpell(source.getFirstTarget());
  Player you=game.getPlayer(source.getControllerId());
  if (spell != null && you != null && you.chooseUse(Outcome.Benefit,"String_Node_Str" + spell.getName() + "String_Node_Str",source,game)) {
    spell.chooseNewTargets(game,you.getId());
  }
  if (spell != null) {
    Spell copy=spell.copySpell(source.getControllerId());
    ;
    game.getStack().push(copy);
    if (you != null && you.chooseUse(Outcome.Benefit,"String_Node_Str" + spell.getName() + "String_Node_Str",source,game)) {
      return copy.chooseNewTargets(game,you.getId());
    }
  }
  return false;
}
Program: 158590
Project: 158590
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Spell spell=game.getStack().getSpell(source.getSourceId());
    if (spell != null) {
      Spell spellCopy=spell.copySpell();
      spellCopy.setCopiedSpell(true);
      spellCopy.setControllerId(source.getControllerId());
      game.getStack().push(spellCopy);
      spellCopy.chooseNewTargets(game,controller.getId());
      String activateMessage=spellCopy.getActivatedMessage(game);
      if (activateMessage.startsWith("String_Node_Str")) {
        activateMessage=activateMessage.substring(6);
      }
      game.informPlayers(controller.getLogName() + "String_Node_Str" + activateMessage);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Spell spell=game.getStack().getSpell(source.getSourceId());
    if (spell != null) {
      Spell spellCopy=spell.copySpell(source.getControllerId());
      ;
      game.getStack().push(spellCopy);
      spellCopy.chooseNewTargets(game,controller.getId());
      String activateMessage=spellCopy.getActivatedMessage(game);
      if (activateMessage.startsWith("String_Node_Str")) {
        activateMessage=activateMessage.substring(6);
      }
      game.informPlayers(controller.getLogName() + "String_Node_Str" + activateMessage);
      return true;
    }
  }
  return false;
}
Program: 158591
Project: 158591
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Spell spell=game.getStack().getSpell(targetPointer.getFirst(game,source));
  if (spell != null) {
    String chooseMessage="String_Node_Str";
    for (    UUID playerId : game.getPlayerList()) {
      if (!playerId.equals(spell.getControllerId())) {
        Player player=game.getPlayer(playerId);
        if (player.chooseUse(Outcome.Copy,chooseMessage,source,game)) {
          Spell copy=spell.copySpell();
          copy.setControllerId(playerId);
          copy.setCopiedSpell(true);
          game.getStack().push(copy);
          copy.chooseNewTargets(game,playerId);
        }
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Spell spell=game.getStack().getSpell(targetPointer.getFirst(game,source));
  if (spell != null) {
    String chooseMessage="String_Node_Str";
    for (    UUID playerId : game.getPlayerList()) {
      if (!playerId.equals(spell.getControllerId())) {
        Player player=game.getPlayer(playerId);
        if (player.chooseUse(Outcome.Copy,chooseMessage,source,game)) {
          Spell copy=spell.copySpell(source.getControllerId());
          ;
          game.getStack().push(copy);
          copy.chooseNewTargets(game,playerId);
        }
      }
    }
    return true;
  }
  return false;
}
Program: 158592
Project: 158592
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Spell spell=game.getStack().getSpell(targetPointer.getFirst(game,source));
    if (spell != null) {
      Spell copy=spell.copySpell();
      copy.setControllerId(source.getControllerId());
      copy.setCopiedSpell(true);
      game.getStack().push(copy);
      copy.chooseNewTargets(game,source.getControllerId());
      game.informPlayers(new StringBuilder(controller.getLogName()).append(copy.getActivatedMessage(game)).toString());
      Spell sourceSpell=(Spell)game.getStack().getStackObject(source.getSourceId());
      if (sourceSpell != null) {
        if (sourceSpell.getFromZone() == Zone.GRAVEYARD) {
          copy=spell.copySpell();
          copy.setControllerId(source.getControllerId());
          copy.setCopiedSpell(true);
          game.getStack().push(copy);
          copy.chooseNewTargets(game,source.getControllerId());
          game.informPlayers(new StringBuilder(controller.getLogName()).append(copy.getActivatedMessage(game)).toString());
        }
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Spell spell=game.getStack().getSpell(targetPointer.getFirst(game,source));
    if (spell != null) {
      Spell copy=spell.copySpell(source.getControllerId());
      game.getStack().push(copy);
      copy.chooseNewTargets(game,source.getControllerId());
      game.informPlayers(new StringBuilder(controller.getLogName()).append(copy.getActivatedMessage(game)).toString());
      Spell sourceSpell=(Spell)game.getStack().getStackObject(source.getSourceId());
      if (sourceSpell != null) {
        if (sourceSpell.getFromZone() == Zone.GRAVEYARD) {
          copy=spell.copySpell(source.getControllerId());
          game.getStack().push(copy);
          copy.chooseNewTargets(game,source.getControllerId());
          game.informPlayers(new StringBuilder(controller.getLogName()).append(copy.getActivatedMessage(game)).toString());
        }
      }
      return true;
    }
  }
  return false;
}
Program: 158594
Project: 158594
Buggy source:
/** 
 * @param args the command line arguments
 */
public static void main(final String args[]){
  System.setProperty("String_Node_Str","String_Node_Str");
  logger.info("String_Node_Str" + version);
  logger.info("String_Node_Str" + logger.getEffectiveLevel());
  startTime=System.currentTimeMillis();
  Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler(){
    @Override public void uncaughtException(    Thread t,    Throwable e){
      logger.fatal(null,e);
    }
  }
);
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      for (      String arg : args) {
        if (arg.startsWith(liteModeArg)) {
          liteMode=true;
        }
        if (arg.startsWith(grayModeArg)) {
          grayMode=true;
        }
        if (arg.startsWith(fullscreenArg)) {
          fullscreenMode=true;
        }
      }
      if (!liteMode) {
        final SplashScreen splash=SplashScreen.getSplashScreen();
        if (splash != null) {
          Graphics2D g=splash.createGraphics();
          if (g != null) {
            renderSplashFrame(g);
          }
          splash.update();
        }
      }
      instance=new MageFrame();
      instance.setVisible(true);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * @param args the command line arguments
 */
public static void main(final String args[]){
  System.setProperty("String_Node_Str","String_Node_Str");
  LOGGER.info("String_Node_Str" + VERSION);
  LOGGER.info("String_Node_Str" + LOGGER.getEffectiveLevel());
  startTime=System.currentTimeMillis();
  Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler(){
    @Override public void uncaughtException(    Thread t,    Throwable e){
      LOGGER.fatal(null,e);
    }
  }
);
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      for (      String arg : args) {
        if (arg.startsWith(LITE_MODE_ARG)) {
          liteMode=true;
        }
        if (arg.startsWith(GRAY_MODE_ARG)) {
          grayMode=true;
        }
        if (arg.startsWith(FILL_SCREEN_ARG)) {
          fullscreenMode=true;
        }
      }
      if (!liteMode) {
        final SplashScreen splash=SplashScreen.getSplashScreen();
        if (splash != null) {
          Graphics2D g=splash.createGraphics();
          if (g != null) {
            renderSplashFrame(g);
          }
          splash.update();
        }
      }
      instance=new MageFrame();
      instance.setVisible(true);
    }
  }
);
}
Program: 158595
Project: 158595
Buggy source:
public static void removeChat(UUID chatId){
  chats.remove(chatId);
}

Fixed version (ground truth):
public static void removeChat(UUID chatId){
  CHATS.remove(chatId);
}
Program: 158596
Project: 158596
Buggy source:
@Override public void disconnected(final boolean errorCall){
  if (SwingUtilities.isEventDispatchThread()) {
    logger.info("String_Node_Str");
    setStatusText("String_Node_Str");
    disableButtons();
    hideGames();
    hideTables();
  }
 else {
    logger.info("String_Node_Str");
    SwingUtilities.invokeLater(new Runnable(){
      @Override public void run(){
        setStatusText("String_Node_Str");
        disableButtons();
        hideGames();
        hideTables();
        if (errorCall && JOptionPane.showConfirmDialog(MageFrame.this,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
          if (performConnect()) {
            enableButtons();
          }
        }
 else {
          session.disconnect(false);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void disconnected(final boolean errorCall){
  if (SwingUtilities.isEventDispatchThread()) {
    LOGGER.info("String_Node_Str");
    setStatusText("String_Node_Str");
    disableButtons();
    hideGames();
    hideTables();
  }
 else {
    LOGGER.info("String_Node_Str");
    SwingUtilities.invokeLater(new Runnable(){
      @Override public void run(){
        setStatusText("String_Node_Str");
        disableButtons();
        hideGames();
        hideTables();
        if (errorCall && JOptionPane.showConfirmDialog(MageFrame.this,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
          if (performConnect()) {
            enableButtons();
          }
        }
 else {
          session.disconnect(false);
        }
      }
    }
);
  }
}
Program: 158597
Project: 158597
Buggy source:
private void addMageLabel(){
  if (liteMode || grayMode) {
    return;
  }
  String filename="String_Node_Str";
  try {
    InputStream is=this.getClass().getResourceAsStream(filename);
    float ratio=1179.0f / 678.0f;
    titleRectangle=new Rectangle(540,(int)(640 / ratio));
    if (is != null) {
      BufferedImage image=ImageIO.read(is);
      title=new JLabel();
      title.setIcon(new ImageIcon(image));
      backgroundPane.setLayout(null);
      backgroundPane.add(title);
    }
  }
 catch (  IOException e) {
    logger.fatal("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void addMageLabel(){
  if (liteMode || grayMode) {
    return;
  }
  String filename="String_Node_Str";
  try {
    InputStream is=this.getClass().getResourceAsStream(filename);
    float ratio=1179.0f / 678.0f;
    titleRectangle=new Rectangle(540,(int)(640 / ratio));
    if (is != null) {
      BufferedImage image=ImageIO.read(is);
      title=new JLabel();
      title.setIcon(new ImageIcon(image));
      backgroundPane.setLayout(null);
      backgroundPane.add(title);
    }
  }
 catch (  IOException e) {
    LOGGER.fatal("String_Node_Str",e);
  }
}
Program: 158598
Project: 158598
Buggy source:
public static GamePanel getGame(UUID gameId){
  return games.get(gameId);
}

Fixed version (ground truth):
public static GamePanel getGame(UUID gameId){
  return GAMES.get(gameId);
}
Program: 158599
Project: 158599
Buggy source:
public static void addChat(UUID chatId,ChatPanelBasic chatPanel){
  chats.put(chatId,chatPanel);
}

Fixed version (ground truth):
public static void addChat(UUID chatId,ChatPanelBasic chatPanel){
  CHATS.put(chatId,chatPanel);
}
Program: 158600
Project: 158600
Buggy source:
public void showCollectionViewer(){
  JInternalFrame[] windows=desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER);
  for (  JInternalFrame window : windows) {
    if (window instanceof CollectionViewerPane) {
      setActive((MagePane)window);
      return;
    }
  }
  try {
    CollectionViewerPane collectionViewerPane=new CollectionViewerPane();
    desktopPane.add(collectionViewerPane,javax.swing.JLayeredPane.DEFAULT_LAYER);
    collectionViewerPane.setMaximum(true);
    collectionViewerPane.setVisible(true);
    setActive(collectionViewerPane);
  }
 catch (  PropertyVetoException ex) {
    logger.fatal(null,ex);
  }
}

Fixed version (ground truth):
public void showCollectionViewer(){
  JInternalFrame[] windows=desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER);
  for (  JInternalFrame window : windows) {
    if (window instanceof CollectionViewerPane) {
      setActive((MagePane)window);
      return;
    }
  }
  try {
    CollectionViewerPane collectionViewerPane=new CollectionViewerPane();
    desktopPane.add(collectionViewerPane,javax.swing.JLayeredPane.DEFAULT_LAYER);
    collectionViewerPane.setMaximum(true);
    collectionViewerPane.setVisible(true);
    setActive(collectionViewerPane);
  }
 catch (  PropertyVetoException ex) {
    LOGGER.fatal(null,ex);
  }
}
Program: 158601
Project: 158601
Buggy source:
public void showDeckEditor(DeckEditorMode mode,Deck deck,UUID tableId,int time){
  String name;
  if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING) {
    name="String_Node_Str" + tableId.toString();
  }
 else {
    if (deck != null) {
      name="String_Node_Str" + deck.getName();
    }
 else {
      name="String_Node_Str";
    }
    JInternalFrame[] windows=desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER);
    for (    JInternalFrame window : windows) {
      if (window instanceof DeckEditorPane && window.getTitle().equals(name)) {
        setActive((MagePane)window);
        return;
      }
    }
  }
  try {
    DeckEditorPane deckEditorPane=new DeckEditorPane();
    desktopPane.add(deckEditorPane,JLayeredPane.DEFAULT_LAYER);
    deckEditorPane.setMaximum(true);
    deckEditorPane.setVisible(true);
    deckEditorPane.show(mode,deck,name,tableId,time);
    setActive(deckEditorPane);
  }
 catch (  PropertyVetoException ex) {
    logger.fatal(null,ex);
  }
}

Fixed version (ground truth):
public void showDeckEditor(DeckEditorMode mode,Deck deck,UUID tableId,int time){
  String name;
  if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING) {
    name="String_Node_Str" + tableId.toString();
  }
 else {
    if (deck != null) {
      name="String_Node_Str" + deck.getName();
    }
 else {
      name="String_Node_Str";
    }
    JInternalFrame[] windows=desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER);
    for (    JInternalFrame window : windows) {
      if (window instanceof DeckEditorPane && window.getTitle().equals(name)) {
        setActive((MagePane)window);
        return;
      }
    }
  }
  try {
    DeckEditorPane deckEditorPane=new DeckEditorPane();
    desktopPane.add(deckEditorPane,JLayeredPane.DEFAULT_LAYER);
    deckEditorPane.setMaximum(true);
    deckEditorPane.setVisible(true);
    deckEditorPane.show(mode,deck,name,tableId,time);
    setActive(deckEditorPane);
  }
 catch (  PropertyVetoException ex) {
    LOGGER.fatal(null,ex);
  }
}
Program: 158602
Project: 158602
Buggy source:
public static MageUI getUI(){
  return ui;
}

Fixed version (ground truth):
public static MageUI getUI(){
  return UI;
}
Program: 158603
Project: 158603
Buggy source:
public static Preferences getPreferences(){
  return prefs;
}

Fixed version (ground truth):
public static Preferences getPreferences(){
  return PREFS;
}
Program: 158604
Project: 158604
Buggy source:
public static ChatPanelBasic getChat(UUID chatId){
  return chats.get(chatId);
}

Fixed version (ground truth):
public static ChatPanelBasic getChat(UUID chatId){
  return CHATS.get(chatId);
}
Program: 158605
Project: 158605
Buggy source:
public static void addGame(UUID gameId,GamePanel gamePanel){
  games.put(gameId,gamePanel);
}

Fixed version (ground truth):
public static void addGame(UUID gameId,GamePanel gamePanel){
  GAMES.put(gameId,gamePanel);
}
Program: 158606
Project: 158606
Buggy source:
private void setWindowTitle(){
  setTitle(TITLE_NAME + "String_Node_Str" + (version == null ? "String_Node_Str" : version.toString())+ "String_Node_Str"+ ((session != null && session.isConnected()) ? session.getVersionInfo() : "String_Node_Str"));
}

Fixed version (ground truth):
private void setWindowTitle(){
  setTitle(TITLE_NAME + "String_Node_Str" + (VERSION == null ? "String_Node_Str" : VERSION.toString())+ "String_Node_Str"+ ((session != null && session.isConnected()) ? session.getVersionInfo() : "String_Node_Str"));
}
Program: 158607
Project: 158607
Buggy source:
public void exitApp(){
  if (session.isConnected()) {
    if (JOptionPane.showConfirmDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
      return;
    }
    session.disconnect(false);
  }
 else {
    if (JOptionPane.showConfirmDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
      return;
    }
  }
  CardRepository.instance.closeDB();
  tablesPane.cleanUp();
  Plugins.getInstance().shutdown();
  dispose();
  System.exit(0);
}

Fixed version (ground truth):
public void exitApp(){
  if (session.isConnected()) {
    if (JOptionPane.showConfirmDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
      return;
    }
    session.disconnect(false);
  }
 else   if (JOptionPane.showConfirmDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
    return;
  }
  CardRepository.instance.closeDB();
  tablesPane.cleanUp();
  Plugins.getInstance().shutdown();
  dispose();
  System.exit(0);
}
Program: 158608
Project: 158608
Buggy source:
public static DraftPanel getDraft(UUID draftId){
  return drafts.get(draftId);
}

Fixed version (ground truth):
public static DraftPanel getDraft(UUID draftId){
  return DRAFTS.get(draftId);
}
Program: 158610
Project: 158610
Buggy source:
private void setBackground(){
  if (liteMode || grayMode) {
    return;
  }
  String filename="String_Node_Str";
  try {
    if (Plugins.getInstance().isThemePluginLoaded()) {
      backgroundPane=(ImagePanel)Plugins.getInstance().updateTablePanel(new HashMap<String,JComponent>());
    }
 else {
      InputStream is=this.getClass().getResourceAsStream(filename);
      BufferedImage background=ImageIO.read(is);
      backgroundPane=new ImagePanel(background,ImagePanel.SCALED);
    }
    backgroundPane.setSize(1024,768);
    desktopPane.add(backgroundPane,JLayeredPane.DEFAULT_LAYER);
  }
 catch (  IOException e) {
    logger.fatal("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void setBackground(){
  if (liteMode || grayMode) {
    return;
  }
  String filename="String_Node_Str";
  try {
    if (Plugins.getInstance().isThemePluginLoaded()) {
      backgroundPane=(ImagePanel)Plugins.getInstance().updateTablePanel(new HashMap<String,JComponent>());
    }
 else {
      InputStream is=this.getClass().getResourceAsStream(filename);
      BufferedImage background=ImageIO.read(is);
      backgroundPane=new ImagePanel(background,ImagePanel.SCALED);
    }
    backgroundPane.setSize(1024,768);
    desktopPane.add(backgroundPane,JLayeredPane.DEFAULT_LAYER);
  }
 catch (  IOException e) {
    LOGGER.fatal("String_Node_Str",e);
  }
}
Program: 158611
Project: 158611
Buggy source:
public static void addDraft(UUID draftId,DraftPanel draftPanel){
  drafts.put(draftId,draftPanel);
}

Fixed version (ground truth):
public static void addDraft(UUID draftId,DraftPanel draftPanel){
  DRAFTS.put(draftId,draftPanel);
}
Program: 158612
Project: 158612
Buggy source:
private boolean performConnect(){
  String server=MagePreferences.getServerAddress();
  int port=MagePreferences.getServerPort();
  String userName=MagePreferences.getUserName(server);
  String password=MagePreferences.getPassword(server);
  String proxyServer=prefs.get("String_Node_Str","String_Node_Str");
  int proxyPort=Integer.parseInt(prefs.get("String_Node_Str","String_Node_Str"));
  ProxyType proxyType=ProxyType.valueByText(prefs.get("String_Node_Str","String_Node_Str"));
  String proxyUsername=prefs.get("String_Node_Str","String_Node_Str");
  String proxyPassword=prefs.get("String_Node_Str","String_Node_Str");
  try {
    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    Connection connection=new Connection();
    connection.setUsername(userName);
    connection.setPassword(password);
    connection.setHost(server);
    connection.setPort(port);
    connection.setProxyType(proxyType);
    connection.setProxyHost(proxyServer);
    connection.setProxyPort(proxyPort);
    connection.setProxyUsername(proxyUsername);
    connection.setProxyPassword(proxyPassword);
    setUserPrefsToConnection(connection);
    logger.debug("String_Node_Str" + proxyType + "String_Node_Str"+ proxyServer+ "String_Node_Str"+ proxyPort+ "String_Node_Str"+ proxyUsername);
    if (MageFrame.connect(connection)) {
      showGames(false);
      return true;
    }
 else {
      showMessage("String_Node_Str");
    }
  }
  finally {
    setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
  }
  return false;
}

Fixed version (ground truth):
private boolean performConnect(){
  String server=MagePreferences.getServerAddress();
  int port=MagePreferences.getServerPort();
  String userName=MagePreferences.getUserName(server);
  String password=MagePreferences.getPassword(server);
  String proxyServer=PREFS.get("String_Node_Str","String_Node_Str");
  int proxyPort=Integer.parseInt(PREFS.get("String_Node_Str","String_Node_Str"));
  ProxyType proxyType=ProxyType.valueByText(PREFS.get("String_Node_Str","String_Node_Str"));
  String proxyUsername=PREFS.get("String_Node_Str","String_Node_Str");
  String proxyPassword=PREFS.get("String_Node_Str","String_Node_Str");
  try {
    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    Connection connection=new Connection();
    connection.setUsername(userName);
    connection.setPassword(password);
    connection.setHost(server);
    connection.setPort(port);
    connection.setProxyType(proxyType);
    connection.setProxyHost(proxyServer);
    connection.setProxyPort(proxyPort);
    connection.setProxyUsername(proxyUsername);
    connection.setProxyPassword(proxyPassword);
    setUserPrefsToConnection(connection);
    LOGGER.debug("String_Node_Str" + proxyType + "String_Node_Str"+ proxyServer+ "String_Node_Str"+ proxyPort+ "String_Node_Str"+ proxyUsername);
    if (MageFrame.connect(connection)) {
      showGames(false);
      return true;
    }
 else {
      showMessage("String_Node_Str");
    }
  }
  finally {
    setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
  }
  return false;
}
Program: 158613
Project: 158613
Buggy source:
@Override public MageVersion getVersion(){
  return version;
}

Fixed version (ground truth):
@Override public MageVersion getVersion(){
  return VERSION;
}
Program: 158614
Project: 158614
Buggy source:
public static void removeGame(UUID gameId){
  games.remove(gameId);
}

Fixed version (ground truth):
public static void removeGame(UUID gameId){
  GAMES.remove(gameId);
}
Program: 158615
Project: 158615
Buggy source:
private void checkForNewImages(){
  long beforeCall=System.currentTimeMillis();
  List<CardInfo> cards=CardRepository.instance.findCards(new CardCriteria());
  logger.info("String_Node_Str" + ((System.currentTimeMillis() - beforeCall) / 1000 + "String_Node_Str"));
  beforeCall=System.currentTimeMillis();
  if (DownloadPictures.checkForNewCards(cards)) {
    logger.info("String_Node_Str" + ((System.currentTimeMillis() - beforeCall) / 1000 + "String_Node_Str"));
    if (JOptionPane.showConfirmDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
      DownloadPictures.startDownload(null,cards);
    }
  }
}

Fixed version (ground truth):
private void checkForNewImages(){
  long beforeCall=System.currentTimeMillis();
  List<CardInfo> cards=CardRepository.instance.findCards(new CardCriteria());
  LOGGER.info("String_Node_Str" + ((System.currentTimeMillis() - beforeCall) / 1000 + "String_Node_Str"));
  beforeCall=System.currentTimeMillis();
  if (DownloadPictures.checkForNewCards(cards)) {
    LOGGER.info("String_Node_Str" + ((System.currentTimeMillis() - beforeCall) / 1000 + "String_Node_Str"));
    if (JOptionPane.showConfirmDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
      DownloadPictures.startDownload(null,cards);
    }
  }
}
Program: 158616
Project: 158616
Buggy source:
public boolean autoConnect(){
  boolean autoConnectParamValue=Boolean.parseBoolean(prefs.get("String_Node_Str","String_Node_Str"));
  boolean status=false;
  if (autoConnectParamValue) {
    status=performConnect();
  }
  return status;
}

Fixed version (ground truth):
public boolean autoConnect(){
  boolean autoConnectParamValue=Boolean.parseBoolean(PREFS.get("String_Node_Str","String_Node_Str"));
  boolean status=false;
  if (autoConnectParamValue) {
    status=performConnect();
  }
  return status;
}
Program: 158617
Project: 158617
Buggy source:
public static void setActive(MagePane frame){
  if (frame == null) {
    activeFrame=null;
    return;
  }
  logger.debug("String_Node_Str" + frame.getTitle() + "String_Node_Str");
  if (activeFrame != null) {
    activeFrame.deactivated();
  }
  activeFrame=frame;
  activeFrame.setVisible(true);
  activeFrame.toFront();
  try {
    activeFrame.setSelected(true);
  }
 catch (  PropertyVetoException ex) {
    logger.error("String_Node_Str" + frame.getTitle() + "String_Node_Str");
  }
  activeFrame.activated();
  ArrowBuilder.getBuilder().hideAllPanels();
  if (frame instanceof GamePane) {
    ArrowBuilder.getBuilder().showPanel(((GamePane)frame).getGameId());
    MusicPlayer.playBGM();
  }
 else {
    MusicPlayer.stopBGM();
  }
}

Fixed version (ground truth):
public static void setActive(MagePane frame){
  if (frame == null) {
    activeFrame=null;
    return;
  }
  LOGGER.debug("String_Node_Str" + frame.getTitle() + "String_Node_Str");
  if (activeFrame != null) {
    activeFrame.deactivated();
  }
  activeFrame=frame;
  activeFrame.setVisible(true);
  activeFrame.toFront();
  try {
    activeFrame.setSelected(true);
  }
 catch (  PropertyVetoException ex) {
    LOGGER.error("String_Node_Str" + frame.getTitle() + "String_Node_Str");
  }
  activeFrame.activated();
  ArrowBuilder.getBuilder().hideAllPanels();
  if (frame instanceof GamePane) {
    ArrowBuilder.getBuilder().showPanel(((GamePane)frame).getGameId());
    MusicPlayer.playBGM();
  }
 else {
    MusicPlayer.stopBGM();
  }
}
Program: 158618
Project: 158618
Buggy source:
public void btnAboutActionPerformed(java.awt.event.ActionEvent evt){
  JInternalFrame[] windows=desktopPane.getAllFramesInLayer(JLayeredPane.POPUP_LAYER);
  for (  JInternalFrame window : windows) {
    if (window instanceof AboutDialog) {
      return;
    }
  }
  AboutDialog aboutDialog=new AboutDialog();
  desktopPane.add(aboutDialog,JLayeredPane.POPUP_LAYER);
  aboutDialog.showDialog(version);
}

Fixed version (ground truth):
public void btnAboutActionPerformed(java.awt.event.ActionEvent evt){
  JInternalFrame[] windows=desktopPane.getAllFramesInLayer(JLayeredPane.POPUP_LAYER);
  for (  JInternalFrame window : windows) {
    if (window instanceof AboutDialog) {
      return;
    }
  }
  AboutDialog aboutDialog=new AboutDialog();
  desktopPane.add(aboutDialog,JLayeredPane.POPUP_LAYER);
  aboutDialog.showDialog(VERSION);
}
Program: 158619
Project: 158619
Buggy source:
@Override public void uncaughtException(Thread t,Throwable e){
  logger.fatal(null,e);
}

Fixed version (ground truth):
@Override public void uncaughtException(Thread t,Throwable e){
  LOGGER.fatal(null,e);
}
Program: 158620
Project: 158620
Buggy source:
public static void removeDraft(UUID draftId){
  DraftPanel draftPanel=drafts.get(draftId);
  if (draftPanel != null) {
    drafts.remove(draftId);
    draftPanel.hideDraft();
  }
}

Fixed version (ground truth):
public static void removeDraft(UUID draftId){
  DraftPanel draftPanel=DRAFTS.get(draftId);
  if (draftPanel != null) {
    DRAFTS.remove(draftId);
    draftPanel.hideDraft();
  }
}
Program: 158621
Project: 158621
Buggy source:
public void startTasks(){
  if (session != null) {
    if (updateTablesTask == null || updateTablesTask.isDone()) {
      updateTablesTask=new UpdateTablesTask(session,roomId,this);
      updateTablesTask.execute();
    }
    if (updatePlayersTask == null || updatePlayersTask.isDone()) {
      updatePlayersTask=new UpdatePlayersTask(session,roomId,this.chatPanelMain);
      updatePlayersTask.execute();
    }
    if (this.btnStateFinished.isSelected()) {
      if (updateMatchesTask == null || updateMatchesTask.isDone()) {
        updateMatchesTask=new UpdateMatchesTask(session,roomId,this);
        updateMatchesTask.execute();
      }
    }
 else {
      if (updateMatchesTask != null) {
        updateMatchesTask.cancel(true);
      }
    }
  }
}

Fixed version (ground truth):
public void startTasks(){
  if (session != null) {
    if (updateTablesTask == null || updateTablesTask.isDone()) {
      updateTablesTask=new UpdateTablesTask(session,roomId,this);
      updateTablesTask.execute();
    }
    if (updatePlayersTask == null || updatePlayersTask.isDone()) {
      updatePlayersTask=new UpdatePlayersTask(session,roomId,this.chatPanelMain);
      updatePlayersTask.execute();
    }
    if (this.btnStateFinished.isSelected()) {
      if (updateMatchesTask == null || updateMatchesTask.isDone()) {
        updateMatchesTask=new UpdateMatchesTask(session,roomId,this);
        updateMatchesTask.execute();
      }
    }
 else     if (updateMatchesTask != null) {
      updateMatchesTask.cancel(true);
    }
  }
}