nus-yam/ex-repair huggingface dataset:
Program: 173438
Project: 173438
Buggy source:
@Override public void start(){
  super.start();
  if (variant.equalsIgnoreCase(CLEMENS_VARIANT)) {
    playerManager.reversePlayerOrder(true);
  }
  if (!setPossibleActions()) {
    finishRound();
  }
}

Fixed version (ground truth):
@Override public void start(){
  if (variant.equalsIgnoreCase(CLEMENS_VARIANT)) {
    playerManager.reversePlayerOrder(true);
    Player lastPlayer=playerManager.getNextPlayerAfter(playerManager.getPriorityPlayer());
    playerManager.setPriorityPlayer(lastPlayer);
  }
  super.start();
  if (!setPossibleActions()) {
    finishRound();
  }
}
Program: 173439
Project: 173439
Buggy source:
/** 
 * @param key that defines the specific for which the portfolio members get returned
 * @return all items for the key contained in the portfolio
 */
public ImmutableSortedSet<T> items(K key){
  return portfolio.values();
}

Fixed version (ground truth):
/** 
 * @param key that defines the specific for which the portfolio members get returned
 * @return all items for the key contained in the portfolio
 */
public ImmutableSortedSet<T> items(K key){
  return portfolio.get(key);
}
Program: 173440
Project: 173440
Buggy source:
@Override public boolean equalsAsOption(PossibleAction pa){
  if (pa == this)   return true;
  if (!super.equalsAsOption(pa))   return false;
  BuyCertificate action=(BuyCertificate)pa;
  return Objects.equal(this.certificate,action.certificate) && Objects.equal(this.company,action.company) && Objects.equal(this.from,action.from)&& Objects.equal(this.maximumNumber,action.maximumNumber);
}

Fixed version (ground truth):
@Override public boolean equalsAsOption(PossibleAction pa){
  if (pa == this)   return true;
  if (!super.equalsAsOption(pa))   return false;
  BuyCertificate action=(BuyCertificate)pa;
  return Objects.equal(this.company,action.company) && Objects.equal(this.from,action.from) && Objects.equal(this.maximumNumber,action.maximumNumber);
}
Program: 173441
Project: 173441
Buggy source:
private Configurable configureComponent(RailsRoot root,Tag componentTag) throws ConfigurationException {
  String name=componentTag.getAttributeAsString(XMLTags.NAME_ATTR);
  if (name == null) {
    throw new ConfigurationException(LocalText.getText("String_Node_Str"));
  }
  String clazz=componentTag.getAttributeAsString(XMLTags.CLASS_ATTR);
  if (clazz == null) {
    throw new ConfigurationException(LocalText.getText("String_Node_Str",name));
  }
  String file=componentTag.getAttributeAsString(XMLTags.FILE_ATTR);
  if (mComponentMap.get(name) != null) {
    throw new ConfigurationException(LocalText.getText("String_Node_Str",name));
  }
  Configurable component=Configure.create(Configurable.class,clazz,RailsRoot.class,root,name);
  Tag configElement=componentTag;
  if (file != null) {
    String directory=GameInfoParser.DIRECTORY + File.separator + root.getGameName();
    configElement=Tag.findTopTagInFile(file,directory,name,root.getGameOptions());
  }
  try {
    component.configureFromXML(configElement);
  }
 catch (  ConfigurationException e) {
    throw e;
  }
  mComponentMap.put(name,component);
  log.debug(LocalText.getText("String_Node_Str",name,clazz));
  return component;
}

Fixed version (ground truth):
private Configurable configureComponent(RailsRoot root,Tag componentTag) throws ConfigurationException {
  String name=componentTag.getAttributeAsString(XMLTags.NAME_ATTR);
  if (name == null) {
    throw new ConfigurationException(LocalText.getText("String_Node_Str"));
  }
  String clazz=componentTag.getAttributeAsString(XMLTags.CLASS_ATTR);
  if (clazz == null) {
    throw new ConfigurationException(LocalText.getText("String_Node_Str",name));
  }
  String file=componentTag.getAttributeAsString(XMLTags.FILE_ATTR);
  if (mComponentMap.get(name) != null) {
    throw new ConfigurationException(LocalText.getText("String_Node_Str",name));
  }
  Configurable component=Configure.create(Configurable.class,clazz,RailsRoot.class,root,name);
  Tag configElement=componentTag;
  if (file != null) {
    String directory=GameInfoParser.DIRECTORY + ResourceLoader.SEPARATOR + root.getGameName();
    configElement=Tag.findTopTagInFile(file,directory,name,root.getGameOptions());
  }
  try {
    component.configureFromXML(configElement);
  }
 catch (  ConfigurationException e) {
    throw e;
  }
  mComponentMap.put(name,component);
  log.debug(LocalText.getText("String_Node_Str",name,clazz));
  return component;
}
Program: 173442
Project: 173442
Buggy source:
public void initGameFromXML() throws ConfigurationException {
  String directory="String_Node_Str" + gameData.getGameName();
  Tag componentManagerTag=Tag.findTopTagInFile(GAME_XML_FILE,directory,XMLTags.COMPONENT_MANAGER_ELEMENT_ID,gameData.getGameOptions());
  ComponentManager componentManager=new ComponentManager();
  componentManager.start(this,componentManagerTag);
  reportManager=ReportManager.create(this,"String_Node_Str");
}

Fixed version (ground truth):
public void initGameFromXML() throws ConfigurationException {
  String directory="String_Node_Str" + ResourceLoader.SEPARATOR + gameData.getGameName();
  Tag componentManagerTag=Tag.findTopTagInFile(GAME_XML_FILE,directory,XMLTags.COMPONENT_MANAGER_ELEMENT_ID,gameData.getGameOptions());
  ComponentManager componentManager=new ComponentManager();
  componentManager.start(this,componentManagerTag);
  reportManager=ReportManager.create(this,"String_Node_Str");
}
Program: 173444
Project: 173444
Buggy source:
@Before public void setUp(){
  root=Root.create(new ChangeReporterImpl());
  manager=new ManagerImpl(root,MANAGER_ID);
  item=new AbstractItemImpl(manager,ITEM_ID);
  anotherItem=new AbstractItemImpl(item,ANOTHER_ID);
}

Fixed version (ground truth):
@Before public void setUp(){
  root=Root.create();
  manager=new ManagerImpl(root,MANAGER_ID);
  item=new AbstractItemImpl(manager,ITEM_ID);
  anotherItem=new AbstractItemImpl(item,ANOTHER_ID);
}
Program: 173445
Project: 173445
Buggy source:
public void update(){
}

