nus-yam/ex-repair huggingface dataset:
Program: 49878
Project: 49878
Buggy source:
public Set<BoardCoordinate> getMovesFrom(@NotNull BoardCoordinate startLocation,@NotNull BoardSize boardSize,int moveCount){
  Set<BoardCoordinate> moves=new HashSet<>();
  if (moveCount == 0) {
    if (getName().equals("String_Node_Str")) {
      moves.add(BoardCoordinate.at(startLocation.x,startLocation.y + 2));
    }
 else     if (getName().equals("String_Node_Str")) {
      moves.add(BoardCoordinate.at(startLocation.x,startLocation.y - 2));
    }
  }
  for (  Direction direction : mMovements.keySet()) {
    PathMaker pathMaker=new PathMaker(startLocation,direction.getFurthestPoint(startLocation,boardSize));
    moves.addAll(pathMaker.getPathToDestination(mMovements.get(direction)));
  }
  for (  TwoHopMovement twoHopMovement : mTwoHopMovements) {
    Set<BoardCoordinate> allMoves=new HashSet<>();
    for (int quadrant=1; quadrant <= 4; quadrant++) {
      allMoves.addAll(getQuadrantMoves(startLocation,twoHopMovement,quadrant));
    }
    for (    BoardCoordinate move : allMoves) {
      if (move.isValid(boardSize)) {
        moves.add(move);
      }
    }
  }
  return moves;
}

Fixed version (ground truth):
public Set<BoardCoordinate> getMovesFrom(@NotNull BoardCoordinate startLocation,@NotNull BoardSize boardSize,int moveCount){
  Set<BoardCoordinate> moves=getMovesFromImpl(startLocation,boardSize,mMovements);
  if (moveCount == 0) {
    if (getName().equals("String_Node_Str")) {
      moves.add(BoardCoordinate.at(startLocation.x,startLocation.y + 2));
    }
 else     if (getName().equals("String_Node_Str")) {
      moves.add(BoardCoordinate.at(startLocation.x,startLocation.y - 2));
    }
  }
  return moves;
}
Program: 49879
Project: 49879
Buggy source:
public static PieceType getKingPieceType(){
  Map<Direction,Integer> movements=Maps.newHashMap();
  for (  Direction direction : Direction.values()) {
    movements.put(direction,1);
  }
  return new PieceType("String_Node_Str",movements,null,null);
}

Fixed version (ground truth):
public static PieceType getKingPieceType(){
  Map<Direction,Integer> movements=Maps.newHashMap();
  for (  Direction direction : Direction.values()) {
    movements.put(direction,1);
  }
  return new PieceType("String_Node_Str",movements,null);
}
Program: 49880
Project: 49880
Buggy source:
private void createGrid(BoardSize boardSize){
  for (int y=boardSize.height; y > 0; y--) {
    JLabel label=GuiUtility.createJLabel("String_Node_Str" + y);
    label.setHorizontalAlignment(SwingConstants.CENTER);
    add(label);
    for (int x=boardSize.width; x > 0; x--) {
      SquareJLabel square=new SquareJLabel(BoardCoordinate.at(x,y),true,48);
      square.addMouseMotionListener(new MotionAdapter(mGlassPane));
      square.addMouseListener(new SquareListener(square,mDropManager,mGlassPane));
      add(square);
      mSquareLabels[x - 1][y - 1]=square;
      square.refresh();
    }
  }
  for (int x=0; x <= boardSize.width; x++) {
    if (x != 0) {
      JLabel label=GuiUtility.createJLabel("String_Node_Str" + (char)(x - 1 + 'A'));
      label.setHorizontalAlignment(SwingConstants.CENTER);
      add(label);
    }
 else {
      add(GuiUtility.createJLabel("String_Node_Str"));
    }
  }
}

Fixed version (ground truth):
private void createGrid(BoardSize boardSize){
  for (int y=boardSize.height; y > 0; y--) {
    JLabel label=GuiUtility.createJLabel("String_Node_Str" + y);
    label.setHorizontalAlignment(SwingConstants.CENTER);
    add(label);
    for (int x=1; x <= boardSize.width; x++) {
      SquareJLabel square=new SquareJLabel(BoardCoordinate.at(x,y),true,48);
      square.addMouseMotionListener(new MotionAdapter(mGlassPane));
      square.addMouseListener(new SquareListener(square,mDropManager,mGlassPane));
      add(square);
      mSquareLabels[x - 1][y - 1]=square;
      square.refresh();
    }
  }
  for (int x=0; x <= boardSize.width; x++) {
    if (x != 0) {
      JLabel label=GuiUtility.createJLabel("String_Node_Str" + (char)(x - 1 + 'A'));
      label.setHorizontalAlignment(SwingConstants.CENTER);
      add(label);
    }
 else {
      add(GuiUtility.createJLabel("String_Node_Str"));
    }
  }
}
Program: 49881
Project: 49881
Buggy source:
private List<ChessCoordinate> getVerticalPathSpaces(int maxSteps){
  int least=Math.min(mOrigin.y,mDestination.y);
  int most=Math.max(mOrigin.y,mDestination.y);
  List<ChessCoordinate> spaces=new ArrayList<>();
  for (int y=least + 1, steps=1; y <= most && steps <= maxSteps; y++, steps++) {
    spaces.add(ChessCoordinate.at(mOrigin.x,y));
  }
  return spaces;
}

Fixed version (ground truth):
private List<ChessCoordinate> getVerticalPathSpaces(int maxSteps){
  int least=Math.min(mOrigin.y,mDestination.y);
  int most=Math.max(mOrigin.y,mDestination.y);
  List<ChessCoordinate> spaces=new ArrayList<>();
  for (int y=least + 1; y <= most; y++) {
    if (Math.abs(mOrigin.y - y) <= maxSteps) {
      spaces.add(ChessCoordinate.at(mOrigin.x,y));
    }
  }
  spaces.remove(mOrigin);
  return spaces;
}
Program: 49882
Project: 49882
Buggy source:
private List<ChessCoordinate> getHorizontalPathSpaces(int maxSteps){
  int least=Math.min(mOrigin.x,mDestination.x);
  int most=Math.max(mOrigin.x,mDestination.x);
  List<ChessCoordinate> spaces=new ArrayList<>();
  for (int x=least + 1, steps=1; x <= most && steps <= maxSteps; x++, steps++) {
    spaces.add(ChessCoordinate.at(x,mOrigin.y));
  }
  return spaces;
}

