nus-yam/ex-repair huggingface dataset:
Program: 173781
Project: 173781
Buggy source:
public void addCertificate(PublicCertificateI certificate){
  boolean atTop=certificate.isPresidentShare();
  if (atTop)   certificates.add(0,certificate);
 else   certificates.add(certificate);
  String companyName=certificate.getCompany().getName();
  if (!certPerCompany.containsKey(companyName)) {
    certPerCompany.put(companyName,new ArrayList<PublicCertificateI>());
  }
  if (atTop)   (certPerCompany.get(companyName)).add(0,certificate);
 else   (certPerCompany.get(companyName)).add(certificate);
  String certTypeId=certificate.getTypeId();
  if (!certsPerType.containsKey(certTypeId)) {
    certsPerType.put(certTypeId,new ArrayList<PublicCertificateI>());
  }
  certsPerType.get(certTypeId).add(certificate);
  certificate.setPortfolio(this);
  getShareModel(certificate.getCompany()).addShare(certificate.getShare());
}

Fixed version (ground truth):
public void addCertificate(PublicCertificateI certificate){
  boolean atTop=certificate.isPresidentShare();
  if (atTop)   certificates.add(0,certificate);
 else   certificates.add(certificate);
  String companyName=certificate.getCompany().getName();
  if (!certPerCompany.containsKey(companyName)) {
    certPerCompany.put(companyName,new ArrayList<PublicCertificateI>());
  }
  if (atTop)   (certPerCompany.get(companyName)).add(0,certificate);
 else   (certPerCompany.get(companyName)).add(certificate);
  String certTypeId=certificate.getTypeId();
  if (!certsPerType.containsKey(certTypeId)) {
    certsPerType.put(certTypeId,new ArrayList<PublicCertificateI>());
  }
  certsPerType.get(certTypeId).add(certificate);
  certificate.setPortfolio(this);
  getShareModel(certificate.getCompany()).addShare(certificate.getShare());
  if (owner instanceof Player) {
    ((Player)owner).updateWorth();
  }
}
Program: 173782
Project: 173782
Buggy source:
public void removeCertificate(PublicCertificateI certificate){
  certificates.remove(certificate);
  String companyName=certificate.getCompany().getName();
  List<PublicCertificateI> certs=getCertificatesPerCompany(companyName);
  certs.remove(certificate);
  String certTypeId=certificate.getTypeId();
  if (certsPerType.containsKey(certTypeId)) {
    certsPerType.get(certTypeId).remove(0);
    if (certsPerType.get(certTypeId).isEmpty()) {
      certsPerType.remove(certTypeId);
    }
  }
  getShareModel(certificate.getCompany()).addShare(-certificate.getShare());
}

Fixed version (ground truth):
public void removeCertificate(PublicCertificateI certificate){
  certificates.remove(certificate);
  String companyName=certificate.getCompany().getName();
  List<PublicCertificateI> certs=getCertificatesPerCompany(companyName);
  certs.remove(certificate);
  String certTypeId=certificate.getTypeId();
  if (certsPerType.containsKey(certTypeId)) {
    certsPerType.get(certTypeId).remove(0);
    if (certsPerType.get(certTypeId).isEmpty()) {
      certsPerType.remove(certTypeId);
    }
  }
  getShareModel(certificate.getCompany()).addShare(-certificate.getShare());
  if (owner instanceof Player) {
    ((Player)owner).updateWorth();
  }
}
Program: 173783
Project: 173783
Buggy source:
public void start(Player startingPlayer){
  this.startingPlayer=startingPlayer;
  Player president;
  companiesToRepayLoans=null;
  ReportBuffer.add(LocalText.getText("String_Node_Str",cgrName,startingPlayer.getName()));
  for (  PublicCompanyI company : getOperatingCompanies()) {
    if (company.getCurrentNumberOfLoans() > 0) {
      if (companiesToRepayLoans == null) {
        companiesToRepayLoans=new HashMap<Player,List<PublicCompanyI>>();
      }
      president=company.getPresident();
      if (!companiesToRepayLoans.containsKey(president)) {
        companiesToRepayLoans.put(president,new ArrayList<PublicCompanyI>());
      }
      companiesToRepayLoans.get(president).add(company);
    }
  }
  if (companiesToRepayLoans == null) {
    finishRound();
    return;
  }
  ReportBuffer.add(LocalText.getText("String_Node_Str",cgrName,startingPlayer.getName()));
  setStep(STEP_REPAY_LOANS);
  setCurrentPlayer(startingPlayer);
  process(null);
}

Fixed version (ground truth):
public void start(Player startingPlayer){
  this.startingPlayer=startingPlayer;
  Player president;
  companiesToRepayLoans=null;
  ReportBuffer.add(LocalText.getText("String_Node_Str",cgrName,startingPlayer.getName()));
  for (  PublicCompanyI company : getOperatingCompanies()) {
    if (company.getCurrentNumberOfLoans() > 0) {
      if (companiesToRepayLoans == null) {
        companiesToRepayLoans=new HashMap<Player,List<PublicCompanyI>>();
      }
      president=company.getPresident();
      if (!companiesToRepayLoans.containsKey(president)) {
        companiesToRepayLoans.put(president,new ArrayList<PublicCompanyI>());
      }
      companiesToRepayLoans.get(president).add(company);
    }
  }
  if (companiesToRepayLoans == null) {
    ReportBuffer.add(LocalText.getText("String_Node_Str",cgr.getName()));
    finishRound();
    return;
  }
  setStep(STEP_REPAY_LOANS);
  setCurrentPlayer(startingPlayer);
  process(null);
}
Program: 173787
Project: 173787
Buggy source:
public void start(){
  gameManager.startGame(gameOptions);
}

Fixed version (ground truth):
public String start(){
  if (players.size() < playerManager.minPlayers || players.size() > playerManager.maxPlayers) {
    return name + "String_Node_Str" + players.size()+ "String_Node_Str"+ "String_Node_Str"+ name+ "String_Node_Str";
  }
  gameManager.startGame(gameOptions);
  return null;
}
Program: 173790
Project: 173790
Buggy source:
/** 
 * Get the player's total worth.
 * @return Total worth
 */
public int getWorth(){
  int worth=wallet.getCash();
  for (  PublicCertificateI cert : portfolio.getCertificates()) {
    worth+=cert.getCompany().getGameEndPrice();
  }
  for (  PrivateCompanyI priv : portfolio.getPrivateCompanies()) {
    worth+=priv.getBasePrice();
  }
  return worth;
}

Fixed version (ground truth):
/** 
 * Get the player's total worth.
 * @return Total worth
 */