Fixed version (ground truth):
public void update(ChangeSet changeSet){
}
Program: 173446
Project: 173446
Buggy source:
private void testUndoAfterClose(){
  assertTrue(state.value());
  changeStack.undo();
  assertEquals(1,changeStack.getCurrentIndex());
  assertSame(set_2,changeStack.getPreviousChangeSet());
  assertFalse(state.value());
  changeStack.undo();
  assertEquals(0,changeStack.getCurrentIndex());
  assertSame(set_1,changeStack.getPreviousChangeSet());
  assertTrue(state.value());
  try {
    changeStack.undo();
    failBecauseExceptionWasNotThrown(IllegalStateException.class);
  }
 catch (  Exception e) {
    assertThat(e).isInstanceOf(IllegalStateException.class);
  }
  assertEquals(0,changeStack.getCurrentIndex());
  assertSame(set_1,changeStack.getPreviousChangeSet());
  assertTrue(state.value());
}

Fixed version (ground truth):
private void testUndoAfterClose(){
  assertTrue(state.value());
  changeStack.undo();
  assertEquals(2,changeStack.getCurrentIndex());
  assertSame(set_2,changeStack.getPreviousChangeSet());
  assertFalse(state.value());
  changeStack.undo();
  assertEquals(1,changeStack.getCurrentIndex());
  assertSame(set_1,changeStack.getPreviousChangeSet());
  assertTrue(state.value());
  try {
    changeStack.undo();
    failBecauseExceptionWasNotThrown(IllegalStateException.class);
  }
 catch (  Exception e) {
    assertThat(e).isInstanceOf(IllegalStateException.class);
  }
  assertEquals(1,changeStack.getCurrentIndex());
  assertSame(set_1,changeStack.getPreviousChangeSet());
  assertTrue(state.value());
}
Program: 173447
Project: 173447
Buggy source:
@Test public void testRedo(){
  changeStack.close(changeAction);
  changeStack.undo();
  changeStack.undo();
  changeStack.redo();
  assertEquals(1,changeStack.getCurrentIndex());
  assertSame(set_2,changeStack.getPreviousChangeSet());
  assertFalse(state.value());
  changeStack.redo();
  assertEquals(2,changeStack.getCurrentIndex());
  assertSame(set_3,changeStack.getPreviousChangeSet());
  assertTrue(state.value());
  try {
    changeStack.redo();
    failBecauseExceptionWasNotThrown(IllegalStateException.class);
  }
 catch (  Exception e) {
    assertThat(e).isInstanceOf(IllegalStateException.class);
  }
  assertEquals(2,changeStack.getCurrentIndex());
  assertSame(set_3,changeStack.getPreviousChangeSet());
  assertTrue(state.value());
  testUndoAfterClose();
}

Fixed version (ground truth):
@Test public void testRedo(){
  changeStack.close(changeAction);
  changeStack.undo();
  changeStack.undo();
  changeStack.redo();
  assertEquals(2,changeStack.getCurrentIndex());
  assertSame(set_2,changeStack.getPreviousChangeSet());
  assertFalse(state.value());
  changeStack.redo();
  assertEquals(3,changeStack.getCurrentIndex());
  assertSame(set_3,changeStack.getPreviousChangeSet());
  assertTrue(state.value());
  try {
    changeStack.redo();
    failBecauseExceptionWasNotThrown(IllegalStateException.class);
  }
 catch (  Exception e) {
    assertThat(e).isInstanceOf(IllegalStateException.class);
  }
  assertEquals(3,changeStack.getCurrentIndex());
  assertSame(set_3,changeStack.getPreviousChangeSet());
  assertTrue(state.value());
  testUndoAfterClose();
}
Program: 173448
Project: 173448
Buggy source:
@Before public void setUp(){
  root=Root.create(new ChangeReporterImpl());
  changeStack=root.getStateManager().getChangeStack();
  changeAction=new ChangeActionImpl();
  state=BooleanState.create(root,STATE_ID,true);
  StateTestUtils.close(root);
  set_1=changeStack.getPreviousChangeSet();
  state.set(false);
  StateTestUtils.close(root);
  set_2=changeStack.getPreviousChangeSet();
  state.set(true);
  StateTestUtils.close(root);
  set_3=changeStack.getPreviousChangeSet();
}

Fixed version (ground truth):
@Before public void setUp(){
  root=Root.create();
  changeStack=root.getStateManager().getChangeStack();
  changeAction=new ChangeActionImpl();
  state=BooleanState.create(root,STATE_ID,true);
  StateTestUtils.close(root);
  set_1=changeStack.getPreviousChangeSet();
  state.set(false);
  StateTestUtils.close(root);
  set_2=changeStack.getPreviousChangeSet();
  state.set(true);
  StateTestUtils.close(root);
  set_3=changeStack.getPreviousChangeSet();
}
Program: 173449
Project: 173449
Buggy source:
@Test public void testcloseAndNew(){
  changeStack.close(changeAction);
  assertSame(set_3,changeStack.getPreviousChangeSet());
  assertEquals(2,changeStack.getCurrentIndex());
}

Fixed version (ground truth):
@Test public void testcloseAndNew(){
  changeStack.close(changeAction);
  assertSame(set_3,changeStack.getPreviousChangeSet());
  assertEquals(3,changeStack.getCurrentIndex());
}
Program: 173450
Project: 173450
Buggy source:
@Test public void testGetCurrentChangeSet(){
  assertSame(set_3,changeStack.getPreviousChangeSet());
  assertEquals(2,changeStack.getCurrentIndex());
}

Fixed version (ground truth):
@Test public void testGetCurrentChangeSet(){
  assertSame(set_3,changeStack.getPreviousChangeSet());
  assertEquals(3,changeStack.getCurrentIndex());
}
Program: 173451
Project: 173451
Buggy source:
@Before public void setUp(){
  root=Root.create(new ChangeReporterImpl());
  item=new AbstractItemImpl(root,ITEM_ID);
  manager=new ManagerImpl(item,MANAGER_ID);
  anotherItem=new AbstractItemImpl(manager,ANOTHER_ITEM_ID);
  anotherManager=new ManagerImpl(manager,ANOTHER_MANAGER_ID);
}

Fixed version (ground truth):
@Before public void setUp(){
  root=Root.create();
  item=new AbstractItemImpl(root,ITEM_ID);
  manager=new ManagerImpl(item,MANAGER_ID);
  anotherItem=new AbstractItemImpl(manager,ANOTHER_ITEM_ID);
  anotherManager=new ManagerImpl(manager,ANOTHER_MANAGER_ID);
}
Program: 173452
Project: 173452
Buggy source:
@Before public void setUp(){
  root=Root.create(new ChangeReporterImpl());
  manager=new ManagerImpl(root,MANAGER_ID);
  item=new AbstractItemImpl(manager,ITEM_ID);
  observable=new ObservableImpl(item,OBS_ID);
}

Fixed version (ground truth):
@Before public void setUp(){
  root=Root.create();
  manager=new ManagerImpl(root,MANAGER_ID);
  item=new AbstractItemImpl(manager,ITEM_ID);
  observable=new ObservableImpl(item,OBS_ID);
}
Program: 173453
Project: 173453
Buggy source:
@Before public void setUp(){
  root=Root.create(new ChangeReporterImpl());
  manager=new ManagerImpl(root,MANAGER_ID);
  item=new AbstractItemImpl(root,ITEM_ID);
  anotherItem=new AbstractItemImpl(manager,ANOTHER_ID);
}