Fixed version (ground truth):
private List<ChessCoordinate> getHorizontalPathSpaces(int maxSteps){
  int least=Math.min(mOrigin.x,mDestination.x);
  int most=Math.max(mOrigin.x,mDestination.x);
  List<ChessCoordinate> spaces=new ArrayList<>();
  for (int x=least; x <= most; x++) {
    if (Math.abs(mOrigin.x - x) <= maxSteps) {
      spaces.add(ChessCoordinate.at(x,mOrigin.y));
    }
  }
  spaces.remove(mOrigin);
  return spaces;
}
Program: 49884
Project: 49884
Buggy source:
public void saveGame(){
  String fileName=JOptionPane.showInputDialog(Driver.getInstance(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),JOptionPane.PLAIN_MESSAGE);
  if (fileName == null)   return;
  getGame().saveGame(fileName,false);
}

Fixed version (ground truth):
public void saveGame(){
  String fileName=JOptionPane.showInputDialog(Driver.getInstance(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),JOptionPane.PLAIN_MESSAGE);
  if (fileName == null)   return;
  getGame().saveGame(fileName,false,true);
}
Program: 49886
Project: 49886
Buggy source:
public WatchGamePanel(File acnFile){
  if (acnFile == null)   return;
  Game game=null;
  try {
    game=AlgebraicConverter.convert(Builder.newGame(Messages.getString("String_Node_Str")),acnFile);
  }
 catch (  Exception e1) {
    e1.printStackTrace();
  }
  if (game != null)   setGame(game);
 else   game=getGame();
  WatchGamePanel.mWhiteTimer=ChessTimer.createTimer(TimerTypes.NO_TIMER,null,0,0,false);
  WatchGamePanel.mBlackTimer=ChessTimer.createTimer(TimerTypes.NO_TIMER,null,0,0,true);
  mHistory=new Move[game.getHistory().size()];
  game.getHistory().toArray(mHistory);
  try {
    initComponents();
    mHistoryIndex=mHistory.length - 1;
    while (mHistoryIndex >= 0) {
      mHistory[mHistoryIndex].undo();
      mHistoryIndex--;
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  boardRefresh(game.getBoards());
}

Fixed version (ground truth):
public WatchGamePanel(File saveFile){
  if (saveFile == null)   return;
  Game game=null;
  try {
    game=AlgebraicConverter.convert(Builder.newGame(Messages.getString("String_Node_Str")),saveFile);
  }
 catch (  Exception e1) {
    try {
      ObjectInputStream in=new ObjectInputStream(new FileInputStream(saveFile));
      game=(Game)in.readObject();
      game.setIsPlayback(true);
      game.setBlackMove(false);
      in.close();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  if (game != null)   setGame(game);
 else   game=getGame();
  WatchGamePanel.mWhiteTimer=ChessTimer.createTimer(TimerTypes.NO_TIMER,null,0,0,false);
  WatchGamePanel.mBlackTimer=ChessTimer.createTimer(TimerTypes.NO_TIMER,null,0,0,true);
  mHistory=new Move[game.getHistory().size()];
  game.getHistory().toArray(mHistory);
  try {
    initComponents();
    mHistoryIndex=mHistory.length - 1;
    while (mHistoryIndex >= 0) {
      mHistory[mHistoryIndex].undo();
      mHistoryIndex--;
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  boardRefresh(game.getBoards());
}
Program: 49887
Project: 49887
Buggy source:
public void saveGame(){
  String fileName=JOptionPane.showInputDialog(Driver.getInstance(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),JOptionPane.PLAIN_MESSAGE);
  if (fileName == null)   return;
  getGame().saveGame(fileName,false);
}

Fixed version (ground truth):
@Override public void saveGame(){
}
Program: 49888
Project: 49888
Buggy source:
/** 
 * Revert to the previous turn
 */
public void prevTurn(){
  setBlackMove(getWhiteRules().prevTurn());
}

Fixed version (ground truth):
/** 
 * Revert to the previous turn
 */
public void prevTurn(){
  setBlackMove(getWhiteRules().prevTurn(mIsPlayback));
}
Program: 49889
Project: 49889
Buggy source:
/** 
 * Saves game's state to file.
 * @param dirName The directory in which to save the game
 * @param fileName The name for the game file
 * @param ACN Whether the game should be saved in ACN
 */
public void saveGame(String fileName,boolean ACN){
  try {
    if (ACN) {
      FileOutputStream f_out=new FileOutputStream(FileUtility.getCompletedGamesFile(fileName));
      ObjectOutputStream out=new ObjectOutputStream(f_out);
      out.writeObject(this);
      out.close();
      f_out.close();
      AlgebraicConverter.convert(getHistory(),(fileName));
    }
 else {
      FileOutputStream f_out=new FileOutputStream(FileUtility.getGamesInProgressFile(fileName));
      ObjectOutputStream out=new ObjectOutputStream(f_out);
      out.writeObject(this);
      out.close();
      f_out.close();
    }
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
/** 
 * Saves game's state to file.
 * @param dirName The directory in which to save the game
 * @param fileName The name for the game file
 * @param ACN Whether the game should be saved in ACN
 * @param inProgress 
 */
public void saveGame(String fileName,boolean ACN,boolean inProgress){
  try {
    if (!inProgress) {
      FileOutputStream f_out=new FileOutputStream(FileUtility.getCompletedGamesFile(fileName));
      ObjectOutputStream out=new ObjectOutputStream(f_out);
      out.writeObject(this);
      out.close();
      f_out.close();
      if (ACN)       AlgebraicConverter.convert(getHistory(),fileName);
    }
 else {
      FileOutputStream f_out=new FileOutputStream(FileUtility.getGamesInProgressFile(fileName));
      ObjectOutputStream out=new ObjectOutputStream(f_out);
      out.writeObject(this);
      out.close();
      f_out.close();
    }
  }
 catch (  Exception e) {
  }
}
Program: 49891
Project: 49891
Buggy source:
public PlayGamePanel(Game game,boolean isPlayback) throws Exception {
  PlayGamePanel.setGame(game);
  PlayGamePanel.mIsPlayback=isPlayback;
  m_dropManager=new DropManager();
  if (isPlayback) {
    PlayGamePanel.mWhiteTimer=ChessTimer.createTimer(TimerTypes.NO_TIMER,null,0,0,false);
    PlayGamePanel.mBlackTimer=ChessTimer.createTimer(TimerTypes.NO_TIMER,null,0,0,true);
    mHistory=new Move[game.getHistory().size()];
    game.getHistory().toArray(mHistory);
    initComponents(isPlayback);
    mHistoryIndex=mHistory.length - 1;
    while (mHistoryIndex >= 0) {
      mHistory[mHistoryIndex].undo();
      mHistoryIndex--;
    }
  }
 else {
    m_globalGlassPane=new GlassPane();
    m_globalGlassPane.setOpaque(false);
    Driver.getInstance().setGlassPane(m_globalGlassPane);
    PlayGamePanel.mWhiteTimer=game.getWhiteTimer();
    PlayGamePanel.mBlackTimer=game.getBlackTimer();
    mWhiteTimer.restart();
    mBlackTimer.restart();
    turn(game.isBlackMove());
    mHistory=null;
    mHistoryIndex=-3;
    initComponents(isPlayback);
  }
  m_instance=this;
  boardRefresh(game.getBoards());
}

Fixed version (ground truth):
public PlayGamePanel(Game game,boolean isPlayback) throws Exception {
  PlayGamePanel.setGame(game);
  mGame=game;
  PlayGamePanel.mIsPlayback=isPlayback;
  mIsPlayback=isPlayback;
  m_dropManager=new DropManager();
  if (isPlayback) {
    PlayGamePanel.mWhiteTimer=ChessTimer.createTimer(TimerTypes.NO_TIMER,null,0,0,false);
    PlayGamePanel.mBlackTimer=ChessTimer.createTimer(TimerTypes.NO_TIMER,null,0,0,true);
    mHistory=new Move[game.getHistory().size()];
    game.getHistory().toArray(mHistory);
    initComponents(isPlayback);
    mHistoryIndex=mHistory.length - 1;
    while (mHistoryIndex >= 0) {
      mHistory[mHistoryIndex].undo();
      mHistoryIndex--;
    }
  }
 else {
    m_globalGlassPane=new GlassPane();
    m_globalGlassPane.setOpaque(false);
    Driver.getInstance().setGlassPane(m_globalGlassPane);
    PlayGamePanel.mWhiteTimer=game.getWhiteTimer();
    PlayGamePanel.mBlackTimer=game.getBlackTimer();
    mWhiteTimer.restart();
    mBlackTimer.restart();
    turn(game.isBlackMove());
    mHistory=null;
    mHistoryIndex=-3;
    initComponents(isPlayback);
  }
  m_instance=this;
  boardRefresh(game.getBoards());
}
Program: 49892
Project: 49892
Buggy source:
public static void setGame(Game game){
  PlayGamePanel.mGame=game;
}

Fixed version (ground truth):
public static void setGame(Game game){
  mGame=game;
}
Program: 49893
Project: 49893
Buggy source:
/** 
 * Determine if a Move is legal to be executed
 * @param move The Move on which to check legality
 * @return Whether or not the Move is legal
 * @throws Exception Throws if there was an illegal move, or failure toundo.
 */
public boolean isLegalMove(Move move) throws Exception {
  if (move == null)   return false;
  move.execute();
  move.undo();
  return true;
}

Fixed version (ground truth):
/** 
 * Determine if a Move is legal to be executed
 * @param move The Move on which to check legality
 * @return Whether or not the Move is legal
 * @throws Exception Throws if there was an illegal move, or failure toundo.
 */
public boolean isLegalMove(Move move) throws Exception {
  if (move == null)   return false;
  move.board=this;
  move.execute();
  move.undo();
  return true;
}
Program: 49894
Project: 49894
Buggy source:
/** 
 * Create a piece that represents a queen, without requiring a concrete queen class.
 * @param isBlack Is this piece black?
 * @param square What square does this piece start on?
 * @param board The board the piece is on
 * @return The constructed queen.
 * @throws IOException
 */
public static Piece createQueen(boolean isBlack,Square square,Board board) throws IOException {
  Map<Character,Integer> queenMovement=Maps.newHashMap();
  queenMovement.put('N',-1);
  queenMovement.put('S',-1);
  queenMovement.put('W',-1);
  queenMovement.put('E',-1);
  queenMovement.put('R',-1);
  queenMovement.put('r',-1);
  queenMovement.put('L',-1);
  queenMovement.put('l',-1);
  return new Piece(Messages.getString("String_Node_Str"),isBlack,square,board,queenMovement);
}

Fixed version (ground truth):
/** 
 * Create a piece that represents a queen, without requiring a concrete queen class.
 * @param isBlack Is this piece black?
 * @param square What square does this piece start on?
 * @param board The board the piece is on
 * @return The constructed queen.
 * @throws IOException
 */
public static Piece createQueen(boolean isBlack,Square square,Board board) throws IOException {
  Map<Character,Integer> queenMovement=Maps.newHashMap();
  queenMovement.put(PieceBuilder.NORTH,-1);
  queenMovement.put(PieceBuilder.SOUTH,-1);
  queenMovement.put(PieceBuilder.WEST,-1);
  queenMovement.put(PieceBuilder.EAST,-1);
  queenMovement.put(PieceBuilder.NORTHEAST,-1);
  queenMovement.put(PieceBuilder.SOUTHEAST,-1);
  queenMovement.put(PieceBuilder.NORTHWEST,-1);
  queenMovement.put(PieceBuilder.SOUTHWEST,-1);
  return new Piece(Messages.getString("String_Node_Str"),isBlack,square,board,queenMovement);
}
Program: 49895
Project: 49895
Buggy source:
/** 
 * Create a piece that represents a knight, without requiring a concrete knight class.
 * @param isBlack Is this piece black?
 * @param square What square does this piece start on?
 * @param board The board the piece is on
 * @return The constructed knight.
 * @throws IOException
 */
public static Piece createKnight(boolean isBlack,Square square,Board board) throws IOException {
  Map<Character,Integer> knightMovement=Maps.newHashMap();
  knightMovement.put('x',1);
  knightMovement.put('y',2);
  return new Piece(Messages.getString("String_Node_Str"),isBlack,square,board,knightMovement);
}

Fixed version (ground truth):
/** 
 * Create a piece that represents a knight, without requiring a concrete knight class.
 * @param isBlack Is this piece black?
 * @param square What square does this piece start on?
 * @param board The board the piece is on
 * @return The constructed knight.
 * @throws IOException
 */
public static Piece createKnight(boolean isBlack,Square square,Board board) throws IOException {
  Map<Character,Integer> knightMovement=Maps.newHashMap();
  knightMovement.put(PieceBuilder.KNIGHT_ONE,1);
  knightMovement.put(PieceBuilder.KNIGHT_TWO,2);
  return new Piece(Messages.getString("String_Node_Str"),isBlack,square,board,knightMovement);
}
Program: 49896
Project: 49896
Buggy source:
/** 
 * Create a piece that represents a king, without requiring a concrete king class.
 * @param isBlack Is this piece black?
 * @param square What square does this piece start on?
 * @param board The board the piece is on
 * @return The constructed king.
 * @throws IOException
 */
public static Piece createKing(boolean isBlack,Square square,Board board) throws IOException {
  Map<Character,Integer> kingMovement=Maps.newHashMap();
  kingMovement.put('N',1);
  kingMovement.put('S',1);
  kingMovement.put('E',1);
  kingMovement.put('W',1);
  kingMovement.put('R',1);
  kingMovement.put('r',1);
  kingMovement.put('L',1);
  kingMovement.put('l',1);
  return new Piece(Messages.getString("String_Node_Str"),isBlack,square,board,kingMovement);
}

Fixed version (ground truth):
/** 
 * Create a piece that represents a king, without requiring a concrete king class.
 * @param isBlack Is this piece black?
 * @param square What square does this piece start on?
 * @param board The board the piece is on
 * @return The constructed king.
 * @throws IOException
 */
public static Piece createKing(boolean isBlack,Square square,Board board) throws IOException {
  Map<Character,Integer> kingMovement=Maps.newHashMap();
  kingMovement.put(PieceBuilder.NORTH,1);
  kingMovement.put(PieceBuilder.SOUTH,1);
  kingMovement.put(PieceBuilder.EAST,1);
  kingMovement.put(PieceBuilder.WEST,1);
  kingMovement.put(PieceBuilder.NORTHEAST,1);
  kingMovement.put(PieceBuilder.SOUTHEAST,1);
  kingMovement.put(PieceBuilder.NORTHWEST,1);
  kingMovement.put(PieceBuilder.SOUTHWEST,1);
  return new Piece(Messages.getString("String_Node_Str"),isBlack,square,board,kingMovement);
}
Program: 49897
Project: 49897
Buggy source:
/** 
 * Create a piece that represents a rook, without requiring a concrete rook class.
 * @param isBlack Is this piece black?
 * @param square What square does this piece start on?
 * @param board The board the piece is on
 * @return The constructed rook.
 * @throws IOException
 */
public static Piece createRook(boolean isBlack,Square square,Board board) throws IOException {
  Map<Character,Integer> rookMovement=Maps.newHashMap();
  rookMovement.put('N',-1);
  rookMovement.put('S',-1);
  rookMovement.put('W',-1);
  rookMovement.put('E',-1);
  return new Piece(Messages.getString("String_Node_Str"),isBlack,square,board,rookMovement);
}

Fixed version (ground truth):
/** 
 * Create a piece that represents a rook, without requiring a concrete rook class.
 * @param isBlack Is this piece black?
 * @param square What square does this piece start on?
 * @param board The board the piece is on
 * @return The constructed rook.
 * @throws IOException
 */
public static Piece createRook(boolean isBlack,Square square,Board board) throws IOException {
  Map<Character,Integer> rookMovement=Maps.newHashMap();
  rookMovement.put(PieceBuilder.NORTH,-1);
  rookMovement.put(PieceBuilder.SOUTH,-1);
  rookMovement.put(PieceBuilder.WEST,-1);
  rookMovement.put(PieceBuilder.EAST,-1);
  return new Piece(Messages.getString("String_Node_Str"),isBlack,square,board,rookMovement);
}
Program: 49898
Project: 49898
Buggy source:
/** 
 * Create a piece that represents a bishop, without requiring a concrete bishop class.
 * @param isBlack Is this piece black?
 * @param square What square does this piece start on?
 * @param board The board the piece is on
 * @return The constructed bishop.
 * @throws IOException
 */
public static Piece createBishop(boolean isBlack,Square square,Board board) throws IOException {
  Map<Character,Integer> bishopMovement=Maps.newHashMap();
  bishopMovement.put('R',-1);
  bishopMovement.put('r',-1);
  bishopMovement.put('L',-1);
  bishopMovement.put('l',-1);
  return new Piece(Messages.getString("String_Node_Str"),isBlack,square,board,bishopMovement);
}

Fixed version (ground truth):
/** 
 * Create a piece that represents a bishop, without requiring a concrete bishop class.
 * @param isBlack Is this piece black?
 * @param square What square does this piece start on?
 * @param board The board the piece is on
 * @return The constructed bishop.
 * @throws IOException
 */
public static Piece createBishop(boolean isBlack,Square square,Board board) throws IOException {
  Map<Character,Integer> bishopMovement=Maps.newHashMap();
  bishopMovement.put(PieceBuilder.NORTHEAST,-1);
  bishopMovement.put(PieceBuilder.SOUTHEAST,-1);
  bishopMovement.put(PieceBuilder.NORTHWEST,-1);
  bishopMovement.put(PieceBuilder.SOUTHWEST,-1);
  return new Piece(Messages.getString("String_Node_Str"),isBlack,square,board,bishopMovement);
}
Program: 49899
Project: 49899
Buggy source:
/** 
 * Convert a chess piece to it's corresponding character
 * @param p The piece to convert
 * @return The character representing this piece
 */
public char pieceToChar(Piece p){
  if (p.getName().equals(Messages.getString("String_Node_Str")))   return 'N';
 else   return p.getName().charAt(0);
}

Fixed version (ground truth):
/** 
 * Convert a chess piece to it's corresponding character
 * @param p The piece to convert
 * @return The character representing this piece
 */
public char pieceToChar(Piece p){
  if (p.getName().equals(Messages.getString("String_Node_Str")))   return AlgebraicConverter.KNIGHT;
 else   return p.getName().charAt(0);
}
Program: 49900
Project: 49900
Buggy source:
private JButton createNewGameButton(){
  JButton newGameButton=new JButton(Messages.getString("String_Node_Str"));
  newGameButton.setToolTipText(Messages.getString("String_Node_Str"));
  newGameButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent event){
      setPanel(new NewGamePanel());
    }
  }
);
  return newGameButton;
}

Fixed version (ground truth):
private JButton createNewGameButton(){
  JButton newGameButton=new JButton(Messages.getString("String_Node_Str"));
  newGameButton.setToolTipText(Messages.getString("String_Node_Str"));
  try {
    newGameButton.setIcon(GuiUtility.createImageIcon(30,30,FileUtility.getImagePath("String_Node_Str",true)));
  }
 catch (  IOException ae) {
    ae.printStackTrace();
  }
  newGameButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent event){
      setPanel(new NewGamePanel());
    }
  }
);
  return newGameButton;
}
Program: 49901
Project: 49901
Buggy source:
private JButton pieceMenuButton(){
  JButton pieceButton=new JButton(Messages.getString("String_Node_Str"));
  pieceButton.setToolTipText(Messages.getString("String_Node_Str"));
  pieceButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      setPanel(new PieceMenuPanel());
    }
  }
);
  return pieceButton;
}