public int getWorth(){
  int worth=wallet.getCash();
  for (  PublicCertificateI cert : portfolio.getCertificates()) {
    worth+=cert.getCompany().getGameEndPrice() * cert.getShares();
  }
  for (  PrivateCompanyI priv : portfolio.getPrivateCompanies()) {
    worth+=priv.getBasePrice();
  }
  return worth;
}
Program: 173791
Project: 173791
Buggy source:
/** 
 * Register a bid. <p> This method does <b>not</b> check off the amount of money that a player has available for bidding.
 * @param amount The bid amount.
 * @param bidder The bidding player.
 */
public void setBid(int amount,Player bidder){
  int index=bidder.getIndex();
  bids[index].set(amount);
  if (amount > 0) {
    lastBidderIndex.set(index);
    minimumBid.set(amount + 5);
  }
 else   if (amount == 0) {
    bids[index].resetOption(MoneyModel.SUPPRESS_ZERO);
    bids[index].update();
  }
}

Fixed version (ground truth):
/** 
 * Register a bid. <p> This method does <b>not</b> check off the amount of money that a player has available for bidding.
 * @param amount The bid amount.
 * @param bidder The bidding player.
 */
public void setBid(int amount,Player bidder){
  int index=bidder.getIndex();
  bids[index].set(amount);
  if (amount > 0) {
    lastBidderIndex.set(index);
    minimumBid.set(amount + 5);
  }
 else   if (amount == 0) {
    bids[index].resetOption(MoneyModel.SUPPRESS_ZERO);
    bids[index].update();
  }
 else {
    bids[index].set(0);
    bids[index].update();
  }
}
Program: 173793
Project: 173793
Buggy source:
protected boolean isAllowedForHex(MapHex hex,String phaseName){
  if (allowedPhases != null && !allowedPhases.contains(phaseName)) {
    return false;
  }
  if (hexes != null)   convertHexString(hex.getMapManager());
  if (allowedHexes != null) {
    return allowedHexes.contains(hex);
  }
 else   if (disallowedHexes != null) {
    return !disallowedHexes.contains(hex);
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
protected boolean isAllowedForHex(MapHex hex){
  if (hexes != null)   convertHexString(hex.getMapManager());
  if (allowedHexes != null) {
    return allowedHexes.contains(hex);
  }
 else   if (disallowedHexes != null) {
    return !disallowedHexes.contains(hex);
  }
 else {
    return true;
  }
}
Program: 173794
Project: 173794
Buggy source:
public String getUpgradesString(MapHex hex){
  return upgradesString;
}

Fixed version (ground truth):
/** 
 * Get a delimited list of all possible upgrades, regardless current phase 
 */
public String getUpgradesString(MapHex hex){
  StringBuffer b=new StringBuffer();
  TileI tile;
  for (  Upgrade upgrade : upgrades) {
    tile=upgrade.getTile();
    if (upgrade.isAllowedForHex(hex)) {
      if (b.length() > 0)       b.append("String_Node_Str");
      b.append(tile.getExternalId());
    }
  }
  return b.toString();
}
Program: 173797
Project: 173797
Buggy source:
private void init(){
  TileManager tmgr=gameUIManager.getGameManager().getTileManager();
  TileI tile;
  Field label;
  BufferedImage hexImage;
  ImageIcon hexIcon;
  List<Integer> tileIds=tmgr.getTileIds();
  log.debug("String_Node_Str" + tileIds.size() + "String_Node_Str");
  for (  int tileId : tileIds) {
    if (tileId <= 0)     continue;
    tile=tmgr.getTile(tileId);
    hexImage=GameUIManager.getImageLoader().getTile(tileId);
    hexIcon=new ImageIcon(hexImage);
    hexIcon.setImage(hexIcon.getImage().getScaledInstance((int)(hexIcon.getIconWidth() * GUIHex.NORMAL_SCALE * 0.8),(int)(hexIcon.getIconHeight() * GUIHex.NORMAL_SCALE * 0.8),Image.SCALE_SMOOTH));
    label=new Field((ModelObject)tile,hexIcon,Field.CENTER);
    label.setVerticalTextPosition(Field.BOTTOM);
    label.setHorizontalTextPosition(Field.CENTER);
    label.setVisible(true);
    getContentPane().add(label);
    shownTiles.add(tile);
    labels.add(label);
  }
}

Fixed version (ground truth):
private void init(GameUIManager gameUIManager){
  TileManager tmgr=gameUIManager.getGameManager().getTileManager();
  TileI tile;
  Field label;
  BufferedImage hexImage;
  ImageIcon hexIcon;
  List<Integer> tileIds=tmgr.getTileIds();
  log.debug("String_Node_Str" + tileIds.size() + "String_Node_Str");
  for (  int tileId : tileIds) {
    if (tileId <= 0)     continue;
    tile=tmgr.getTile(tileId);
    hexImage=GameUIManager.getImageLoader().getTile(tileId);
    hexIcon=new ImageIcon(hexImage);
    hexIcon.setImage(hexIcon.getImage().getScaledInstance((int)(hexIcon.getIconWidth() * GUIHex.NORMAL_SCALE * 0.8),(int)(hexIcon.getIconHeight() * GUIHex.NORMAL_SCALE * 0.8),Image.SCALE_SMOOTH));
    label=new Field((ModelObject)tile,hexIcon,Field.CENTER);
    label.setVerticalTextPosition(Field.BOTTOM);
    label.setHorizontalTextPosition(Field.CENTER);
    label.setVisible(true);
    getContentPane().add(label);
    shownTiles.add(tile);
    labels.add(label);
  }
}
Program: 173798
Project: 173798
Buggy source:
public RemainingTilesWindow(ORWindow orWindow){
  super();
  getContentPane().setLayout(new GridLayout(0,COLUMNS,5,5));
  setTitle("String_Node_Str");
  setVisible(false);
  setSize(800,600);
  addWindowListener(this);
  init();
  this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
  this.setLocationRelativeTo(orWindow);
  pack();
  setVisible(true);
}

Fixed version (ground truth):
public RemainingTilesWindow(ORWindow orWindow){
  super();
  getContentPane().setLayout(new GridLayout(0,COLUMNS,5,5));
  setTitle("String_Node_Str");
  setVisible(false);
  setSize(800,600);
  addWindowListener(this);
  init(orWindow.getGameUIManager());
  this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
  this.setLocationRelativeTo(orWindow);
  pack();
  setVisible(true);
}
Program: 173800
Project: 173800
Buggy source:
protected void moveLeftOrDown(PublicCompanyI company){
  StockSpaceI oldsquare=company.getCurrentSpace();
  StockSpaceI newsquare=oldsquare;
  int row=oldsquare.getRow();
  int col=oldsquare.getColumn();
  if (col > 0 && (newsquare=getStockSpace(row,col - 1)) != null) {
  }
 else   if (row < numRows - 1 && (newsquare=getStockSpace(row + 1,col)) != null) {
  }
  if (newsquare.closesCompany()) {
    if (!company.canClose())     return;
    company.setClosed();
    oldsquare.removeToken(company);
    ReportBuffer.add(company.getName() + LocalText.getText("String_Node_Str") + "String_Node_Str"+ newsquare.getName());
  }
 else {
    prepareMove(company,oldsquare,newsquare);
  }
}

Fixed version (ground truth):
protected void moveLeftOrDown(PublicCompanyI company){
  StockSpaceI oldsquare=company.getCurrentSpace();
  StockSpaceI newsquare=oldsquare;
  int row=oldsquare.getRow();
  int col=oldsquare.getColumn();
  if (col > 0 && (newsquare=getStockSpace(row,col - 1)) != null) {
  }
 else   if (row < numRows - 1 && (newsquare=getStockSpace(row + 1,col)) != null) {
  }
 else {
    newsquare=oldsquare;
  }
  if (newsquare.closesCompany()) {
    if (!company.canClose())     return;
    company.setClosed();
    oldsquare.removeToken(company);
    ReportBuffer.add(company.getName() + LocalText.getText("String_Node_Str") + "String_Node_Str"+ newsquare.getName());
  }
 else {
    prepareMove(company,oldsquare,newsquare);
  }
}
Program: 173804
Project: 173804
Buggy source:
@Override public void configureFromXML(Tag tag) throws ConfigurationException {
  Tag swapTag=tag.getChild("String_Node_Str");
  if (swapTag == null) {
    throw new ConfigurationException("String_Node_Str");
  }
  publicCompanyName=swapTag.getAttributeAsString("String_Node_Str");
  if (!Util.hasValue(publicCompanyName))   throw new ConfigurationException("String_Node_Str");
  share=swapTag.getAttributeAsInteger("String_Node_Str",10);
}

Fixed version (ground truth):
@Override public void configureFromXML(Tag tag) throws ConfigurationException {
  super.configureFromXML(tag);
  Tag swapTag=tag.getChild("String_Node_Str");
  if (swapTag == null) {
    throw new ConfigurationException("String_Node_Str");
  }
  publicCompanyName=swapTag.getAttributeAsString("String_Node_Str");
  if (!Util.hasValue(publicCompanyName))   throw new ConfigurationException("String_Node_Str");
  share=swapTag.getAttributeAsInteger("String_Node_Str",10);
}
Program: 173808
Project: 173808
Buggy source:
public String getName(){
  return "String_Node_Str" + number + "String_Node_Str"+ mapHex.getName();
}

Fixed version (ground truth):
public String getName(){
  return mapHex.getName() + "String_Node_Str" + number;
}
Program: 173811
Project: 173811
Buggy source:
/** 
 * Deserialize 
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  in.defaultReadObject();
  CompanyManagerI cmgr=Game.getCompanyManager();
  if (minorsToMergeNames != null) {
    minorsToMerge=new ArrayList<PublicCompanyI>();
    for (    String name : minorsToMergeNames.split("String_Node_Str")) {
      minorsToMerge.add(cmgr.getPublicCompany(name));
    }
  }
  if (chosenMinorName != null) {
    chosenMinor=cmgr.getPublicCompany(chosenMinorName);
  }
}

Fixed version (ground truth):
/** 
 * Deserialize 
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  in.defaultReadObject();
  CompanyManagerI cmgr=Game.getCompanyManager();
  if (minorsToMergeNames != null) {
    minorsToMerge=new ArrayList<PublicCompanyI>();
    for (    String name : minorsToMergeNames.split("String_Node_Str")) {
      minorsToMerge.add(cmgr.getPublicCompany(name));
    }
  }
  if (chosenMinorName != null) {
    chosenMinor=cmgr.getPublicCompany(chosenMinorName);
  }
  MapManager mmgr=MapManager.getInstance();
  if (availableHomeStationNames != null) {
    availableHomeStations=new ArrayList<City>();
    for (    String cityName : availableHomeStationNames.split("String_Node_Str")) {
      String[] parts=parseStationName(cityName);
      MapHex hex=mmgr.getHex(parts[0]);
      availableHomeStations.add(hex.getCity(Integer.parseInt(parts[1])));
    }
  }
  if (selectedHomeStationName != null) {
    String[] parts=parseStationName(selectedHomeStationName);
    MapHex hex=mmgr.getHex(parts[0]);
    selectedHomeStation=hex.getCity(Integer.parseInt(parts[1]));
  }
}
Program: 173815
Project: 173815
Buggy source:
/** 
 * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element)
 */
public void configureFromXML(Tag tag) throws ConfigurationException {
  try {
    basePrice=tag.getAttributeAsInteger("String_Node_Str",0);
    revenue=tag.getAttributeAsInteger("String_Node_Str",0);
    Tag blockedTag=tag.getChild("String_Node_Str");
    if (blockedTag != null) {
      String[] hexes=blockedTag.getAttributeAsString("String_Node_Str").split("String_Node_Str");
      if (hexes != null && hexes.length > 0) {
        blockedHexes=new ArrayList<MapHex>();
        for (        String hexName : hexes) {
          MapHex hex=MapManager.getInstance().getHex(hexName);
          blockedHexes.add(hex);
          hex.setBlocked(true);
        }
      }
    }
    Tag spsTag=tag.getChild("String_Node_Str");
    if (spsTag != null) {
      closeIfAllExercised=spsTag.getAttributeAsBoolean("String_Node_Str",closeIfAllExercised);
      specialProperties=new ArrayList<SpecialPropertyI>();
      List<Tag> spTags=spsTag.getChildren("String_Node_Str");
      String className;
      for (      Tag spTag : spTags) {
        className=spTag.getAttributeAsString("String_Node_Str");
        if (!Util.hasValue(className))         throw new ConfigurationException("String_Node_Str");
        SpecialPropertyI sp=(SpecialPropertyI)Class.forName(className).newInstance();
        sp.setCompany(this);
        specialProperties.add(sp);
        sp.configureFromXML(spTag);
      }
    }
  }
 catch (  Exception e) {
    throw new ConfigurationException("String_Node_Str" + name,e);
  }
}

Fixed version (ground truth):
/** 
 * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element)
 */
public void configureFromXML(Tag tag) throws ConfigurationException {
  try {
    basePrice=tag.getAttributeAsInteger("String_Node_Str",0);
    revenue=tag.getAttributeAsInteger("String_Node_Str",0);
    Tag blockedTag=tag.getChild("String_Node_Str");
    if (blockedTag != null) {
      String[] hexes=blockedTag.getAttributeAsString("String_Node_Str").split("String_Node_Str");
      if (hexes != null && hexes.length > 0) {
        blockedHexes=new ArrayList<MapHex>();
        for (        String hexName : hexes) {
          MapHex hex=MapManager.getInstance().getHex(hexName);
          blockedHexes.add(hex);
          hex.setBlocked(true);
        }
      }
    }
    Tag spsTag=tag.getChild("String_Node_Str");
    if (spsTag != null) {
      closeIfAllExercised=spsTag.getAttributeAsBoolean("String_Node_Str",closeIfAllExercised);
      List<Tag> spTags=spsTag.getChildren("String_Node_Str");
      String className;
      for (      Tag spTag : spTags) {
        className=spTag.getAttributeAsString("String_Node_Str");
        if (!Util.hasValue(className))         throw new ConfigurationException("String_Node_Str");
        SpecialPropertyI sp=(SpecialPropertyI)Class.forName(className).newInstance();
        sp.setCompany(this);
        specialProperties.add(sp);
        sp.configureFromXML(spTag);
      }
    }
  }
 catch (  Exception e) {
    throw new ConfigurationException("String_Node_Str" + name,e);
  }
}
Program: 173818
Project: 173818
Buggy source:
public void transferAssetsFrom(PublicCompanyI otherCompany){
  Bank.transferCash(otherCompany,this,otherCompany.getCash());
  portfolio.transferAssetsFrom(otherCompany.getPortfolio());
}

Fixed version (ground truth):
public void transferAssetsFrom(PublicCompanyI otherCompany){
  new CashMove(otherCompany,this,otherCompany.getCash());
  portfolio.transferAssetsFrom(otherCompany.getPortfolio());
}
Program: 173820
Project: 173820
Buggy source:
public void setPreferredSize(Dimension preferredSize){
  this.preferredSize=preferredSize;
}

Fixed version (ground truth):
@Override public void setPreferredSize(Dimension preferredSize){
  this.preferredSize=preferredSize;
}
Program: 173822
Project: 173822
Buggy source:
public Dimension getPreferredSize(){
  return preferredSize;
}

Fixed version (ground truth):
@Override public Dimension getPreferredSize(){
  return preferredSize;
}
Program: 173823
Project: 173823
Buggy source:
public void mouseClicked(MouseEvent e){
  Object source=e.getSource();
  if (!(source instanceof JLabel))   return;
  if (tokenMode) {
    if (tokenLabels.contains(source)) {
      orUIManager.tokenSelected((LayToken)((ActionLabel)source).getPossibleActions().get(0));
      setDoneEnabled(true);
    }
 else {
      orUIManager.tokenSelected(null);
    }
    setSelectedToken();
  }
 else {
    int id=Integer.parseInt(((JLabel)e.getSource()).getText());
    orUIManager.tileSelected(id);
  }
}

Fixed version (ground truth):
public void mouseClicked(MouseEvent e){
  Object source=e.getSource();
  if (!(source instanceof JLabel))   return;
  if (tokenMode) {
    if (tokenLabels.contains(source)) {
      orUIManager.tokenSelected((LayToken)((ActionLabel)source).getPossibleActions().get(0));
      setDoneEnabled(true);
    }
 else {
      orUIManager.tokenSelected(null);
    }
    setSelectedToken();
  }
 else {
    int id=((HexLabel)e.getSource()).getInternalId();
    orUIManager.tileSelected(id);
  }
}
Program: 173824
Project: 173824
Buggy source:
/** 
 * Rotate right (clockwise) until a valid orientation is found. TODO: Currently only impassable hex sides are taken into account.
 * @param initial:First rotation to try. Should be 0 for the initial tile drop, and 1 at subsequent rotation attempts.
 * @return <b>false</b> if no valid rotation exists (i.e. the tile cannotbe laid).
 */
public boolean rotate(int initial,GUITile previousGUITile,boolean mustConnect){
  int i, j, tempRot;
  TileI prevTile=previousGUITile.getTile();
  int prevTileRotation=previousGUITile.getRotation();
  MapHex nHex;
  boolean connected=!mustConnect;
  for (i=initial; i < 6; i++) {
    tempRot=(rotation + i) % 6;
    for (j=0; j < 6; j++) {
      if (tile.hasTracks(j - tempRot)) {
        if (!hex.hasNeighbour(j))         break;
        if (mustConnect) {
          nHex=hex.getNeighbor(j);
          if (nHex.getCurrentTile().hasTracks(j + 3 - nHex.getCurrentTileRotation())) {
            connected=true;
          }
        }
      }
 else {
        if (prevTile.hasTracks(j - prevTileRotation))         break;
      }
    }
    if (j == 6 && connected) {
      setRotation(tempRot);
      return true;
    }
  }
  if (i == 6) {
    return false;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
/** 
 * Rotate right (clockwise) until a valid orientation is found. TODO: Currently only impassable hex sides are taken into account.
 * @param initial:First rotation to try. Should be 0 for the initial tile drop, and 1 at subsequent rotation attempts.
 * @return <b>false</b> if no valid rotation exists (i.e. the tile cannotbe laid).
 */
public boolean rotate(int initial,GUITile previousGUITile,boolean mustConnect){
  int i, j, tempRot;
  TileI prevTile=previousGUITile.getTile();
  int prevTileRotation=previousGUITile.getRotation();
  MapHex nHex;
  boolean connected;
  for (i=initial; i < 6; i++) {
    connected=!mustConnect;
    tempRot=(rotation + i) % 6;
    for (j=0; j < 6; j++) {
      if (tile.hasTracks(j - tempRot)) {
        if (!hex.hasNeighbour(j))         break;
        if (mustConnect) {
          nHex=hex.getNeighbor(j);
          if (nHex.getCurrentTile().hasTracks(j + 3 - nHex.getCurrentTileRotation())) {
            connected=true;
          }
        }
      }
 else {
        if (prevTile.hasTracks(j - prevTileRotation))         break;
      }
    }
    if (j == 6 && connected) {
      setRotation(tempRot);
      return true;
    }
  }
  if (i == 6) {
    return false;
  }
 else {
    return true;
  }
}
Program: 173827
Project: 173827
Buggy source:
public static boolean load(GameAction loadAction){
  String filepath=loadAction.getFilepath();
  boolean result=false;
  try {
    ObjectInputStream ois=new ObjectInputStream(new FileInputStream(new File(filepath)));
    name=(String)ois.readObject();
    variant=(String)ois.readObject();
    numberOfPlayers=(Integer)ois.readObject();
    List<String> playerNames=new ArrayList<String>();
    for (int i=0; i < numberOfPlayers; i++) {
      playerNames.add((String)ois.readObject());
    }
    Game.getPlayerManager(playerNames);
    Game.initialise(name);
    if (Util.hasValue(variant))     setVariant(variant);
    Player.initPlayers(Game.getPlayerManager().getPlayersArray());
    List<PossibleAction> executedActions=(List<PossibleAction>)ois.readObject();
    ois.close();
    instance.startGame();
    for (    PossibleAction action : executedActions) {
      instance.processOnReload(action);
    }
    result=true;
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
    DisplayBuffer.add(LocalText.getText("String_Node_Str",e.getMessage()));
  }
catch (  ClassNotFoundException e) {
    log.error("String_Node_Str",e);
    DisplayBuffer.add(LocalText.getText("String_Node_Str",e.getMessage()));
  }
  return result;
}

Fixed version (ground truth):
public static boolean load(GameAction loadAction){
  String filepath=loadAction.getFilepath();
  boolean result=false;
  try {
    ObjectInputStream ois=new ObjectInputStream(new FileInputStream(new File(filepath)));
    name=(String)ois.readObject();
    variant=(String)ois.readObject();
    numberOfPlayers=(Integer)ois.readObject();
    List<String> playerNames=new ArrayList<String>();
    for (int i=0; i < numberOfPlayers; i++) {
      playerNames.add((String)ois.readObject());
    }
    Game.getPlayerManager(playerNames);
    Game.initialise(name);
    if (Util.hasValue(variant))     setVariant(variant);
    Player.initPlayers(Game.getPlayerManager().getPlayersArray());
    List<PossibleAction> executedActions=(List<PossibleAction>)ois.readObject();
    ois.close();
    instance.startGame();
    for (    PossibleAction action : executedActions) {
      log.debug("String_Node_Str" + action);
      instance.processOnReload(action);
    }
    result=true;
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
    DisplayBuffer.add(LocalText.getText("String_Node_Str",e.getMessage()));
  }
catch (  ClassNotFoundException e) {
    log.error("String_Node_Str",e);
    DisplayBuffer.add(LocalText.getText("String_Node_Str",e.getMessage()));
  }
  return result;
}
Program: 173828
Project: 173828
Buggy source:
public void skip(){
  log.debug("String_Node_Str" + stepObject.intValue());
  MoveSet.start(true);
  nextStep();
  MoveSet.finish();
}

Fixed version (ground truth):
public void skip(){
  log.debug("String_Node_Str" + stepObject.intValue());
  MoveSet.start(true);
  nextStep();
}
Program: 173829
Project: 173829
Buggy source:
/** 
 * Bypass normal order of operations and explicitly set round step. This should only be done for specific rails.game exceptions, such as forced train purchases.
 * @param step
 */
protected void setStep(int step){
  if (step == STEP_INITIAL)   initTurn();
  if (stepObject == null) {
    stepObject=new IntegerState("String_Node_Str");
    stepObject.addObserver(this);
  }
  stepObject.set(step);
  prepareStep();
}

Fixed version (ground truth):
/** 
 * Bypass normal order of operations and explicitly set round step. This should only be done for specific rails.game exceptions, such as forced train purchases.
 * @param step
 */
protected void setStep(int step){
  log.debug("String_Node_Str" + step);
  if (step == STEP_INITIAL)   initTurn();
  if (stepObject == null) {
    stepObject=new IntegerState("String_Node_Str",-1);
    stepObject.addObserver(this);
  }
  stepObject.set(step);
}
Program: 173830
Project: 173830
Buggy source:
public boolean process(PossibleAction action){
  boolean result=false;
  String playerName=action.getPlayerName();
  Player currentPlayer=getCurrentPlayer();
  if (action instanceof PossibleORAction) {
    PublicCompanyI company=((PossibleORAction)action).getCompany();
    if (company != operatingCompany) {
      DisplayBuffer.add(LocalText.getText("String_Node_Str",new String[]{company.getName(),operatingCompany.getName()}));
      return false;
    }
  }
  selectedAction=action;
  if (selectedAction instanceof LayTile) {
    result=layTile((LayTile)selectedAction);
  }
 else   if (selectedAction instanceof LayToken) {
    result=layBaseToken((LayToken)selectedAction);
  }
 else   if (selectedAction instanceof SetDividend) {
    result=setRevenueAndDividend((SetDividend)selectedAction);
  }
 else   if (selectedAction instanceof BuyTrain) {
    result=buyTrain((BuyTrain)selectedAction);
  }
 else   if (selectedAction instanceof DiscardTrain) {
    result=discardTrain((DiscardTrain)selectedAction);
  }
 else   if (selectedAction instanceof BuyPrivate) {
    result=buyPrivate((BuyPrivate)selectedAction);
  }
 else   if (selectedAction instanceof NullAction) {
    NullAction nullAction=(NullAction)action;
switch (nullAction.getMode()) {
case NullAction.PASS:
case NullAction.DONE:
      result=done();
    break;
case NullAction.SKIP:
  skip();
result=true;
break;
}
}
 else {
DisplayBuffer.add(LocalText.getText("String_Node_Str",selectedAction.toString()));
return false;
}
return result;
}

Fixed version (ground truth):
public boolean process(PossibleAction action){
  boolean result=false;
  if (action instanceof PossibleORAction) {
    PublicCompanyI company=((PossibleORAction)action).getCompany();
    if (company != operatingCompany) {
      DisplayBuffer.add(LocalText.getText("String_Node_Str",new String[]{company.getName(),operatingCompany.getName()}));
      return false;
    }
  }
  selectedAction=action;
  if (selectedAction instanceof LayTile) {
    result=layTile((LayTile)selectedAction);
  }
 else   if (selectedAction instanceof LayToken) {
    result=layBaseToken((LayToken)selectedAction);
  }
 else   if (selectedAction instanceof SetDividend) {
    result=setRevenueAndDividend((SetDividend)selectedAction);
  }
 else   if (selectedAction instanceof BuyTrain) {
    result=buyTrain((BuyTrain)selectedAction);
  }
 else   if (selectedAction instanceof DiscardTrain) {
    result=discardTrain((DiscardTrain)selectedAction);
  }
 else   if (selectedAction instanceof BuyPrivate) {
    result=buyPrivate((BuyPrivate)selectedAction);
  }
 else   if (selectedAction instanceof NullAction) {
    NullAction nullAction=(NullAction)action;
switch (nullAction.getMode()) {
case NullAction.PASS:
case NullAction.DONE:
      result=done();
    break;
case NullAction.SKIP:
  skip();
result=true;
break;
}
}
 else {
DisplayBuffer.add(LocalText.getText("String_Node_Str",selectedAction.toString()));
return false;
}
return result;
}
Program: 173831
Project: 173831
Buggy source:
/** 
 * Take the next step after a given one (see nextStep()) 
 */
protected void nextStep(int step){
  int stepIndex;
  for (stepIndex=0; stepIndex < steps.length; stepIndex++) {
    if (steps[stepIndex] == step)     break;
  }
  while (++stepIndex < steps.length) {
    step=steps[stepIndex];
    if (step == STEP_LAY_TOKEN && operatingCompany.getNumberOfFreeBaseTokens() == 0) {
      continue;
    }
    if (step == STEP_CALC_REVENUE) {
      if (operatingCompany.getPortfolio().getNumberOfTrains() == 0) {
        operatingCompany.setLastRevenue(0);
        operatingCompany.setLastRevenueAllocation(SetDividend.UNKNOWN);
        ReportBuffer.add(LocalText.getText("String_Node_Str",new String[]{operatingCompany.getName(),Bank.format(0)}));
        continue;
      }
    }
    if (step == STEP_PAYOUT) {
      int amount=operatingCompany.getLastRevenue();
      if (amount == 0) {
        operatingCompany.withhold(0);
        DisplayBuffer.add(LocalText.getText("String_Node_Str",new String[]{operatingCompany.getName(),Bank.format(0)}));
        continue;
      }
 else       if (operatingCompany.isSplitAlways()) {
        operatingCompany.splitRevenue(amount);
        continue;
      }
    }
    break;
  }
  if (step >= steps.length) {
    done();
  }
 else {
    setStep(step);
  }
}

Fixed version (ground truth):
/** 
 * Take the next step after a given one (see nextStep()) 
 */
protected void nextStep(int step){
  log.debug("String_Node_Str" + step);
  int stepIndex;
  for (stepIndex=0; stepIndex < steps.length; stepIndex++) {
    if (steps[stepIndex] == step)     break;
  }
  while (++stepIndex < steps.length) {
    step=steps[stepIndex];
    if (step == STEP_LAY_TOKEN && operatingCompany.getNumberOfFreeBaseTokens() == 0) {
      continue;
    }
    if (step == STEP_CALC_REVENUE) {
      if (operatingCompany.getPortfolio().getNumberOfTrains() == 0) {
        operatingCompany.setLastRevenue(0);
        operatingCompany.setLastRevenueAllocation(SetDividend.UNKNOWN);
        ReportBuffer.add(LocalText.getText("String_Node_Str",new String[]{operatingCompany.getName(),Bank.format(0)}));
        continue;
      }
    }
    if (step == STEP_PAYOUT) {
      int amount=operatingCompany.getLastRevenue();
      if (amount == 0) {
        operatingCompany.withhold(0);
        DisplayBuffer.add(LocalText.getText("String_Node_Str",new String[]{operatingCompany.getName(),Bank.format(0)}));
        continue;
      }
 else       if (operatingCompany.isSplitAlways()) {
        operatingCompany.splitRevenue(amount);
        continue;
      }
    }
    break;
  }
  if (step >= steps.length) {
    done();
  }
 else {
    setStep(step);
  }
}
Program: 173832
Project: 173832
Buggy source:
/** 
 * Deserialize 
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  in.defaultReadObject();
  train=Train.getByUniqueId(trainUniqueId);
  log.debug("String_Node_Str" + trainUniqueId + "String_Node_Str"+ train);
  from=Portfolio.getByName(fromName);
  if (trainsForExchangeUniqueIds != null && trainsForExchangeUniqueIds.length > 0) {
    trainsForExchange=new ArrayList<TrainI>();
    for (int i=0; i < trainsForExchangeUniqueIds.length; i++) {
      trainsForExchange.add(Train.getByUniqueId(trainsForExchangeUniqueIds[i]));
    }
  }
  if (Util.hasValue(exchangedTrainUniqueId)) {
    exchangedTrain=Train.getByUniqueId(exchangedTrainUniqueId);
  }
}

Fixed version (ground truth):
/** 
 * Deserialize 
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  in.defaultReadObject();
  train=Train.getByUniqueId(trainUniqueId);
  from=Portfolio.getByName(fromName);
  if (trainsForExchangeUniqueIds != null && trainsForExchangeUniqueIds.length > 0) {
    trainsForExchange=new ArrayList<TrainI>();
    for (int i=0; i < trainsForExchangeUniqueIds.length; i++) {
      trainsForExchange.add(Train.getByUniqueId(trainsForExchangeUniqueIds[i]));
    }
  }
  if (Util.hasValue(exchangedTrainUniqueId)) {
    exchangedTrain=Train.getByUniqueId(exchangedTrainUniqueId);
  }
}
Program: 173833
Project: 173833
Buggy source:
public void loadGame(){
  JFileChooser jfc=new JFileChooser();
  if (providedName != null) {
    jfc.setSelectedFile(new File(providedName));
  }
 else {
    jfc.setCurrentDirectory(new File(saveDirectory));
  }
  if (jfc.showOpenDialog(options.getContentPane()) == JFileChooser.APPROVE_OPTION) {
    File selectedFile=jfc.getSelectedFile();
    String filepath=selectedFile.getPath();
    saveDirectory=selectedFile.getParent();
    GameAction loadAction=new GameAction(GameAction.LOAD);
    loadAction.setFilepath(filepath);
    GameManager.load(loadAction);
    gameUIInit();
    processOnServer(null);
    DisplayBuffer.clear();
    updateUI();
    statusWindow.setGameActions();
  }
}

Fixed version (ground truth):
public void loadGame(){
  JFileChooser jfc=new JFileChooser();
  if (providedName != null) {
    jfc.setSelectedFile(new File(providedName));
  }
 else {
    jfc.setCurrentDirectory(new File(saveDirectory));
  }
  if (jfc.showOpenDialog(options.getContentPane()) == JFileChooser.APPROVE_OPTION) {
    File selectedFile=jfc.getSelectedFile();
    String filepath=selectedFile.getPath();
    saveDirectory=selectedFile.getParent();
    GameAction loadAction=new GameAction(GameAction.LOAD);
    loadAction.setFilepath(filepath);
    GameManager.load(loadAction);
    DisplayBuffer.clear();
    gameUIInit();
    processOnServer(null);
    updateUI();
    statusWindow.setGameActions();
  }
}
Program: 173834
Project: 173834
Buggy source:
public boolean processOnServer(PossibleAction action){
  lastAction=action;
  log.debug("String_Node_Str" + action);
  Player player=GameManager.getCurrentPlayer();
  if (action != null && player != null) {
    action.setPlayerName(player.getName());
  }
  boolean result=gameManager.process(action);
  log.debug("String_Node_Str" + result);
  ReportWindow.addLog();
  if (GameManager.isGameOver()) {
    statusWindow.reportGameOver();
    return true;
  }
 else   if (Bank.isJustBroken()) {
    statusWindow.reportBankBroken();
  }
  updateUI();
  statusWindow.setGameActions();
  if (result) {
    return activeWindow.processImmediateAction();
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean processOnServer(PossibleAction action){
  lastAction=action;
  log.debug("String_Node_Str" + action);
  Player player=GameManager.getCurrentPlayer();
  if (action != null && player != null) {
    action.setPlayerName(player.getName());
  }
  boolean result=gameManager.process(action);
  log.debug("String_Node_Str" + result);
  activeWindow.displayMessage();
  ReportWindow.addLog();
  if (GameManager.isGameOver()) {
    statusWindow.reportGameOver();
    return true;
  }
 else   if (Bank.isJustBroken()) {
    statusWindow.reportBankBroken();
  }
  updateUI();
  statusWindow.setGameActions();
  if (result) {
    return activeWindow.processImmediateAction();
  }
 else {
    return false;
  }
}
Program: 173835
Project: 173835
Buggy source:
public void activate(){
  repaintUpgradePanel();
  orPanel.recreate();
  orPanel.updateStatus();
  setVisible(true);
  requestFocus();
}

Fixed version (ground truth):
public void activate(){
  repaintUpgradePanel();
  orPanel.recreate();
  setVisible(true);
  requestFocus();
}
Program: 173837
Project: 173837
Buggy source:
public boolean process(PossibleAction executedAction){
  Game.getLogger().debug("String_Node_Str" + executedAction.toString());
  if (executedAction == null) {
    JOptionPane.showMessageDialog(this,"String_Node_Str");
    return false;
  }
  gameUIManager.processOnServer(executedAction);
  displayError();
  return true;
}

Fixed version (ground truth):
public boolean process(PossibleAction executedAction){
  Game.getLogger().debug("String_Node_Str" + executedAction.toString());
  if (executedAction == null) {
    JOptionPane.showMessageDialog(this,"String_Node_Str");
    return false;
  }
  gameUIManager.processOnServer(executedAction);
  return true;
}
Program: 173838
Project: 173838
Buggy source:
private void toggleOptions(){
  if (optionsPane.isVisible()) {
    optionsPane.setVisible(false);
    optionsPane.removeAll();
    optionComponents.clear();
  }
 else {
    availableOptions=GamesInfo.getOptions(gameName);
    if (availableOptions != null && !availableOptions.isEmpty()) {
      for (      GameOption option : availableOptions) {
        if (option.isBoolean()) {
          JCheckBox checkbox=new JCheckBox(LocalText.getText(option.getName()));
          if (option.getDefaultValue().equalsIgnoreCase("String_Node_Str")) {
            checkbox.setSelected(true);
          }
          optionsPane.add(checkbox);
          optionComponents.add(checkbox);
        }
 else {
          optionsPane.add(new JLabel(LocalText.getText("String_Node_Str",LocalText.getText(option.getName()))));
          JComboBox dropdown=new JComboBox();
          for (          String value : option.getAllowedValues()) {
            dropdown.addItem(value);
          }
          optionsPane.add(dropdown);
          optionComponents.add(dropdown);
        }
      }
    }
 else {
      JLabel label=new JLabel(LocalText.getText("String_Node_Str"));
      optionsPane.add(label);
    }
    optionsPane.setVisible(true);
  }
}

Fixed version (ground truth):
private void toggleOptions(){
  if (optionsPane.isVisible()) {
    optionsPane.setVisible(false);
    optionsPane.removeAll();
    optionComponents.clear();
  }
 else {
    availableOptions=GamesInfo.getOptions(gameName);
    if (availableOptions != null && !availableOptions.isEmpty()) {
      optionsPane.setLayout(new GridLayout((availableOptions.size()),1));
      for (      GameOption option : availableOptions) {
        if (option.isBoolean()) {
          JCheckBox checkbox=new JCheckBox(LocalText.getText(option.getName()));
          if (option.getDefaultValue().equalsIgnoreCase("String_Node_Str")) {
            checkbox.setSelected(true);
          }
          optionsPane.add(checkbox);
          optionComponents.add(checkbox);
        }
 else {
          optionsPane.setLayout(new GridLayout((availableOptions.size() + 1),1));
          optionsPane.add(new JLabel(LocalText.getText("String_Node_Str",LocalText.getText(option.getName()))));
          JComboBox dropdown=new JComboBox();
          for (          String value : option.getAllowedValues()) {
            dropdown.addItem(value);
          }
          optionsPane.add(dropdown);
          optionComponents.add(dropdown);
        }
      }
    }
 else {
      JLabel label=new JLabel(LocalText.getText("String_Node_Str"));
      optionsPane.add(label);
    }
    optionsPane.setVisible(true);
  }
}
Program: 173839
Project: 173839
Buggy source:
public void actionPerformed(ActionEvent arg0){
  if (arg0.getSource().equals(newButton)) {
    startNewGame();
  }
 else   if (arg0.getSource().equals(optionButton)) {
    toggleOptions();
  }
 else   if (arg0.getSource().equals(loadButton) && gameUIManager.loadGame()) {
    setVisible(false);
  }
 else   if (arg0.getSource().equals(quitButton)) {
    System.exit(0);
  }
 else   if (arg0.getSource().equals(gameNameBox)) {
    gameName=gameNameBox.getSelectedItem().toString().split("String_Node_Str")[0];
    fillPlayersPane();
    if (optionsPane.isVisible()) {
      toggleOptions();
      toggleOptions();
    }
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent arg0){
  if (arg0.getSource().equals(newButton)) {
    startNewGame();
  }
 else   if (arg0.getSource().equals(optionButton)) {
    toggleOptions();
    this.pack();
  }
 else   if (arg0.getSource().equals(loadButton) && gameUIManager.loadGame()) {
    setVisible(false);
  }
 else   if (arg0.getSource().equals(quitButton)) {
    System.exit(0);
  }
 else   if (arg0.getSource().equals(gameNameBox)) {
    gameName=gameNameBox.getSelectedItem().toString().split("String_Node_Str")[0];
    fillPlayersPane();
    if (optionsPane.isVisible()) {
      toggleOptions();
      toggleOptions();
    }
    this.pack();
  }
}
Program: 173840
Project: 173840
Buggy source:
private void fillPlayersPane(){
  playersPane.setVisible(false);
  int maxPlayers=GamesInfo.getMaxPlayers(gameName);
  String[] playerList=new String[maxPlayers];
  String[] testPlayers=Config.get("String_Node_Str").split("String_Node_Str");
  for (int i=0; i < playerNameFields.length; i++) {
    if (playerNameFields[i] != null && playerNameFields[i].getText().length() > 0) {
      playerList[i]=playerNameFields[i].getText();
    }
 else     if (i < testPlayers.length && testPlayers[i].length() > 0) {
      playerList[i]=testPlayers[i];
    }
  }
  playersPane.removeAll();
  playersPane.setLayout(new GridLayout(Player.MAX_PLAYERS + 1,0));
  playersPane.setBorder(BorderFactory.createLoweredBevelBorder());
  playersPane.add(new JLabel("String_Node_Str"));
  playersPane.add(new JLabel("String_Node_Str"));
  for (int i=0; i < GamesInfo.getMaxPlayers(gameName); i++) {
    playerBoxes[i]=new JComboBox();
    playerBoxes[i].addItem("String_Node_Str");
    playerBoxes[i].addItem("String_Node_Str");
    if (testPlayers.length > 0 && i < playerList.length) {
      playerNameFields[i]=new JTextField(playerList[i]);
    }
 else {
      playerNameFields[i]=new JTextField();
    }
    if (playerNameFields[i].getText().length() > 0) {
      playerBoxes[i].setSelectedIndex(1);
    }
 else {
      playerBoxes[i].setSelectedIndex(0);
    }
    playersPane.add(playerBoxes[i]);
    playersPane.add(playerNameFields[i]);
  }
  playersPane.setVisible(true);
}

Fixed version (ground truth):
private void fillPlayersPane(){
  playersPane.setVisible(false);
  int maxPlayers=GamesInfo.getMaxPlayers(gameName);
  String[] playerList=new String[maxPlayers];
  String[] testPlayers=Config.get("String_Node_Str").split("String_Node_Str");
  for (int i=0; i < playerNameFields.length; i++) {
    if (playerNameFields[i] != null && playerNameFields[i].getText().length() > 0) {
      playerList[i]=playerNameFields[i].getText();
    }
 else     if (i < testPlayers.length && testPlayers[i].length() > 0) {
      playerList[i]=testPlayers[i];
    }
  }
  playersPane.removeAll();
  playersPane.setLayout(new GridLayout(maxPlayers + 1,0));
  playersPane.setBorder(BorderFactory.createLoweredBevelBorder());
  playersPane.add(new JLabel("String_Node_Str"));
  playersPane.add(new JLabel("String_Node_Str"));
  for (int i=0; i < GamesInfo.getMaxPlayers(gameName); i++) {
    playerBoxes[i]=new JComboBox();
    playerBoxes[i].addItem("String_Node_Str");
    playerBoxes[i].addItem("String_Node_Str");
    if (testPlayers.length > 0 && i < playerList.length) {
      playerNameFields[i]=new JTextField(playerList[i]);
    }
 else {
      playerNameFields[i]=new JTextField();
    }
    if (playerNameFields[i].getText().length() > 0) {
      playerBoxes[i].setSelectedIndex(1);
    }
 else {
      playerBoxes[i].setSelectedIndex(0);
    }
    playersPane.add(playerBoxes[i]);
    playersPane.add(playerNameFields[i]);
  }
  playersPane.setVisible(true);
}
Program: 173841
Project: 173841
Buggy source:
private void populateGridBag(){
  gc.gridx=0;
  gc.gridy=0;
  gc.weightx=1.0;
  gc.weighty=1.0;
  gc.gridwidth=1;
  gc.fill=GridBagConstraints.BOTH;
  this.getContentPane().add(playersPane,gc);
  gc.gridx=0;
  gc.gridy=1;
  gc.fill=1;
  gc.weightx=0.5;
  gc.weighty=0.5;
  gc.gridwidth=1;
  gc.ipady=50;
  this.getContentPane().add(gameListPane,gc);
  gc.gridx=0;
  gc.gridy=2;
  gc.weightx=0.0;
  gc.weighty=0.0;
  gc.gridwidth=1;
  gc.ipady=0;
  gc.fill=GridBagConstraints.HORIZONTAL;
  this.getContentPane().add(optionsPane,gc);
  gc.gridx=0;
  gc.gridy=3;
  gc.weightx=0.0;
  gc.weighty=0.0;
  gc.gridwidth=1;
  gc.ipady=0;
  gc.fill=GridBagConstraints.HORIZONTAL;
  this.getContentPane().add(buttonPane,gc);
}

Fixed version (ground truth):
private void populateGridBag(){
  gc=new GridBagConstraints();
  gc.gridx=0;
  gc.gridy=0;
  gc.weightx=0;
  gc.weighty=0;
  gc.gridwidth=1;
  gc.gridheight=1;
  gc.ipadx=0;
  gc.ipady=0;
  gc.anchor=GridBagConstraints.CENTER;
  gc.fill=GridBagConstraints.HORIZONTAL;
  gc.insets=new Insets(0,0,0,0);
  this.getContentPane().add(playersPane,gc);
  gc=new GridBagConstraints();
  gc.gridx=0;
  gc.gridy=1;
  gc.weightx=0;
  gc.weighty=0;
  gc.gridwidth=1;
  gc.gridheight=1;
  gc.ipadx=0;
  gc.ipady=0;
  gc.anchor=GridBagConstraints.CENTER;
  gc.fill=GridBagConstraints.BOTH;
  gc.insets=new Insets(0,0,0,0);
  this.getContentPane().add(gameListPane,gc);
  gc=new GridBagConstraints();
  gc.gridx=0;
  gc.gridy=2;
  gc.weightx=0;
  gc.weighty=0;
  gc.gridwidth=1;
  gc.gridheight=1;
  gc.ipadx=0;
  gc.ipady=0;
  gc.anchor=GridBagConstraints.CENTER;
  gc.fill=GridBagConstraints.BOTH;
  gc.insets=new Insets(0,0,0,0);
  this.getContentPane().add(optionsPane,gc);
  gc=new GridBagConstraints();
  gc.gridx=0;
  gc.gridy=3;
  gc.weightx=0;
  gc.weighty=0;
  gc.gridwidth=1;
  gc.gridheight=1;
  gc.ipadx=0;
  gc.ipady=0;
  gc.anchor=GridBagConstraints.CENTER;
  gc.fill=GridBagConstraints.HORIZONTAL;
  gc.insets=new Insets(0,0,0,0);
  this.getContentPane().add(buttonPane,gc);
}
Program: 173843
Project: 173843
Buggy source:
public void setNeighbor(int orientation,MapHex neighbour){
  orientation%=6;
  neighbours[orientation]=neighbour;
}

Fixed version (ground truth):
/** 
 * @return Returns the preprintedTileOrientation.
 */
public void setNeighbor(int orientation,MapHex neighbour){
  orientation%=6;
  neighbours[orientation]=neighbour;
}