Fixed version (ground truth):
@Before public void setUp(){
  root=Root.create();
  manager=new ManagerImpl(root,MANAGER_ID);
  item=new AbstractItemImpl(root,ITEM_ID);
  anotherItem=new AbstractItemImpl(manager,ANOTHER_ID);
}
Program: 173454
Project: 173454
Buggy source:
@Before public void setUp(){
  root=Root.create(new ChangeReporterImpl());
  state=StateImpl.create(root,STATE_ID,null);
  model=ModelImpl.create(root,MODEL_ID,null);
  state_model=StateImpl.create(model,STATE_ID,null);
}

Fixed version (ground truth):
@Before public void setUp(){
  root=Root.create();
  state=StateImpl.create(root,STATE_ID,null);
  model=ModelImpl.create(root,MODEL_ID,null);
  state_model=StateImpl.create(model,STATE_ID,null);
}
Program: 173455
Project: 173455
Buggy source:
public static Root setUpRoot(){
  Root root=Root.create(new ChangeReporterImpl());
  close(root);
  return root;
}

Fixed version (ground truth):
public static Root setUpRoot(){
  Root root=Root.create();
  close(root);
  return root;
}
Program: 173456
Project: 173456
Buggy source:
private NetworkAdapter(GameManager gameManager){
  this.gameManager=gameManager;
}

Fixed version (ground truth):
private NetworkAdapter(RailsRoot root){
  this.root=root;
}
Program: 173457
Project: 173457
Buggy source:
public static NetworkAdapter create(GameManager gameManager){
  return new NetworkAdapter(gameManager);
}

Fixed version (ground truth):
public static NetworkAdapter create(RailsRoot root){
  return new NetworkAdapter(root);
}
Program: 173458
Project: 173458
Buggy source:
public NetworkGraph getMapGraph(){
  if (mapGraph == null) {
    mapGraph=NetworkGraph.createMapGraph(gameManager);
    log.info("String_Node_Str");
  }
  return mapGraph;
}

Fixed version (ground truth):
public NetworkGraph getMapGraph(){
  if (mapGraph == null) {
    mapGraph=NetworkGraph.createMapGraph(root);
    log.info("String_Node_Str");
  }
  return mapGraph;
}
Program: 173459
Project: 173459
Buggy source:
public static NetworkGraph createMapGraph(GameManager gameManager){
  NetworkGraph graph=new NetworkGraph();
  graph.generateMapGraph(gameManager);
  return graph;
}

Fixed version (ground truth):
public static NetworkGraph createMapGraph(RailsRoot root){
  NetworkGraph graph=new NetworkGraph();
  graph.generateMapGraph(root);
  return graph;
}
Program: 173461
Project: 173461
Buggy source:
public Map<String,String> getGameOptions(){
  return gameOptions;
}

Fixed version (ground truth):
public GameOptionsSet getGameOptions(){
  return gameOptions;
}
Program: 173462
Project: 173462
Buggy source:
private GameData(GameInfo game,Map<String,String> gameOptions,List<String> players){
  this.game=game;
  this.gameOptions=ImmutableMap.copyOf(gameOptions);
  this.players=players;
}

Fixed version (ground truth):
private GameData(GameInfo game,GameOptionsSet gameOptions,List<String> players){
  this.game=game;
  this.gameOptions=gameOptions;
  this.players=players;
}
Program: 173463
Project: 173463
Buggy source:
public static GameData create(GameInfo game,Map<GameOption,String> gameOptions,List<String> players){
  ImmutableMap.Builder<String,String> legacyOptions=ImmutableMap.builder();
  for (  GameOption option : gameOptions.keySet()) {
    legacyOptions.put(option.getName(),gameOptions.get(option));
  }
  legacyOptions.put(GameOption.NUMBER_OF_PLAYERS,String.valueOf(players.size()));
  return createLegacy(game,legacyOptions.build(),players);
}

Fixed version (ground truth):
public static GameData create(GameInfo game,GameOptionsSet.Builder gameOptions,List<String> players){
  return new GameData(game,gameOptions.build(players.size()),players);
}
Program: 173464
Project: 173464
Buggy source:
private String getLocalisedName(){
  ImmutableList.Builder<String> localTextPars=ImmutableList.builder();
  for (  String par : parameters) {
    localTextPars.add(LocalText.getText(par));
  }
  return LocalText.getText(name,(Object[])localTextPars.build().toArray());
}

Fixed version (ground truth):
private String getLocalisedName(){
  if (parameters == null || parameters.isEmpty()) {
    return LocalText.getText(name);
  }
  ImmutableList.Builder<String> localTextPars=ImmutableList.builder();
  for (  String par : parameters) {
    localTextPars.add(LocalText.getText(par));
  }
  return LocalText.getText(name,(Object[])localTextPars.build().toArray());
}
Program: 173465
Project: 173465
Buggy source:
public GameOption build(){
  Boolean isBoolean=false;
  List<String> finalAllowedValues=ImmutableList.of();
  if (type.equalsIgnoreCase(OPTION_TYPE_TOGGLE)) {
    isBoolean=true;
    finalAllowedValues=ImmutableList.of(OPTION_VALUE_YES,OPTION_VALUE_NO);
  }
 else   if (type.equalsIgnoreCase(OPTION_TYPE_SELECTION)) {
    if (allowedValues == null) {
      finalAllowedValues=ImmutableList.of();
    }
 else {
      finalAllowedValues=allowedValues;
    }
  }
  String parameterisedName=getParameterisedName();
  String localisedName=getLocalisedName();
  String finalDefaultValue=getFinalDefaultValue(isBoolean,finalAllowedValues);
  return new GameOption(parameterisedName,localisedName,isBoolean,finalDefaultValue,finalAllowedValues,ordering);
}

Fixed version (ground truth):
public GameOption build(){
  Boolean isBoolean=false;
  List<String> finalAllowedValues=ImmutableList.of();
  if (type.equalsIgnoreCase(OPTION_TYPE_TOGGLE)) {
    isBoolean=true;
    finalAllowedValues=ImmutableList.of(OPTION_VALUE_YES,OPTION_VALUE_NO);
  }
 else   if (type.equalsIgnoreCase(OPTION_TYPE_SELECTION)) {
    if (allowedValues == null) {
      finalAllowedValues=ImmutableList.of();
    }
 else {
      finalAllowedValues=allowedValues;
    }
  }
  String parameterisedName=constructParameterisedName(name,parameters);
  String localisedName=getLocalisedName();
  String finalDefaultValue=getFinalDefaultValue(isBoolean,finalAllowedValues);
  return new GameOption(parameterisedName,localisedName,isBoolean,finalDefaultValue,finalAllowedValues,ordering);
}
Program: 173467
Project: 173467
Buggy source:
private boolean isTrainObsolete(Train train,Owner lastBuyingCompany){
  if (!train.getCertType().isObsoleting())   return false;
  if (obsoleteTrainFor == ObsoleteTrainForType.ALL) {
    return true;
  }
 else {
    Owner owner=train.getOwner();
    return (owner instanceof PublicCompany && owner != lastBuyingCompany);
  }
}