Fixed version (ground truth):
private JButton pieceMenuButton(){
  JButton pieceButton=new JButton(Messages.getString("String_Node_Str"));
  pieceButton.setToolTipText(Messages.getString("String_Node_Str"));
  try {
    pieceButton.setIcon(GuiUtility.createImageIcon(10,30,FileUtility.getImagePath("String_Node_Str",true)));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  pieceButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      setPanel(new PieceMenuPanel());
    }
  }
);
  return pieceButton;
}
Program: 49902
Project: 49902
Buggy source:
private void initGuiComponents() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
  setTitle(AppConstants.APP_NAME);
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  setSize(325,340);
  setLayout(new FlowLayout());
  setResizable(true);
  setLocationRelativeTo(null);
  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  createWindowsTrayIconIfNecessary();
  createMenuBar();
  mMainPanel=new JPanel();
  mMainPanel.setBorder(BorderFactory.createLoweredBevelBorder());
  mMainPanel.setLayout(new GridBagLayout());
  GridBagConstraints c=new GridBagConstraints();
  c.fill=GridBagConstraints.HORIZONTAL;
  c.weightx=0.0;
  c.gridwidth=4;
  c.gridx=0;
  c.gridy=0;
  try {
    mMainPanel.add(new JLabel(GuiUtility.createImageIcon(300,200,FileUtility.getImagePath("String_Node_Str",true))),c);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  c.fill=GridBagConstraints.HORIZONTAL;
  c.gridx=0;
  c.gridy=1;
  c.gridwidth=1;
  mMainPanel.add(createNewGameButton(),c);
  c.gridx=2;
  c.gridy=1;
  mMainPanel.add(variantMenuButton(),c);
  c.gridx=3;
  c.gridy=1;
  mMainPanel.add(pieceMenuButton(),c);
  c.fill=GridBagConstraints.HORIZONTAL;
  c.gridx=0;
  c.gridy=2;
  c.gridwidth=2;
  mMainPanel.add(createContinueGameButton(),c);
  c.gridx=2;
  c.gridy=2;
  c.gridwidth=1;
  mMainPanel.add(createViewCompletedGamesButton(),c);
  add(mMainPanel);
  setVisible(true);
}

Fixed version (ground truth):
private void initGuiComponents() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
  setTitle(AppConstants.APP_NAME);
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  setSize(685,450);
  setLayout(new FlowLayout());
  setResizable(true);
  setLocationRelativeTo(null);
  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  createWindowsTrayIconIfNecessary();
  createMenuBar();
  mMainPanel=new JPanel();
  mMainPanel.setBorder(BorderFactory.createLoweredBevelBorder());
  mMainPanel.setLayout(new GridBagLayout());
  mButtonPanel=new JPanel();
  mButtonPanel.setLayout(new GridBagLayout());
  GridBagConstraints c=new GridBagConstraints();
  c.fill=GridBagConstraints.HORIZONTAL;
  c.gridx=0;
  c.gridy=0;
  try {
    mMainPanel.add(new JLabel(GuiUtility.createImageIcon(506,380,FileUtility.getImagePath("String_Node_Str",true))),c);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  c.gridx=0;
  c.gridy=0;
  mButtonPanel.add(createNewGameButton(),c);
  c.gridx=0;
  c.gridy=1;
  mButtonPanel.add(variantMenuButton(),c);
  c.gridx=0;
  c.gridy=2;
  mButtonPanel.add(pieceMenuButton(),c);
  c.fill=GridBagConstraints.HORIZONTAL;
  c.gridx=0;
  c.gridy=3;
  mButtonPanel.add(createContinueGameButton(),c);
  c.gridx=0;
  c.gridy=4;
  mButtonPanel.add(createViewCompletedGamesButton(),c);
  c.gridx=1;
  c.gridy=0;
  mMainPanel.add(mButtonPanel,c);
  add(mMainPanel);
  setVisible(true);
}
Program: 49903
Project: 49903
Buggy source:
public void setOptionsMenuVisibility(boolean isVisible){
  mOptionsMenu.setVisible(isVisible);
}