Fixed version (ground truth):
private boolean isTrainObsolete(Train train,Owner lastBuyingCompany){
  if (!train.getCertType().isObsoleting())   return false;
  if (train.getOwner() == pool.getParent())   return false;
  if (obsoleteTrainFor == ObsoleteTrainForType.ALL) {
    return true;
  }
 else {
    Owner owner=train.getOwner();
    return (owner instanceof PublicCompany && owner != lastBuyingCompany);
  }
}
Program: 173468
Project: 173468
Buggy source:
@Override public void scrollDown(){
  if (!this.isVisible())   return;
  int caretPosition;
  try {
    String docText=editorPane.getDocument().getText(0,editorPane.getDocument().getLength());
    caretPosition=docText.indexOf(ReportBuffer.ACTIVE_MESSAGE_INDICATOR);
  }
 catch (  BadLocationException e) {
    caretPosition=-1;
  }
  ;
  final int caretPositionStore=caretPosition;
  if (caretPosition != -1) {
    editorPane.setCaretPosition(caretPositionStore);
  }
}

Fixed version (ground truth):
@Override public void scrollDown(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      int caretPosition;
      try {
        String docText=editorPane.getDocument().getText(0,editorPane.getDocument().getLength());
        caretPosition=docText.indexOf(ReportBuffer.ACTIVE_MESSAGE_INDICATOR);
      }
 catch (      BadLocationException e) {
        caretPosition=-1;
      }
      ;
      final int caretPositionStore=caretPosition;
      if (caretPosition != -1) {
        editorPane.setCaretPosition(caretPositionStore);
      }
    }
  }
);
}
Program: 173469
Project: 173469
Buggy source:
protected final void initialize(){
  gc=new GridBagConstraints();
  optionsPane=new JPanel();
  buttonPane=new JPanel();
  okButton=new RailsIconButton(RailsIcon.getByConfigKey(okTextKey));
  okButton.setMnemonic(okTextKey.startsWith("String_Node_Str") ? KeyEvent.VK_Y : KeyEvent.VK_O);
  okButton.addActionListener(this);
  buttonPane.add(okButton);
  if (hasCancelButton) {
    cancelButton=new RailsIconButton(RailsIcon.getByConfigKey(cancelTextKey));
    cancelButton.setMnemonic(cancelTextKey.startsWith("String_Node_Str") ? KeyEvent.VK_N : KeyEvent.VK_C);
    cancelButton.addActionListener(this);
    buttonPane.add(cancelButton);
  }
  getContentPane().setLayout(new GridBagLayout());
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  optionsPane.setLayout(new GridBagLayout());
  optionsPane.add(new JLabel(message),constraints(0,0,10,10,10,10));
  initializeInput();
  getContentPane().add(optionsPane,constraints(0,0,0,0,0,0));
  getContentPane().add(buttonPane,constraints(0,1,0,0,0,0));
  pack();
  int x=(int)window.getLocationOnScreen().getX() + (window.getWidth() - getWidth()) / 2;
  int y=(int)window.getLocationOnScreen().getY() + (window.getHeight() - getHeight()) / 2;
  setLocation(x,y);
  setVisible(true);
  setAlwaysOnTop(true);
}

Fixed version (ground truth):
protected final void initialize(){
  gc=new GridBagConstraints();
  optionsPane=new JPanel();
  buttonPane=new JPanel();
  okButton=new RailsIconButton(RailsIcon.getByConfigKey(okTextKey));
  okButton.setMnemonic(okTextKey.startsWith("String_Node_Str") ? KeyEvent.VK_Y : KeyEvent.VK_O);
  okButton.addActionListener(this);
  buttonPane.add(okButton);
  if (hasCancelButton) {
    cancelButton=new RailsIconButton(RailsIcon.getByConfigKey(cancelTextKey));
    cancelButton.setMnemonic(cancelTextKey.startsWith("String_Node_Str") ? KeyEvent.VK_N : KeyEvent.VK_C);
    cancelButton.addActionListener(this);
    buttonPane.add(cancelButton);
  }
  getContentPane().setLayout(new GridBagLayout());
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  optionsPane.setLayout(new GridBagLayout());
  optionsPane.add(new JLabel(message),constraints(0,0,10,10,10,10));
  initializeInput();
  getContentPane().add(optionsPane,constraints(0,0,0,0,0,0));
  getContentPane().add(buttonPane,constraints(0,1,0,0,0,0));
  pack();
  window.setVisible(true);
  int x=(int)window.getLocationOnScreen().getX() + (window.getWidth() - getWidth()) / 2;
  int y=(int)window.getLocationOnScreen().getY() + (window.getHeight() - getHeight()) / 2;
  setLocation(x,y);
  setVisible(true);
  setAlwaysOnTop(true);
}
Program: 173470
Project: 173470
Buggy source:
public static String getReportItems(){
  int activeIndex=GameManager.getInstance().getRoot().getStateManager().getChangeStack().getCurrentIndex();
  ReportBuffer instance=getInstance();
  StringBuffer s=new StringBuffer();
  s.append("String_Node_Str");
  for (  Integer index : instance.reportItems.keySet()) {
    ReportItem item=instance.reportItems.get(index);
    String text=item.toHtml(index == activeIndex);
    String comment=instance.commentItems.get(index);
    if (text == null && comment == null)     continue;
    s.append("String_Node_Str");
    if (comment != null) {
      s.append("String_Node_Str");
      s.append(item.player.getId() + "String_Node_Str");
      s.append(comment + "String_Node_Str" + NEWLINE_STRING);
      s.append("String_Node_Str");
    }
    if (text != null)     s.append(text);
    s.append("String_Node_Str");
  }
  s.append("String_Node_Str");
  return s.toString();
}