Fixed version (ground truth):
@Override public void setOptionsMenuVisibility(boolean isVisible){
  mOptionsMenu.setVisible(isVisible);
}
Program: 49904
Project: 49904
Buggy source:
public void setFileMenuVisibility(boolean isVisible){
  mFileMenu.setVisible(isVisible);
}

Fixed version (ground truth):
@Override public void setFileMenuVisibility(boolean isVisible){
  mFileMenu.setVisible(isVisible);
}
Program: 49905
Project: 49905
Buggy source:
public void revertToMainPanel(){
  remove(mOtherPanel);
  mMainMenuItem.setVisible(false);
  add(mMainPanel);
  deactivateWindowListener();
  pack();
  centerFrame();
}

Fixed version (ground truth):
@Override public void revertToMainPanel(){
  remove(mOtherPanel);
  mMainMenuItem.setVisible(false);
  add(mMainPanel);
  deactivateWindowListener();
  pack();
  centerFrame();
}
Program: 49906
Project: 49906
Buggy source:
private JButton variantMenuButton(){
  JButton variantButton=new JButton(Messages.getString("String_Node_Str"));
  variantButton.setToolTipText(Messages.getString("String_Node_Str"));
  variantButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      setPanel(new VariantMenuPanel());
    }
  }
);
  return variantButton;
}