Fixed version (ground truth):
public static String getReportItems(){
  int activeIndex=GameManager.getInstance().getRoot().getStateManager().getChangeStack().getCurrentIndex();
  ReportBuffer instance=getInstance();
  StringBuffer s=new StringBuffer();
  s.append("String_Node_Str");
  for (  Integer index : instance.reportItems.keySet()) {
    ReportItem item=instance.reportItems.get(index);
    String text=item.toHtml(index == activeIndex);
    String comment=instance.commentItems.get(index);
    if (text == null && comment == null)     continue;
    s.append("String_Node_Str");
    if (comment != null) {
      s.append("String_Node_Str");
      if (item.player == null) {
        s.append("String_Node_Str");
      }
 else {
        s.append(item.player.getId() + "String_Node_Str");
      }
      s.append(comment + "String_Node_Str" + NEWLINE_STRING);
      s.append("String_Node_Str");
    }
    if (text != null)     s.append(text);
    s.append("String_Node_Str");
  }
  s.append("String_Node_Str");
  return s.toString();
}
Program: 173471
Project: 173471
Buggy source:
private void calculateHexDistances(MapHex hex1,MapHex hex2,int depth){
  if (distances.get(hex1).get(hex2) == null) {
    distances.get(hex1).put(hex2,depth);
  }
 else {
    if (distances.get(hex1).get(hex2) <= depth)     return;
    distances.get(hex1).put(hex2,depth);
  }
  for (  MapHex hex3 : hex2.getNeighbors()) {
    if (hex3 == null)     continue;
    if (distances.get(hex1).get(hex3) == null) {
      calculateHexDistances(hex1,hex3,depth + 1);
    }
 else     if (distances.get(hex1).get(hex3) > depth + 1) {
      calculateHexDistances(hex1,hex3,depth + 1);
    }
  }
}

Fixed version (ground truth):
private void calculateHexDistances(MapHex hex1,MapHex hex2,int depth){
  if (distances.get(hex1).get(hex2) == null) {
    distances.get(hex1).put(hex2,depth);
  }
 else {
    if (distances.get(hex1).get(hex2) <= depth)     return;
    distances.get(hex1).put(hex2,depth);
  }
  for (  MapHex hex3 : getAdjacentHexes(hex2)) {
    if (hex3 == null)     continue;
    if (distances.get(hex1).get(hex3) == null) {
      calculateHexDistances(hex1,hex3,depth + 1);
    }
 else     if (distances.get(hex1).get(hex3) > depth + 1) {
      calculateHexDistances(hex1,hex3,depth + 1);
    }
  }
}
Program: 173473
Project: 173473
Buggy source:
ConfigProfile deriveUserProfile(String name){
  ensureLoad();
  ConfigProfile newProfile=new ConfigProfile(Type.USER,name);
  ConfigProfile reference;
  if (isFinal()) {
    reference=parent;
  }
 else {
    reference=this;
  }
  newProfile.setParent(reference);
  for (  String key : properties.stringPropertyNames()) {
    if (!key.equals(PARENT_KEY) && !key.equals(FINAL_KEY)) {
      newProfile.setProperty(key,properties.getProperty(key));
    }
  }
  return newProfile;
}

Fixed version (ground truth):
ConfigProfile deriveUserProfile(String name){
  ensureLoad();
  ConfigProfile newProfile=new ConfigProfile(Type.USER,name);
  newProfile.loaded=true;
  ConfigProfile reference;
  if (isFinal()) {
    reference=parent;
  }
 else {
    reference=this;
  }
  newProfile.setParent(reference);
  for (  String key : properties.stringPropertyNames()) {
    if (!key.equals(PARENT_KEY) && !key.equals(FINAL_KEY)) {
      newProfile.setProperty(key,properties.getProperty(key));
    }
  }
  return newProfile;
}
Program: 173474
Project: 173474
Buggy source:
public void notifyOfPhase(Phase newPhase){
  if (!newPhase.equals(currentPhase)) {
    currentPhase=newPhase;
    playBackgroundMusic();
  }
}

Fixed version (ground truth):
synchronized public void notifyOfPhase(Phase newPhase){
  if (newPhase != null && !newPhase.equals(currentPhase)) {
    currentPhase=newPhase;
    playBackgroundMusic();
  }
}
Program: 173475
Project: 173475
Buggy source:
public void notifyOfRound(Round newRound){
  if (!newRound.equals(currentRound)) {
    if (SoundConfig.isSFXEnabled() && !(currentRound instanceof StockRound) && newRound instanceof StockRound) {
      player.playSFXByConfigKey(SoundConfig.KEY_SFX_SR_OpeningBell);
    }
    currentRound=newRound;
    playBackgroundMusic();
  }
}

Fixed version (ground truth):
synchronized public void notifyOfRound(Round newRound){
  if (newRound != null && !newRound.equals(currentRound)) {
    if (SoundConfig.isSFXEnabled() && !(currentRound instanceof StockRound) && newRound instanceof StockRound) {
      player.playSFXByConfigKey(SoundConfig.KEY_SFX_SR_OpeningBell);
    }
    currentRound=newRound;
    playBackgroundMusic();
  }
}
Program: 173476
Project: 173476
Buggy source:
private void playBackgroundMusic(){
  if (!SoundConfig.isBGMEnabled())   return;
  String currentRoundConfigKey=null;
  if (currentRound instanceof StartRound) {
    currentRoundConfigKey=SoundConfig.KEY_BGM_StartRound;
  }
 else   if (currentRound instanceof StockRound) {
    currentRoundConfigKey=SoundConfig.KEY_BGM_StockRound;
  }
 else   if (currentRound instanceof OperatingRound) {
    currentRoundConfigKey=SoundConfig.KEY_BGM_OperatingRound;
  }
 else   if (currentRound instanceof EndOfGameRound) {
    currentRoundConfigKey=SoundConfig.KEY_BGM_EndOfGameRound;
  }
  if (currentRoundConfigKey != null) {
    String currentPhaseName="String_Node_Str";
    if (currentPhase != null)     currentPhaseName=currentPhase.getName();
    String newBackgroundMusicFileName=SoundConfig.get(currentRoundConfigKey,currentPhaseName);
    if (!newBackgroundMusicFileName.equals(currentBackgroundMusicFileName)) {
      currentBackgroundMusicFileName=newBackgroundMusicFileName;
      player.playBGM(newBackgroundMusicFileName);
    }
  }
}

Fixed version (ground truth):
private void playBackgroundMusic(){
  if (!SoundConfig.isBGMEnabled() || currentPhase == null)   return;
  String currentRoundConfigKey=null;
  if (currentRound instanceof StartRound) {
    currentRoundConfigKey=SoundConfig.KEY_BGM_StartRound;
  }
 else   if (currentRound instanceof StockRound) {
    currentRoundConfigKey=SoundConfig.KEY_BGM_StockRound;
  }
 else   if (currentRound instanceof OperatingRound) {
    currentRoundConfigKey=SoundConfig.KEY_BGM_OperatingRound;
  }
 else   if (currentRound instanceof EndOfGameRound) {
    currentRoundConfigKey=SoundConfig.KEY_BGM_EndOfGameRound;
  }
  if (currentRoundConfigKey != null) {
    String currentPhaseName="String_Node_Str";
    if (currentPhase != null)     currentPhaseName=currentPhase.getName();
    String newBackgroundMusicFileName=SoundConfig.get(currentRoundConfigKey,currentPhaseName);
    if (!newBackgroundMusicFileName.equals(currentBackgroundMusicFileName)) {
      currentBackgroundMusicFileName=newBackgroundMusicFileName;
      player.playBGM(newBackgroundMusicFileName);
    }
  }
}
Program: 173478
Project: 173478
Buggy source:
protected void checksOnBuying(Certificate cert,int sharePrice){
  if (cert instanceof PublicCertificate) {
    PublicCertificate pubCert=(PublicCertificate)cert;
    PublicCompany comp=pubCert.getCompany();
    if (!comp.hasStarted()) {
      if (!comp.hasStockPrice()) {
        comp.start();
      }
 else       if (pubCert.isPresidentShare()) {
        if (sharePrice > 0) {
          comp.start(sharePrice);
        }
 else         if (comp.getIPOPrice() != 0) {
          comp.start();
        }
 else {
          log.error("String_Node_Str" + comp.getId());
        }
      }
    }
    if (comp.hasStarted() && !comp.hasFloated()) {
      checkFlotation(comp);
    }
  }
}

Fixed version (ground truth):
protected void checksOnBuying(Certificate cert,int sharePrice){
  if (cert instanceof PublicCertificate) {
    PublicCertificate pubCert=(PublicCertificate)cert;
    PublicCompany comp=pubCert.getCompany();
    if (!comp.hasStarted()) {
      if (!comp.hasStockPrice()) {
        comp.start();
      }
 else       if (pubCert.isPresidentShare()) {
        if (sharePrice > 0) {
          comp.start(sharePrice);
        }
 else         if (comp.getIPOPrice() != 0) {
          comp.start();
        }
 else {
          log.error("String_Node_Str" + comp.getId());
        }
      }
    }
    if (comp.hasStarted() && !comp.hasFloated()) {
      checkFlotation(comp);
    }
    if (comp.hasStarted())     comp.checkPresidency();
  }
}
Program: 173479
Project: 173479
Buggy source:
public Rectangle getRoutesBounds(List<GeneralPath> p1,List<GeneralPath> p2){
  int margin=(int)Math.ceil(strokeWidth * zoomFactor);
  List<Rectangle> pathRects=new ArrayList<Rectangle>();
  if (p1 != null) {
    for (    GeneralPath p : p1)     pathRects.add(p.getBounds());
  }
  if (p2 != null) {
    for (    GeneralPath p : p2)     pathRects.add(p.getBounds());
  }
  Rectangle r=null;
  for (  Rectangle pathRect : pathRects) {
    Rectangle pathMarginRect=new Rectangle(pathRect.x - margin,pathRect.y - margin,pathRect.width + margin * 2,pathRect.y + margin * 2);
    if (r == null) {
      r=pathMarginRect;
    }
 else {
      r.add(pathMarginRect);
    }
  }
  return r;
}

Fixed version (ground truth):
public Rectangle getRoutesBounds(List<GeneralPath> p1,List<GeneralPath> p2){
  int margin=(int)Math.ceil(strokeWidth * zoomFactor);
  List<Rectangle> pathRects=new ArrayList<Rectangle>();
  if (p1 != null) {
    for (    GeneralPath p : p1)     pathRects.add(p.getBounds());
  }
  if (p2 != null) {
    for (    GeneralPath p : p2)     pathRects.add(p.getBounds());
  }
  Rectangle r=null;
  for (  Rectangle pathRect : pathRects) {
    Rectangle pathMarginRect=new Rectangle(pathRect.x - margin,pathRect.y - margin,pathRect.width + margin * 2,pathRect.height + margin * 2);
    if (r == null) {
      r=pathMarginRect;
    }
 else {
      r.add(pathMarginRect);
    }
  }
  return r;
}
Program: 173480
Project: 173480
Buggy source:
/** 
 * @param zoomAdjustmentFactor Additional factor applied to zoom factor. Usedfor precisely adjusting zoom-step based zoom factors for perfect fit requirements.  
 */
public void setZoomAdjustmentFactor(double zoomAdjustmentFactor){
  ImageLoader.zoomAdjustmentFactor=zoomAdjustmentFactor;
  for (int i=0; i < zoomFactors.length; i++) {
    zoomFactors[i]=0;
  }
}

Fixed version (ground truth):
/** 
 * @param zoomAdjustmentFactor Additional factor applied to zoom factor. Usedfor precisely adjusting zoom-step based zoom factors for perfect fit requirements.  
 */
public void setZoomAdjustmentFactor(double zoomAdjustmentFactor){
  ImageLoader.zoomAdjustmentFactor=zoomAdjustmentFactor;
  for (int i=0; i < zoomFactors.length; i++) {
    zoomFactors[i]=0;
  }
  if (tileMap != null)   tileMap.clear();
}
Program: 173481
Project: 173481
Buggy source:
private void adjustToNewMapZoom(){
  currentMapSize=map.getCurrentSize();
  log.debug("String_Node_Str" + currentMapSize);
  layeredPane.setPreferredSize(currentMapSize);
  map.setBounds(0,0,currentMapSize.width,currentMapSize.height);
  if (mapImage != null) {
    mapImage.setBoundsAndResize(currentMapSize,map.getZoomStep());
  }
  layeredPane.revalidate();
}

Fixed version (ground truth):
private void adjustToNewMapZoom(){
  currentMapSize=map.getCurrentSize();
  log.debug("String_Node_Str" + currentMapSize);
  layeredPane.setPreferredSize(currentMapSize);
  map.setBounds(0,0,currentMapSize.width,currentMapSize.height);
  if (mapImage != null) {
    mapImage.setBoundsAndResize(currentMapSize,map.getZoomStep());
  }
  if (gameUIManager.getORUIManager() != null && gameUIManager.getORUIManager().getORPanel() != null)   gameUIManager.getORUIManager().getORPanel().redrawRoutes();
  layeredPane.revalidate();
}
Program: 173482
Project: 173482
Buggy source:
private void redrawRoutes(){
  if (revenueAdapter != null && isDisplayRoutes()) {
    revenueAdapter.drawOptimalRunAsPath(orUIManager.getMap());
  }
}

Fixed version (ground truth):
public void redrawRoutes(){
  if (revenueAdapter != null && isDisplayRoutes()) {
    revenueAdapter.drawOptimalRunAsPath(orUIManager.getMap());
  }
}
Program: 173484
Project: 173484
Buggy source:
private static void initialLoad(){
  if (legacyConfigFile) {
    if (!propertiesLoaded) {
      loadPropertyFile(defaultProperties,selectedProfile,false);
      propertiesLoaded=true;
      setSaveDirDefaults();
    }
    return;
  }
  if (!profilesLoaded) {
    loadPropertyFile(defaultProfiles,defaultProfilesFile,true);
    loadPropertyFile(userProfiles,userProfilesFile,false);
    profilesLoaded=true;
  }
  log.info("String_Node_Str" + selectedProfile);
  if (!propertiesLoaded) {
    loadProfile(selectedProfile);
    propertiesLoaded=true;
  }
  Properties versionNumber=new Properties();
  loadPropertyFile(versionNumber,"String_Node_Str",true);
  String version=versionNumber.getProperty("String_Node_Str");
  String develop=versionNumber.getProperty("String_Node_Str");
  if (Util.hasValue("String_Node_Str")) {
    if (Util.hasValue(develop)) {
      RailsRoot.version=version + "String_Node_Str";
    }
 else {
      RailsRoot.version=version;
    }
  }
}