Fixed version (ground truth):
private JButton variantMenuButton(){
  JButton variantButton=new JButton(Messages.getString("String_Node_Str"));
  variantButton.setToolTipText(Messages.getString("String_Node_Str"));
  try {
    variantButton.setIcon(GuiUtility.createImageIcon(30,30,FileUtility.getImagePath("String_Node_Str",true)));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  variantButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      setPanel(new VariantMenuPanel());
    }
  }
);
  return variantButton;
}
Program: 49910
Project: 49910
Buggy source:
public void init(RunnableOfT<Boolean> timeElapsedCallback){
  m_displayLabel=new JLabel();
  m_displayLabel.setHorizontalAlignment(SwingConstants.CENTER);
  m_displayLabel.setOpaque(true);
  m_numberFormat=NumberFormat.getNumberInstance();
  m_numberFormat.setMinimumIntegerDigits(2);
  m_timer=new Timer(1000,this);
  m_timer.setInitialDelay(0);
  m_timeElapsedCallback=timeElapsedCallback;
}

Fixed version (ground truth):
public void init(RunnableOfT<Boolean> timeElapsedCallback){
  m_displayLabel=new JLabel();
  m_displayLabel.setHorizontalAlignment(SwingConstants.CENTER);
  m_displayLabel.setOpaque(true);
  m_numberFormat=NumberFormat.getNumberInstance();
  m_numberFormat.setMinimumIntegerDigits(2);
  m_timer=new Timer(1000,this);
  m_timer.setInitialDelay(0);
  m_timeElapsedCallback=timeElapsedCallback;
  m_isStopped=false;
}
Program: 49912
Project: 49912
Buggy source:
public static ImageIcon createImageIcon(int imageWidth,int imageHeight,String imageLocation,boolean isBuiltInFile){
  BufferedImage bufferedImage=null;
  try {
    if (isBuiltInFile)     bufferedImage=ImageIO.read(GUIUtility.class.getResource(imageLocation));
 else     bufferedImage=ImageIO.read(new File(imageLocation));
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  ImageIcon imageIcon=new ImageIcon(bufferedImage);
  imageIcon.setImage(imageIcon.getImage().getScaledInstance(imageWidth,imageHeight,Image.SCALE_SMOOTH));
  return imageIcon;
}

Fixed version (ground truth):
public static ImageIcon createImageIcon(int imageWidth,int imageHeight,String imageLocation,boolean isBuiltInFile){
  try {
    BufferedImage bufferedImage;
    if (isBuiltInFile)     bufferedImage=ImageIO.read(GUIUtility.class.getResource(imageLocation));
 else     bufferedImage=ImageIO.read(new File(imageLocation));
    ImageIcon imageIcon=new ImageIcon(bufferedImage);
    imageIcon.setImage(imageIcon.getImage().getScaledInstance(imageWidth,imageHeight,Image.SCALE_SMOOTH));
    return imageIcon;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}
Program: 49913
Project: 49913
Buggy source:
/** 
 * q Convert a List of Moves to a text file of Algebraic Chess Notation Open the file to write to, then iterate through the list of Moves, printing each one in the proper format.
 * @param moves The List of Moves to convert to ACN
 * @param pathName The path to where to save the output File
 */
public static void convert(List<Move> moves,String pathName){
  try {
    BufferedWriter out=new BufferedWriter(new FileWriter(FileUtility.getCompletedGamesFile(pathName)));
    String toWrite="String_Node_Str";
    for (int i=0, j=1; i < moves.size(); i++) {
      String turn=moves.get(i).toString();
      if (moves.get(i).result != null) {
        turn=moves.get(i) + (i % 2 == 0 ? ("String_Node_Str" + moves.get(i).result) : ("String_Node_Str" + (j + 1) + "String_Node_Str"+ moves.get(i).result));
      }
      if (i % 2 == 1 || moves.get(i).result != null) {
        out.write(j + "String_Node_Str" + toWrite+ "String_Node_Str"+ turn+ '\n');
        toWrite="String_Node_Str";
        j++;
      }
 else {
        toWrite+=turn;
      }
    }
    out.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * q Convert a List of Moves to a text file of Algebraic Chess Notation Open the file to write to, then iterate through the list of Moves, printing each one in the proper format.
 * @param moves The List of Moves to convert to ACN
 * @param pathName The path to where to save the output File
 */
public static void convert(List<Move> moves,String pathName){
  try {
    BufferedWriter out=new BufferedWriter(new FileWriter(FileUtility.getCompletedGamesFile(pathName)));
    String toWrite="String_Node_Str";
    for (int i=0, j=1; i < moves.size(); i++) {
      String turn=moves.get(i).toString();
      if (moves.get(i).result != null) {
        turn=moves.get(i) + (i % 2 == 0 ? ("String_Node_Str" + moves.get(i).result) : ("String_Node_Str" + (j + 1) + "String_Node_Str"+ moves.get(i).result));
      }
      if (i % 2 != 0 || moves.get(i).result != null) {
        out.write(j + "String_Node_Str" + toWrite+ "String_Node_Str"+ turn+ '\n');
        toWrite="String_Node_Str";
        j++;
      }
 else {
        toWrite+=turn;
      }
    }
    out.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 49918
Project: 49918
Buggy source:
@Override public void actionPerformed(ActionEvent arg0){
  if (formComplete()) {
    Board[] boards=(oneBoard.isSelected()) ? new Board[1] : new Board[2];
    for (int i=0; i < boards.length; i++) {
      boards[i]=new Board(Integer.parseInt(numRows.getText()),Integer.parseInt(numCols.getText()),wraparound.isSelected());
    }
    if (twoBoards.isSelected())     variant.drawBoard(boards,true);
 else     variant.drawBoard(boards,false);
    frame.removeAll();
    frame.dispose();
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent arg0){
  if (formComplete()) {
    Board[] boards=(oneBoard.isSelected()) ? new Board[1] : new Board[2];
    for (int i=0; i < boards.length; i++) {
      boards[i]=new Board(Integer.parseInt(numRows.getText()),Integer.parseInt(numCols.getText()),wraparound.isSelected());
    }
    if (twoBoards.isSelected())     variant.drawBoard(boards,true);
 else     variant.drawBoard(boards,false);
    holder.removeAll();
    frame.setVisible(false);
  }
}
Program: 49919
Project: 49919
Buggy source:
/** 
 * Constructor. Call initComponents to initialize the GUI.
 * @param b The builder which is creating the new game type.
 */
public BoardCustomMenu(CustomSetupMenu variant){
  frame=new JFrame();
  frame.add(this);
  frame.setVisible(true);
  frame.setSize(300,250);
  frame.setLocationRelativeTo(Driver.getInstance());
  initComponents(variant);
}

Fixed version (ground truth):
/** 
 * Constructor. Call initComponents to initialize the GUI.
 * @param b The builder which is creating the new game type.
 */
public BoardCustomMenu(CustomSetupMenu variant,JFrame optionsFrame){
  frame=optionsFrame;
  frame.setVisible(true);
  frame.add(this);
  frame.setVisible(true);
  frame.setSize(300,250);
  frame.setLocationRelativeTo(Driver.getInstance());
  initComponents(variant);
}
Program: 49921
Project: 49921
Buggy source:
@Override public void actionPerformed(ActionEvent arg0){
  if (formComplete()) {
    Board[] boards=(oneBoard.isSelected()) ? new Board[1] : new Board[2];
    for (int i=0; i < boards.length; i++) {
      boards[i]=new Board(Integer.parseInt(numRows.getText()),Integer.parseInt(numCols.getText()),wraparound.isSelected());
    }
    if (twoBoards.isSelected())     variant.drawBoard(boards,true);
 else     variant.drawBoard(boards,false);
    frame.removeAll();
    frame.dispose();
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent arg0){
  if (formComplete()) {
    Board[] boards=(oneBoard.isSelected()) ? new Board[1] : new Board[2];
    for (int i=0; i < boards.length; i++) {
      boards[i]=new Board(Integer.parseInt(numRows.getText()),Integer.parseInt(numCols.getText()),wraparound.isSelected());
    }
    if (twoBoards.isSelected())     variant.drawBoard(boards,true);
 else     variant.drawBoard(boards,false);
    holder.removeAll();
    frame.setVisible(false);
  }
}
Program: 49922
Project: 49922
Buggy source:
/** 
 * Constructor. Call initComponents to initialize the GUI.
 * @param b The builder which is creating the new game type.
 */
public BoardCustomMenu(CustomSetupMenu variant){
  frame=new JFrame();
  frame.add(this);
  frame.setVisible(true);
  frame.setSize(300,250);
  frame.setLocationRelativeTo(Driver.getInstance());
  initComponents(variant);
}

Fixed version (ground truth):
/** 
 * Constructor. Call initComponents to initialize the GUI.
 * @param b The builder which is creating the new game type.
 */
public BoardCustomMenu(CustomSetupMenu variant,JFrame optionsFrame){
  frame=optionsFrame;
  frame.setVisible(true);
  frame.add(this);
  frame.setVisible(true);
  frame.setSize(300,250);
  frame.setLocationRelativeTo(Driver.getInstance());
  initComponents(variant);
}
Program: 49926
Project: 49926
Buggy source:
@Override public void mousePressed(MouseEvent e){
}

Fixed version (ground truth):
@Override public void mousePressed(MouseEvent e){
  if (mustPlace) {
    mustPlace=false;
    getGame().nextTurn();
    if (!clickedSquare.isOccupied() && clickedSquare.isHabitable() && placePiece != null) {
      placePiece.setSquare(clickedSquare);
      clickedSquare.setPiece(placePiece);
      placePiece=null;
      mustPlace=false;
      boardRefresh(getGame().getBoards());
      getGame().genLegalDests();
    }
    return;
  }
  if (mustMove && clickedSquare == storedSquare) {
    boardRefresh(getGame().getBoards());
    mustMove=false;
  }
 else   if (mustMove && clickedSquare.getColor() == Square.HIGHLIGHT_COLOR) {
    try {
      getGame().playMove(new Move(b,storedSquare,clickedSquare));
      mustMove=false;
      boardRefresh(getGame().getBoards());
    }
 catch (    Exception e1) {
      System.out.println(e1.getMessage());
      e1.printStackTrace();
    }
  }
 else   if (!mustMove && clickedSquare.getPiece() != null && clickedSquare.getPiece().isBlack() == getGame().isBlackMove()) {
    List<Square> dests=clickedSquare.getPiece().getLegalDests();
    if (dests.size() > 0) {
      for (      Square dest : dests) {
        dest.setBackgroundColor(Square.HIGHLIGHT_COLOR);
      }
      storedSquare=clickedSquare;
      mustMove=true;
    }
  }
}
Program: 49927
Project: 49927
Buggy source:
/** 
 * Control movement of pieces. Check if the Square is occupied and either highlight possible destinations or move the piece.
 */
@Override public void mouseClicked(MouseEvent e){
  if (mustPlace) {
    mustPlace=false;
    getGame().nextTurn();
    if (!clickedSquare.isOccupied() && clickedSquare.isHabitable() && placePiece != null) {
      placePiece.setSquare(clickedSquare);
      clickedSquare.setPiece(placePiece);
      placePiece=null;
      mustPlace=false;
      boardRefresh(getGame().getBoards());
      getGame().genLegalDests();
    }
    return;
  }
  if (mustMove && clickedSquare == storedSquare) {
    boardRefresh(getGame().getBoards());
    mustMove=false;
  }
 else   if (mustMove && clickedSquare.getColor() == Square.HIGHLIGHT_COLOR) {
    try {
      getGame().playMove(new Move(b,storedSquare,clickedSquare));
      mustMove=false;
      boardRefresh(getGame().getBoards());
    }
 catch (    Exception e1) {
      System.out.println(e1.getMessage());
      e1.printStackTrace();
    }
  }
 else   if (!mustMove && clickedSquare.getPiece() != null && clickedSquare.getPiece().isBlack() == getGame().isBlackMove()) {
    List<Square> dests=clickedSquare.getPiece().getLegalDests();
    if (dests.size() > 0) {
      for (      Square dest : dests) {
        dest.setBackgroundColor(Square.HIGHLIGHT_COLOR);
      }
      storedSquare=clickedSquare;
      mustMove=true;
    }
  }
}

Fixed version (ground truth):
/** 
 * Control movement of pieces. Check if the Square is occupied and either highlight possible destinations or move the piece.
 */
@Override public void mouseClicked(MouseEvent e){
}
Program: 49936
Project: 49936
Buggy source:
public void newGame(){
  variantHelp.setVisible(false);
  helpMenu.setText("String_Node_Str");
  gamePlayHelp.setVisible(true);
  if (PlayGame.menu != null)   PlayGame.menu.setVisible(false);
  if (otherPanel != null)   remove(otherPanel);
  if (mainPanel != null)   remove(mainPanel);
  otherPanel=new NewGameMenu();
  add(otherPanel);
  ChessTimer.stopTimers();
  gamePlayHelp.setVisible(true);
  pack();
}

Fixed version (ground truth):
/** 
 * Sets up a new game and clears out any old game being played
 */
public void newGame(){
  variantHelp.setVisible(false);
  helpMenu.setText("String_Node_Str");
  gamePlayHelp.setVisible(true);
  if (PlayGame.menu != null)   PlayGame.menu.setVisible(false);
  if (otherPanel != null)   remove(otherPanel);
  if (mainPanel != null)   remove(mainPanel);
  otherPanel=new NewGameMenu();
  add(otherPanel);
  ChessTimer.stopTimers();
  gamePlayHelp.setVisible(true);
  pack();
}
Program: 49938
Project: 49938
Buggy source:
/** 
 * @param r Reference to which button the user clicked for the end game. "Save" "New Game" or "Quit"
 */
public static void endOfGame(Result r){
  PlayNetGame.running=false;
  if (g.getHistory().size() != 0)   PlayNetGame.netMove=g.moveToFakeMove(g.getHistory().get(g.getHistory().size() - 1));
 else {
    JOptionPane.showMessageDialog(null,"String_Node_Str");
    PlayNetGame.running=false;
    Driver.getInstance().revertPanel();
    Driver.getInstance().gamePlayHelp.setVisible(false);
    Driver.getInstance().helpMenu.setText("String_Node_Str");
    Driver.getInstance().fileMenu.setVisible(true);
    return;
  }
  if (isPlayback)   return;
  Object[] options=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
  menu.setVisible(false);
  int answer=JOptionPane.showOptionDialog(null,r.text(),r.winText(),JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE,null,options,options[0]);
switch (answer) {
case 0:
    String fileName=JOptionPane.showInputDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE);
  getGame().saveGame("String_Node_Str",fileName,getGame().isClassicChess());
g.setBlackMove(false);
Driver.getInstance().gamePlayHelp.setVisible(false);
Driver.getInstance().helpMenu.setText("String_Node_Str");
Driver.getInstance().fileMenu.setVisible(true);
Driver.getInstance().revertPanel();
break;
case 2:
g.setBlackMove(false);
System.exit(0);
break;
default :
g.setBlackMove(false);
Driver.getInstance().newGame();
}
}

Fixed version (ground truth):
/** 
 * @param r Reference to which button the user clicked for the end game. "Save" "New Game" or "Quit"
 */
public static void endOfGame(Result r){
  PlayNetGame.running=false;
  if (g.getHistory().size() != 0)   PlayNetGame.netMove=g.moveToFakeMove(g.getHistory().get(g.getHistory().size() - 1));
 else   if (!r.isDraw()) {
    JOptionPane.showMessageDialog(null,"String_Node_Str");
    PlayNetGame.running=false;
    Driver.getInstance().revertPanel();
    Driver.getInstance().gamePlayHelp.setVisible(false);
    Driver.getInstance().helpMenu.setText("String_Node_Str");
    Driver.getInstance().fileMenu.setVisible(true);
    return;
  }
  if (isPlayback)   return;
  Object[] options=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
  menu.setVisible(false);
  int answer=JOptionPane.showOptionDialog(null,r.text(),r.winText(),JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE,null,options,options[0]);
switch (answer) {
case 0:
    String fileName=JOptionPane.showInputDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE);
  getGame().saveGame("String_Node_Str",fileName,getGame().isClassicChess());
g.setBlackMove(false);
Driver.getInstance().gamePlayHelp.setVisible(false);
Driver.getInstance().helpMenu.setText("String_Node_Str");
Driver.getInstance().fileMenu.setVisible(true);
Driver.getInstance().revertPanel();
break;
case 2:
g.setBlackMove(false);
System.exit(0);
break;
default :
g.setBlackMove(false);
Driver.getInstance().newGame();
}
}
Program: 49939
Project: 49939
Buggy source:
/** 
 * Setter method for boolean indicating if the current game is an AIGame.
 * @param AIGame If this game is an AIGame
 */
public void setAIGame(boolean AIGame){
  this.AIGame=AIGame;
  Driver.getInstance().fileMenu.setVisible(true);
}

Fixed version (ground truth):
/** 
 * Setter method for boolean indicating if the current game is an AIGame.
 * @param AIGame If this game is an AIGame
 */
public void setAIGame(boolean AIGame){
  this.AIGame=AIGame;
  Driver.getInstance().fileMenu.setVisible(true);
  drawItem.setText("String_Node_Str");
}
Program: 49942
Project: 49942
Buggy source:
public FakeMove getMove(AIBoard[] boards);

Fixed version (ground truth):
public abstract FakeMove getMove(AIBoard[] boards);
Program: 49944
Project: 49944
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  if (getGame().isBlackMove() == isBlack) {
    int surrender=requestDraw();
    if (surrender != 0)     return;
    netMove=new FakeMove(-1,-1,-1,-1,-1,null);
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  if (getGame().isBlackMove() == isBlack) {
    if (AIGame) {
      int surrender=requestAIDraw();
      if (surrender != 0)       return;
      Result result=new Result(Result.DRAW);
      result.setText("String_Node_Str");
      PlayGame.endOfGame(result);
    }
 else {
      int surrender=requestDraw();
      if (surrender != 0)       return;
      netMove=new FakeMove(-1,-1,-1,-1,-1,null);
    }
  }
}
Program: 49945
Project: 49945
Buggy source:
public JMenu createMenu(){
  menu=new JMenu("String_Node_Str");
  if (!isPlayback) {
    drawItem=new JMenuItem("String_Node_Str",KeyEvent.VK_R);
    drawItem.addActionListener(new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        if (getGame().isBlackMove() == isBlack) {
          int surrender=requestDraw();
          if (surrender != 0)           return;
          netMove=new FakeMove(-1,-1,-1,-1,-1,null);
        }
      }
    }
);
    menu.add(drawItem);
  }
  return menu;
}

Fixed version (ground truth):
public JMenu createMenu(){
  menu=new JMenu("String_Node_Str");
  if (!isPlayback) {
    drawItem=new JMenuItem("String_Node_Str",KeyEvent.VK_R);
    drawItem.addActionListener(new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        if (getGame().isBlackMove() == isBlack) {
          if (AIGame) {
            int surrender=requestAIDraw();
            if (surrender != 0)             return;
            Result result=new Result(Result.DRAW);
            result.setText("String_Node_Str");
            PlayGame.endOfGame(result);
          }
 else {
            int surrender=requestDraw();
            if (surrender != 0)             return;
            netMove=new FakeMove(-1,-1,-1,-1,-1,null);
          }
        }
      }
    }
);
    menu.add(drawItem);
  }
  return menu;
}