Fixed version (ground truth):
private static void initialLoad(){
  if (legacyConfigFile) {
    if (!propertiesLoaded) {
      loadPropertyFile(defaultProperties,selectedProfile,false);
      propertiesLoaded=true;
      setSaveDirDefaults();
    }
    return;
  }
  if (!profilesLoaded) {
    loadPropertyFile(defaultProfiles,defaultProfilesFile,true);
    loadPropertyFile(userProfiles,userProfilesFile,false);
    profilesLoaded=true;
  }
  log.info("String_Node_Str" + selectedProfile);
  if (!propertiesLoaded) {
    loadProfile(selectedProfile);
    propertiesLoaded=true;
  }
  Properties versionNumber=new Properties();
  loadPropertyFile(versionNumber,"String_Node_Str",true);
  String version=versionNumber.getProperty("String_Node_Str");
  if (Util.hasValue("String_Node_Str")) {
    RailsRoot.setVersion(version);
  }
  String develop=versionNumber.getProperty("String_Node_Str");
  if (Util.hasValue(develop)) {
    RailsRoot.setDevelop(develop != "String_Node_Str");
  }
}
Program: 173485
Project: 173485
Buggy source:
protected void addNetworkInfo(){
  if (networkInfoMenu != null)   infoMenu.remove(networkInfoMenu);
  networkInfoMenu=createNetworkInfo();
  if (networkInfoMenu == null)   return;
  networkInfoMenu.setEnabled(true);
  infoMenu.add(networkInfoMenu);
}

Fixed version (ground truth):
protected void addNetworkInfo(){
  if (networkInfoMenu != null)   infoMenu.remove(networkInfoMenu);
  networkInfoMenu=createNetworkInfo();
  if (networkInfoMenu == null)   return;
  networkInfoMenu.setEnabled(RailsRoot.getDevelop());
  infoMenu.add(networkInfoMenu);
}
Program: 173487
Project: 173487
Buggy source:
/** 
 * sets the meta data required for a game save
 */
public void initSave(Long saveFileVersionID,String gameName,Map<String,String> gameOptions,List<String> playerNames){
  gameData.meta.version=RailsRoot.version + "String_Node_Str" + BuildInfo.buildDate;
  gameData.meta.date=new SimpleDateFormat("String_Node_Str").format(new Date());
  gameData.meta.fileVersionID=saveFileVersionID;
  gameData.meta.gameName=gameName;
  gameData.gameOptions=gameOptions;
  gameData.playerNames=playerNames;
  initSave=true;
}

Fixed version (ground truth):
/** 
 * sets the meta data required for a game save
 */
public void initSave(Long saveFileVersionID,String gameName,Map<String,String> gameOptions,List<String> playerNames){
  gameData.meta.version=RailsRoot.getFullVersion() + "String_Node_Str" + BuildInfo.buildDate;
  gameData.meta.date=new SimpleDateFormat("String_Node_Str").format(new Date());
  gameData.meta.fileVersionID=saveFileVersionID;
  gameData.meta.gameName=gameName;
  gameData.gameOptions=gameOptions;
  gameData.playerNames=playerNames;
  initSave=true;
}
Program: 173488
Project: 173488
Buggy source:
@Override protected void finishRound(){
  ReportBuffer.add("String_Node_Str");
  ReportBuffer.add(LocalText.getText("String_Node_Str",String.valueOf(getStockRoundNumber())));
  for (  PublicCompany company : gameManager.getCompaniesInRunningOrder()) {
    if (company.hasStockPrice() && company.isSoldOut()) {
      StockSpace oldSpace=company.getCurrentSpace();
      stockMarket.soldOut(company);
      StockSpace newSpace=company.getCurrentSpace();
      if (newSpace != oldSpace) {
        ReportBuffer.add(LocalText.getText("String_Node_Str",company.getId(),Currency.format(this,oldSpace.getPrice()),oldSpace.getId(),Currency.format(this,newSpace.getPrice()),newSpace.getId()));
      }
 else {
        ReportBuffer.add(LocalText.getText("String_Node_Str",company.getId(),Currency.format(this,newSpace.getPrice()),newSpace.getId()));
      }
    }
  }
  super.finishRound();
}

Fixed version (ground truth):
@Override protected void finishRound(){
  ReportBuffer.add("String_Node_Str");
  ReportBuffer.add(LocalText.getText("String_Node_Str",String.valueOf(getStockRoundNumber())));
  if (raiseIfSoldOut) {
    for (    PublicCompany company : gameManager.getCompaniesInRunningOrder()) {
      if (company.hasStockPrice() && company.isSoldOut()) {
        StockSpace oldSpace=company.getCurrentSpace();
        stockMarket.soldOut(company);
        StockSpace newSpace=company.getCurrentSpace();
        if (newSpace != oldSpace) {
          ReportBuffer.add(LocalText.getText("String_Node_Str",company.getId(),Currency.format(this,oldSpace.getPrice()),oldSpace.getId(),Currency.format(this,newSpace.getPrice()),newSpace.getId()));
        }
 else {
          ReportBuffer.add(LocalText.getText("String_Node_Str",company.getId(),Currency.format(this,newSpace.getPrice()),newSpace.getId()));
        }
      }
    }
  }
  super.finishRound();
}
Program: 173489
Project: 173489
Buggy source:
/** 
 * Constructed via Configure
 */
public StockRound(GameManager parent,String id){
  super(parent,id);
  if (numberOfPlayers == 0)   numberOfPlayers=gameManager.getPlayers().size();
  sequenceRule=getGameParameterAsInt(GameDef.Parm.STOCK_ROUND_SEQUENCE);
  guiHints.setVisibilityHint(GuiDef.Panel.MAP,true);
  guiHints.setVisibilityHint(GuiDef.Panel.STOCK_MARKET,true);
  guiHints.setActivePanel(GuiDef.Panel.STATUS);
}

Fixed version (ground truth):
/** 
 * Constructed via Configure
 */
public StockRound(GameManager parent,String id){
  super(parent,id);
  if (numberOfPlayers == 0)   numberOfPlayers=gameManager.getPlayers().size();
  sequenceRule=getGameParameterAsInt(GameDef.Parm.STOCK_ROUND_SEQUENCE);
  raiseIfSoldOut=true;
  guiHints.setVisibilityHint(GuiDef.Panel.MAP,true);
  guiHints.setVisibilityHint(GuiDef.Panel.STOCK_MARKET,true);
  guiHints.setActivePanel(GuiDef.Panel.STATUS);
}
Program: 173490
Project: 173490
Buggy source:
public FinalMinorExchangeRound(GameManager parent,String id){
  super(parent,id);
  guiHints.setVisibilityHint(GuiDef.Panel.MAP,true);
  guiHints.setActivePanel(GuiDef.Panel.STATUS);
}

Fixed version (ground truth):
public FinalMinorExchangeRound(GameManager parent,String id){
  super(parent,id);
  guiHints.setVisibilityHint(GuiDef.Panel.MAP,true);
  guiHints.setActivePanel(GuiDef.Panel.STATUS);
  raiseIfSoldOut=false;
}
Program: 173492
Project: 173492
Buggy source:
@Override public boolean setPossibleActions(){
  if (step == Step.START) {
    Player m2Owner=m2.getPresident();
    startingPlayer=m2Owner;
    setCurrentPlayer(m2Owner);
    ReportBuffer.add(LocalText.getText("String_Node_Str",getCurrentPlayer().getId()));
    possibleActions.add(new FoldIntoPrussian(m2));
  }
 else   if (step == Step.MERGE) {
    possibleActions.add(new FoldIntoPrussian(foldablePrePrussians));
  }
 else   if (step == Step.DISCARD_TRAINS) {
    if (prussian.getNumberOfTrains() > prussian.getCurrentTrainLimit()) {
      possibleActions.add(new DiscardTrain(prussian,prussian.getPortfolioModel().getUniqueTrains(),true));
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean setPossibleActions(){
  if (step == Step.START) {
    Player m2Owner=m2.getPresident();
    startingPlayer=m2Owner;
    setCurrentPlayer(m2Owner);
    ReportBuffer.add(LocalText.getText("String_Node_Str",getCurrentPlayer().getId()));
    possibleActions.add(new FoldIntoPrussian(m2));
  }
 else   if (step == Step.MERGE) {
    possibleActions.add(new FoldIntoPrussian(foldablePrePrussians));
  }
 else   if (step == Step.DISCARD_TRAINS) {
    if (prussian.getNumberOfTrains() > prussian.getCurrentTrainLimit()) {
      log.debug("String_Node_Str" + prussian.getNumberOfTrains() + "String_Node_Str"+ prussian.getCurrentTrainLimit());
      possibleActions.add(new DiscardTrain(prussian,prussian.getPortfolioModel().getUniqueTrains(),true));
    }
  }
  return true;
}
Program: 173493
Project: 173493
Buggy source:
public boolean discardTrain(DiscardTrain action){
  Train train=action.getDiscardedTrain();
  PublicCompany company=action.getCompany();
  String errMsg=null;
  while (true) {
    if (company != prussian) {
      errMsg=LocalText.getText("String_Node_Str",company.getId(),prussian.getId());
      break;
    }
    if (train == null && action.isForced()) {
      errMsg=LocalText.getText("String_Node_Str");
      break;
    }
    if (!company.getPortfolioModel().getTrainList().contains(train)) {
      errMsg=LocalText.getText("String_Node_Str",company.getId(),train.toText());
      break;
    }
    break;
  }
  if (errMsg != null) {
    DisplayBuffer.add(LocalText.getText("String_Node_Str",company.getId(),(train != null ? train.toText() : "String_Node_Str"),errMsg));
    return false;
  }
  ChangeStack.start(this,action);
  pool.addTrain(train);
  ReportBuffer.add(LocalText.getText("String_Node_Str",company.getId(),train.toText()));
  finishRound();
  return true;
}

Fixed version (ground truth):
public boolean discardTrain(DiscardTrain action){
  Train train=action.getDiscardedTrain();
  PublicCompany company=action.getCompany();
  String errMsg=null;
  while (true) {
    if (company != prussian) {
      errMsg=LocalText.getText("String_Node_Str",company.getId(),prussian.getId());
      break;
    }
    if (train == null && action.isForced()) {
      errMsg=LocalText.getText("String_Node_Str");
      break;
    }
    if (!company.getPortfolioModel().getTrainList().contains(train)) {
      errMsg=LocalText.getText("String_Node_Str",company.getId(),train.toText());
      break;
    }
    break;
  }
  if (errMsg != null) {
    DisplayBuffer.add(LocalText.getText("String_Node_Str",company.getId(),(train != null ? train.toText() : "String_Node_Str"),errMsg));
    return false;
  }
  ChangeStack.start(this,action);
  pool.addTrain(train);
  ReportBuffer.add(LocalText.getText("String_Node_Str",company.getId(),train.toText()));
  if (prussian.getNumberOfTrains() > prussian.getCurrentTrainLimit()) {
    step=Step.DISCARD_TRAINS;
  }
 else {
    finishRound();
  }
  return true;
}
Program: 173495
Project: 173495
Buggy source:
private void loadMap(){
  try {
    File imageFile=new File(mapManager.getMapImageFilepath());
    setURI(imageFile.toURI().toString());
    log.debug("String_Node_Str" + imageFile.getName());
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + mapManager.getMapImageFilepath(),e);
  }
  addGVTTreeRendererListener(new GVTTreeRendererAdapter(){
    public void gvtRenderingCompleted(    GVTTreeRendererEvent e){
      if (!initialized) {
        initialTransform=getRenderingTransform();
        scaleMap();
        initialized=true;
      }
      addGVTTreeRendererListener(null);
    }
  }
);
}

Fixed version (ground truth):
private void loadMap(){
  try {
    setURI(getClass().getResource(mapManager.getMapImageFilepath()).toString());
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + mapManager.getMapImageFilepath(),e);
  }
  addGVTTreeRendererListener(new GVTTreeRendererAdapter(){
    public void gvtRenderingCompleted(    GVTTreeRendererEvent e){
      if (!initialized) {
        initialTransform=getRenderingTransform();
        scaleMap();
        initialized=true;
      }
      addGVTTreeRendererListener(null);
    }
  }
);
}
Program: 173499
Project: 173499
Buggy source:
@Override public boolean equalsAsOption(PossibleAction action){
  if (!(action.getClass() == StartCompany.class))   return false;
  StartCompany a=(StartCompany)action;
  return a.company == company && a.from == from && Ints.asList(startPrices).contains(a.price);
}

Fixed version (ground truth):
@Override public boolean equalsAsOption(PossibleAction action){
  if (!(action.getClass() == StartCompany.class))   return false;
  StartCompany a=(StartCompany)action;
  return a.company == company && a.from == from && (startPrices == null && a.startPrices == null || Ints.asList(startPrices).contains(a.price));
}
Program: 173500
Project: 173500
Buggy source:
@Override public boolean equalsAsOption(PossibleAction action){
  if (!(action instanceof FoldIntoPrussian))   return false;
  FoldIntoPrussian a=(FoldIntoPrussian)action;
  return a.foldableCompanyNames.equals(foldableCompanyNames);
}

Fixed version (ground truth):
@Override public boolean equalsAsOption(PossibleAction action){
  if (!(action instanceof FoldIntoPrussian))   return false;
  FoldIntoPrussian a=(FoldIntoPrussian)action;
  return ImmutableSet.copyOf(a.foldableCompanies).equals(ImmutableSet.copyOf(foldableCompanies));
}