nus-yam/ex-repair huggingface dataset:
Program: 49948
Project: 49948
Buggy source:
/** 
 * Updates the display in response to the time passing.
 */
protected void updateDisplay(){
  long now=System.currentTimeMillis();
  long elapsed=now - lastUpdated;
  if (!delay) {
    time-=elapsed * direction;
  }
 else {
    delay=false;
  }
  lastUpdated=now;
  int minutes=(int)(time / 60000);
  int seconds=(int)((time % 60000) / 1000);
  label.setText(nf.format(minutes) + "String_Node_Str" + nf.format(seconds));
  if (time <= 0) {
    time=Math.abs(time);
    timeElapsed();
  }
}

Fixed version (ground truth):
/** 
 * Updates the display in response to the time passing.
 */
protected void updateDisplay(){
  if (stopTimers) {
    timer.stop();
    return;
  }
  long now=System.currentTimeMillis();
  long elapsed=now - lastUpdated;
  if (!delay) {
    time-=elapsed * direction;
  }
 else {
    delay=false;
  }
  lastUpdated=now;
  int minutes=(int)(time / 60000);
  int seconds=(int)((time % 60000) / 1000);
  label.setText(nf.format(minutes) + "String_Node_Str" + nf.format(seconds));
  if (time <= 0) {
    time=Math.abs(time);
    timeElapsed();
  }
}
Program: 49950
Project: 49950
Buggy source:
public boolean canAttack(int destRow,int destCol,char direction){
switch (direction) {
case 'S':
    return (destRow - curSquare.getRow()) < movements.get('S') || movements.get('S') == -1;
case 'N':
  return (curSquare.getRow() - destRow) < movements.get('N') || movements.get('N') == -1;
case 'E':
return (destCol - curSquare.getCol()) < movements.get('E') || movements.get('E') == -1;
case 'W':
return (curSquare.getCol() - destCol) < movements.get('W') || movements.get('W') == -1;
default :
return false;
}
}

Fixed version (ground truth):
public boolean canAttack(int destRow,int destCol,char direction){
switch (direction) {
case 'S':
    if (movements.containsKey('S'))     return (destRow - curSquare.getRow()) < movements.get('S') || movements.get('S') == -1;
case 'N':
  if (movements.containsKey('N'))   return (curSquare.getRow() - destRow) < movements.get('N') || movements.get('N') == -1;
case 'E':
if (movements.containsKey('E')) return (destCol - curSquare.getCol()) < movements.get('E') || movements.get('E') == -1;
case 'W':
if (movements.containsKey('W')) return (curSquare.getCol() - destCol) < movements.get('W') || movements.get('W') == -1;
case 'R':
if (movements.containsKey('R')) return (curSquare.getCol() - destCol) < movements.get('R') || movements.get('R') == -1;
case 'r':
if (movements.containsKey('r')) return (curSquare.getCol() - destCol) < movements.get('r') || movements.get('r') == -1;
case 'L':
if (movements.containsKey('L')) return (destCol - curSquare.getCol()) < movements.get('L') || movements.get('L') == -1;
case 'l':
if (movements.containsKey('l')) return (destCol - curSquare.getCol()) < movements.get('l') || movements.get('l') == -1;
default :
return false;
}
}
Program: 49954
Project: 49954
Buggy source:
/** 
 * Build the classic game of chess for the user.
 */
private static void buildClassic(){
  Builder classic=new Builder("String_Node_Str");
  classic.setBoards(new Board[]{new Board(8,8,false)});
  Board b=classic.boards[0];
  for (int i=1; i < 9; i++) {
    classic.whiteTeam.add(createPawn(false,b.getSquare(2,i),b));
    classic.blackTeam.add(createPawn(true,b.getSquare(7,i),b));
  }
  classic.whiteTeam.add(createRook(false,b.getSquare(1,1),b));
  classic.whiteTeam.add(createKnight(false,b.getSquare(1,2),b));
  classic.whiteTeam.add(createBishop(false,b.getSquare(1,3),b));
  classic.whiteTeam.add(createQueen(false,b.getSquare(1,4),b));
  classic.whiteTeam.add(createKing(false,b.getSquare(1,5),b));
  classic.whiteTeam.add(createBishop(false,b.getSquare(1,6),b));
  classic.whiteTeam.add(createKnight(false,b.getSquare(1,7),b));
  classic.whiteTeam.add(createRook(false,b.getSquare(1,8),b));
  classic.blackTeam.add(createRook(true,b.getSquare(8,1),b));
  classic.blackTeam.add(createKnight(true,b.getSquare(8,2),b));
  classic.blackTeam.add(createBishop(true,b.getSquare(8,3),b));
  classic.blackTeam.add(createQueen(true,b.getSquare(8,4),b));
  classic.blackTeam.add(createKing(true,b.getSquare(8,5),b));
  classic.blackTeam.add(createBishop(true,b.getSquare(8,6),b));
  classic.blackTeam.add(createKnight(true,b.getSquare(8,7),b));
  classic.blackTeam.add(createRook(true,b.getSquare(8,8),b));
  classic.writeFile(new Rules(true),new Rules(true));
}

Fixed version (ground truth):
/** 
 * Build the classic game of chess for the user.
 */
private static void buildClassic(){
  Builder classic=new Builder("String_Node_Str");
  classic.setBoards(new Board[]{new Board(8,8,false)});
  Board b=classic.boards[0];
  for (int i=1; i < 9; i++) {
    classic.whiteTeam.add(createPawn(false,b.getSquare(2,i),b));
    classic.blackTeam.add(createPawn(true,b.getSquare(7,i),b));
  }
  classic.whiteTeam.add(createRook(false,b.getSquare(1,1),b));
  classic.whiteTeam.add(createKnight(false,b.getSquare(1,2),b));
  classic.whiteTeam.add(createBishop(false,b.getSquare(1,3),b));
  classic.whiteTeam.add(createQueen(false,b.getSquare(1,4),b));
  classic.whiteTeam.add(createKing(false,b.getSquare(1,5),b));
  classic.whiteTeam.add(createBishop(false,b.getSquare(1,6),b));
  classic.whiteTeam.add(createKnight(false,b.getSquare(1,7),b));
  classic.whiteTeam.add(createRook(false,b.getSquare(1,8),b));
  classic.blackTeam.add(createRook(true,b.getSquare(8,1),b));
  classic.blackTeam.add(createKnight(true,b.getSquare(8,2),b));
  classic.blackTeam.add(createBishop(true,b.getSquare(8,3),b));
  classic.blackTeam.add(createQueen(true,b.getSquare(8,4),b));
  classic.blackTeam.add(createKing(true,b.getSquare(8,5),b));
  classic.blackTeam.add(createBishop(true,b.getSquare(8,6),b));
  classic.blackTeam.add(createKnight(true,b.getSquare(8,7),b));
  classic.blackTeam.add(createRook(true,b.getSquare(8,8),b));
  classic.writeFile(new Rules(true,false),new Rules(true,true));
}
Program: 49955
Project: 49955
Buggy source:
/** 
 * Create a new EndOfGame object
 * @param name The name of the method
 * @param blackLosesPieces Set the instance variable
 * @param maxChecks Set the instance variable
 * @param type Set the instance variable.
 */
public EndOfGame(String name,boolean blackLosesPieces,int maxChecks,String type){
  doMethod=doMethods.get(name);
  undoMethod=undoMethods.get(name);
  this.name=name;
  this.blackLosesPieces=blackLosesPieces;
  this.maxChecks=maxChecks;
  this.type=type;
  checks=0;
}

Fixed version (ground truth):
/** 
 * Create a new EndOfGame object
 * @param name The name of the method
 * @param blackLosesPieces Set the instance variable
 * @param maxChecks Set the instance variable
 * @param type Set the instance variable.
 */
public EndOfGame(String name,boolean blackLosesPieces,int maxChecks,String type,boolean isBlack){
  doMethod=doMethods.get(name);
  undoMethod=undoMethods.get(name);
  this.name=name;
  this.blackLosesPieces=blackLosesPieces;
  this.maxChecks=maxChecks;
  this.type=type;
  this.isBlack=isBlack;
  checks=0;
}
Program: 49956
Project: 49956
Buggy source:
/** 
 * Capture all of a specified type to win.
 * @param objectivePiece Unused.
 */
public void captureAllOfType(Piece objectivePiece){
  List<Piece> team=(g.isBlackMove() ? g.getBlackTeam() : g.getWhiteTeam());
  for (  Piece p : team) {
    if (p.getName().equals(type) && !p.isCaptured())     return;
  }
  Result r=new Result(!g.isBlackMove() ? Result.BLACK_WIN : Result.WHITE_WIN);
  r.setText("String_Node_Str" + r.winText() + "String_Node_Str");
  PlayGame.endOfGame(r);
}

Fixed version (ground truth):
/** 
 * Capture all of a specified type to win.
 * @param objectivePiece Unused.
 */
public void captureAllOfType(Piece objectivePiece){
  List<Piece> team=(!isBlack ? g.getBlackTeam() : g.getWhiteTeam());
  for (  Piece p : team) {
    if (p.getName().equals(type) && !p.isCaptured()) {
      return;
    }
  }
  Result r=new Result(isBlack ? Result.BLACK_WIN : Result.WHITE_WIN);
  r.setText("String_Node_Str" + r.winText() + "String_Node_Str");
  PlayGame.endOfGame(r);
}
Program: 49957
Project: 49957
Buggy source:
/** 
 * In this case, the goal is either to lose all pieces or capture all the opponent's pieces based on the  instance variable blackLosesPieces.
 * @param objectivePiece The objective piece; unused.
 */
public void loseAllPieces(Piece objectivePiece){
  List<Piece> team=(blackLosesPieces ? g.getBlackTeam() : g.getWhiteTeam());
  for (  Piece p : team) {
    if (!p.isCaptured())     return;
  }
  Result r=new Result(blackLosesPieces ? Result.BLACK_WIN : Result.WHITE_WIN);
  r.setText("String_Node_Str" + r.winText() + "String_Node_Str");
  PlayGame.endOfGame(r);
}

Fixed version (ground truth):
/** 
 * In this case, the goal is either to lose all pieces or capture all the opponent's pieces based on the  instance variable blackLosesPieces.
 * @param objectivePiece The objective piece; unused.
 */
public void loseAllPieces(Piece objectivePiece){
  List<Piece> team=(isBlack ? g.getBlackTeam() : g.getWhiteTeam());
  for (  Piece p : team) {
    if (!p.isCaptured())     return;
  }
  Result r=new Result(blackLosesPieces ? Result.BLACK_WIN : Result.WHITE_WIN);
  r.setText("String_Node_Str" + r.winText() + "String_Node_Str");
  PlayGame.endOfGame(r);
}
Program: 49958
Project: 49958
Buggy source:
/** 
 * @param isClassic Whether the game is classic chess.
 */
public Rules(boolean isClassic){
  nextTurn=new NextTurn("String_Node_Str",1,1,0);
  endOfGame=new EndOfGame("String_Node_Str",false,3,"String_Node_Str");
  cropLegalDests=new CropLegalDests();
  cropLegalDests.addMethod("String_Node_Str");
  objectivePiece=new ObjectivePiece("String_Node_Str","String_Node_Str");
  afterMove=new AfterMove();
  afterMove.addMethod("String_Node_Str");
  getBoard=new GetBoard("String_Node_Str");
  promote=new Promote("String_Node_Str");
  getPromotionSquares=new GetPromotionSquares("String_Node_Str");
  adjustTeamDests=new AdjustTeamDests("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param isClassic Whether the game is classic chess.
 */
public Rules(boolean isClassic,boolean isBlack){
  nextTurn=new NextTurn("String_Node_Str",1,1,0);
  endOfGame=new EndOfGame("String_Node_Str",false,3,"String_Node_Str",isBlack);
  cropLegalDests=new CropLegalDests();
  cropLegalDests.addMethod("String_Node_Str");
  objectivePiece=new ObjectivePiece("String_Node_Str","String_Node_Str");
  afterMove=new AfterMove();
  afterMove.addMethod("String_Node_Str");
  getBoard=new GetBoard("String_Node_Str");
  promote=new Promote("String_Node_Str");
  getPromotionSquares=new GetPromotionSquares("String_Node_Str");
  adjustTeamDests=new AdjustTeamDests("String_Node_Str");
}
Program: 49959
Project: 49959
Buggy source:
public void runGame(AIPlugin ai){
  PlayNetGame.running=true;
  while (PlayNetGame.running) {
    while (g.isBlackMove()) {
      try {
        Thread.sleep(200);
      }
 catch (      InterruptedException e) {
      }
      AIBoard[] boards=getBoards();
      FakeMove fm=ai.getMove(boards);
    }
    try {
      Thread.sleep(0);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public void runGame(AIPlugin ai){
  PlayNetGame.running=true;
  while (PlayNetGame.running) {
    while (g.isBlackMove()) {
      try {
        Thread.sleep(200);
      }
 catch (      InterruptedException e) {
      }
      AIBoard[] boards=getBoards();
      FakeMove fm=ai.getMove(boards);
      playMove(fm);
    }
    try {
      Thread.sleep(0);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}
Program: 49960
Project: 49960
Buggy source:
/** 
 * In this case, only pawns can promote, allow the user to pick which class it promotes to.
 * @param p The piece to promote
 * @param verified Whether it has been verified that thisis ok
 * @param promo What the piece was promoted to.
 * @return The promoted Piece.
 */
public Piece classicPromotion(Piece p,boolean verified,String promo){
  lastPromoted=p.getName();
  klazz=p.getName();
  if (p.getPromotesTo() == null)   return p;
  if (!verified && promo == null && g.isBlackMove() == p.isBlack()) {
    klazz="String_Node_Str";
    if (p.getPromotesTo().size() == 1)     klazz=p.getPromotesTo().get(0);
    while (klazz.equals("String_Node_Str")) {
      String result=(String)JOptionPane.showInputDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE,null,p.getPromotesTo().toArray(),null);
      if (result == null) {
        continue;
      }
      try {
        klazz=result;
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
 else   if (promo != null) {
    klazz=promo;
  }
  try {
    Piece promoted=PieceBuilder.makePiece(klazz,p.isBlack(),p.getSquare(),p.getBoard());
    if (promoted.isBlack()) {
      g.getBlackTeam().set(g.getBlackTeam().indexOf(p),promoted);
    }
 else {
      g.getWhiteTeam().set(g.getWhiteTeam().indexOf(p),promoted);
    }
    promoted.getLegalDests().clear();
    promoted.setMoveCount(p.getMoveCount());
    return promoted;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * In this case, only pawns can promote, allow the user to pick which class it promotes to.
 * @param p The piece to promote
 * @param verified Whether it has been verified that thisis ok
 * @param promo What the piece was promoted to.
 * @return The promoted Piece.
 */
public Piece classicPromotion(Piece p,boolean verified,String promo){
  lastPromoted=p.getName();
  klazz=p.getName();
  if (p.getPromotesTo() == null || p.getPromotesTo().size() == 0)   return p;
  if (!verified && promo == null && g.isBlackMove() == p.isBlack()) {
    klazz="String_Node_Str";
    if (p.getPromotesTo().size() == 1)     klazz=p.getPromotesTo().get(0);
    while (klazz.equals("String_Node_Str")) {
      String result=(String)JOptionPane.showInputDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE,null,p.getPromotesTo().toArray(),null);
      if (result == null) {
        continue;
      }
      try {
        klazz=result;
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
 else   if (promo != null) {
    klazz=promo;
  }
  try {
    Piece promoted=PieceBuilder.makePiece(klazz,p.isBlack(),p.getSquare(),p.getBoard());
    if (promoted.isBlack()) {
      g.getBlackTeam().set(g.getBlackTeam().indexOf(p),promoted);
    }
 else {
      g.getWhiteTeam().set(g.getWhiteTeam().indexOf(p),promoted);
    }
    promoted.getLegalDests().clear();
    promoted.setMoveCount(p.getMoveCount());
    return promoted;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}
Program: 49967
Project: 49967
Buggy source:
/** 
 * This is undone by decrementing the number of moves made, and if necessary, decrementing the amount of moves possible each round. Then the turn is changed, if appropriate.
 * @return Whose turn it is.
 */
public boolean undoIncreasingTurnsTogether(){
  if (--currentNumMoves < 0) {
    isBlackMove=!isBlackMove;
    PlayGame.turn(isBlackMove);
    whiteMoves-=increment;
    currentNumMoves=whiteMoves;
  }
  return isBlackMove;
}

Fixed version (ground truth):
/** 
 * This is undone by decrementing the number of moves made, and if necessary, decrementing the amount of moves possible each round. Then the turn is changed, if appropriate.
 * @return Whose turn it is.
 */
public boolean undoIncreasingTurnsTogether(){
  if (--currentNumMoves < 0) {
    isBlackMove=!isBlackMove;
    PlayGame.turn(isBlackMove);
    whiteMoves-=increment;
    currentNumMoves=whiteMoves - 1;
  }
  return isBlackMove;
}
Program: 49968
Project: 49968
Buggy source:
/** 
 * @param p The piece to unpromote
 * @return The unpromoted piece.
 */
public Piece undo(Piece p){
  try {
    if (undoMethod == null) {
      undoMethod=undoMethods.get(name);
    }
    return (Piece)undoMethod.invoke(this,p);
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}

Fixed version (ground truth):
/** 
 * @param p The piece to unpromote
 * @return The unpromoted piece.
 */
public Piece undo(Piece p){
  try {
    if (lastPromoted == null)     lastPromoted=resetLastPromoted;
    if (undoMethod == null) {
      undoMethod=undoMethods.get(name);
    }
    Piece toReturn=(Piece)undoMethod.invoke(this,p);
    resetLastPromoted=lastPromoted;
    return toReturn;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}
Program: 49969
Project: 49969
Buggy source:
/** 
 * @param p The piece to promote
 * @param verified Whether the piece can be promoted
 * @param promo What to promote from.
 * @return The promoted Piece.
 */
public Piece execute(Piece p,boolean verified,String promo){
  try {
    if (doMethod == null) {
      doMethod=doMethods.get(name);
    }
    return (Piece)doMethod.invoke(this,p,verified,promo);
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}

Fixed version (ground truth):
/** 
 * @param p The piece to promote
 * @param verified Whether the piece can be promoted
 * @param promo What to promote from.
 * @return The promoted Piece.
 */
public Piece execute(Piece p,boolean verified,String promo){
  if (lastPromoted == null)   lastPromoted=resetLastPromoted;
  try {
    if (doMethod == null) {
      doMethod=doMethods.get(name);
    }
    Piece toReturn=(Piece)doMethod.invoke(this,p,verified,promo);
    resetLastPromoted=lastPromoted;
    return toReturn;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}
Program: 49970
Project: 49970
Buggy source:
public void join(String host) throws Exception {
  Socket socket=null;
  ObjectOutputStream out=null;
  ObjectInputStream in=null;
  boolean playing=true;
  while (socket == null) {
    try {
      socket=new Socket(host,27335);
    }
 catch (    Exception e) {
      if (NewGameMenu.cancelled)       return;
    }
  }
  out=new ObjectOutputStream(socket.getOutputStream());
  in=new ObjectInputStream(socket.getInputStream());
  Object fromServer=null;
  Object fromUser;
  Game g=(Game)in.readObject();
  PlayNetGame png=new PlayNetGame(g,false,true);
  Driver.getInstance().setPanel(png);
  try {
    while (playing) {
      while (g.isBlackMove() == false) {
        fromServer=in.readObject();
        NetMove toMove=(NetMove)fromServer;
        g.playMove(g.fakeToRealMove((NetMove)fromServer));
        if (g.getLastMove().getResult() != null)         break;
      }
      while (g.isBlackMove() == true) {
        while (png.netMove == null)         Thread.sleep(0);
        fromUser=png.netMove;
        png.netMove=null;
        out.writeObject(fromUser);
        System.out.println("String_Node_Str" + fromUser.toString());
        out.flush();
        if (g.getLastMove().getResult() != null)         break;
      }
    }
  }
 catch (  Exception e) {
    out.close();
    in.close();
    socket.close();
  }
  out.close();
  in.close();
  socket.close();
}

Fixed version (ground truth):
public void join(String host) throws Exception {
  Socket socket=null;
  ObjectOutputStream out=null;
  ObjectInputStream in=null;
  boolean playing=true;
  while (socket == null) {
    try {
      socket=new Socket(host,27335);
    }
 catch (    Exception e) {
      if (NewGameMenu.cancelled)       return;
    }
  }
  out=new ObjectOutputStream(socket.getOutputStream());
  in=new ObjectInputStream(socket.getInputStream());
  Object fromServer=null;
  Object fromUser;
  Game g=(Game)in.readObject();
  PlayNetGame png=new PlayNetGame(g,false,true);
  PlayGame.resetTimers();
  Driver.getInstance().setPanel(png);
  try {
    while (playing) {
      while (g.isBlackMove() == false) {
        fromServer=in.readObject();
        NetMove toMove=(NetMove)fromServer;
        g.playMove(g.fakeToRealMove((NetMove)fromServer));
        if (g.getLastMove().getResult() != null)         break;
      }
      while (g.isBlackMove() == true) {
        while (png.netMove == null)         Thread.sleep(0);
        fromUser=png.netMove;
        png.netMove=null;
        out.writeObject(fromUser);
        System.out.println("String_Node_Str" + fromUser.toString());
        out.flush();
        if (g.getLastMove().getResult() != null)         break;
      }
    }
  }
 catch (  Exception e) {
    out.close();
    in.close();
    socket.close();
  }
  out.close();
  in.close();
  socket.close();
}
Program: 49972
Project: 49972
Buggy source:
@Override public void valueChanged(ListSelectionEvent e){
  ListSelectionModel lsm=(ListSelectionModel)e.getSource();
  int selection=lsm.getAnchorSelectionIndex();
  if (!lsm.getValueIsAdjusting()) {
    if (((String)list.elementAt(selection)).equals("String_Node_Str")) {
      bShowPiece.getSquare(1,1).setPiece(null);
      bShowPiece.getSquare(1,1).setBackgroundColor(original);
      bShowPiece.getSquare(1,1).setHabitable(true);
      bShowPiece.getSquare(1,1).refresh();
      jb1.setVisible(true);
      jb2.setVisible(false);
    }
 else     if (((String)list.elementAt(selection)).equals("String_Node_Str")) {
      bShowPiece.getSquare(1,1).refresh();
      jb2.setVisible(false);
      jb1.setVisible(false);
    }
 else {
      jb2.setVisible(true);
      jb1.setVisible(true);
      if (bShowPiece.getSquare(1,1).isHabitable() == false)       bShowPiece.getSquare(1,1).setHabitable(true);
      if (bShowPiece.getSquare(1,1).getColor().equals(original) == false)       bShowPiece.getSquare(1,1).setBackgroundColor(original);
      Piece toAdd=PieceBuilder.makePiece((String)list.elementAt(selection),false,bShowPiece.getSquare(1,1),bShowPiece);
      Piece toAdd1=PieceBuilder.makePiece((String)list.elementAt(selection),true,bShowPiece.getSquare(1,1),bShowPiece);
      bShowPiece.getSquare(1,1).setPiece(toAdd);
      bShowPiece.getSquare(2,1).setPiece(toAdd1);
      bShowPiece.getSquare(1,1).refresh();
      bShowPiece.getSquare(2,1).refresh();
    }
  }
}

Fixed version (ground truth):
@Override public void valueChanged(ListSelectionEvent e){
  ListSelectionModel lsm=(ListSelectionModel)e.getSource();
  int selection=lsm.getAnchorSelectionIndex();
  if (!lsm.getValueIsAdjusting()) {
    if (((String)list.elementAt(selection)).equals("String_Node_Str")) {
      bShowPiece.getSquare(1,1).setPiece(null);
      bShowPiece.getSquare(1,1).setBackgroundColor(original);
      bShowPiece.getSquare(1,1).setHabitable(true);
      bShowPiece.getSquare(1,1).refresh();
      jb1.setVisible(true);
      jb2.setVisible(false);
    }
 else {
      jb2.setVisible(true);
      jb1.setVisible(true);
      if (bShowPiece.getSquare(1,1).isHabitable() == false)       bShowPiece.getSquare(1,1).setHabitable(true);
      if (bShowPiece.getSquare(1,1).getColor().equals(original) == false)       bShowPiece.getSquare(1,1).setBackgroundColor(original);
      Piece toAdd=PieceBuilder.makePiece((String)list.elementAt(selection),false,bShowPiece.getSquare(1,1),bShowPiece);
      Piece toAdd1=PieceBuilder.makePiece((String)list.elementAt(selection),true,bShowPiece.getSquare(1,1),bShowPiece);
      bShowPiece.getSquare(1,1).setPiece(toAdd);
      bShowPiece.getSquare(2,1).setPiece(toAdd1);
      bShowPiece.getSquare(1,1).refresh();
      bShowPiece.getSquare(2,1).refresh();
    }
  }
}
Program: 49976
Project: 49976
Buggy source:
/** 
 * In this case, only pawns can promote, allow the user to pick which class it promotes to.
 * @param p The piece to promote
 * @param verified Whether it has been verified that thisis ok
 * @param promo What the piece was promoted to.
 * @return The promoted Piece.
 */
public Piece classicPromotion(Piece p,boolean verified,String promo){
  lastPromoted=p.getName();
  if (!verified && promo == null && g.isBlackMove() == p.isBlack()) {
    klazz="String_Node_Str";
    if (p.getPromotesTo().size() == 1)     klazz=p.getPromotesTo().get(0);
    while (klazz.equals("String_Node_Str")) {
      String result=(String)JOptionPane.showInputDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE,null,p.getPromotesTo().toArray(),null);
      if (result == null) {
        continue;
      }
      try {
        klazz=result;
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
 else   if (promo != null) {
    klazz=promo;
  }
  try {
    Piece promoted=PieceBuilder.makePiece(klazz,p.isBlack(),p.getSquare(),p.getBoard());
    if (promoted.isBlack()) {
      g.getBlackTeam().set(g.getBlackTeam().indexOf(p),promoted);
    }
 else {
      g.getWhiteTeam().set(g.getWhiteTeam().indexOf(p),promoted);
    }
    promoted.getLegalDests().clear();
    promoted.setMoveCount(p.getMoveCount());
    return promoted;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * In this case, only pawns can promote, allow the user to pick which class it promotes to.
 * @param p The piece to promote
 * @param verified Whether it has been verified that thisis ok
 * @param promo What the piece was promoted to.
 * @return The promoted Piece.
 */
public Piece classicPromotion(Piece p,boolean verified,String promo){
  lastPromoted=p.getName();
  klazz=p.getName();
  if (p.getPromotesTo() == null)   return p;
  if (!verified && promo == null && g.isBlackMove() == p.isBlack()) {
    klazz="String_Node_Str";
    if (p.getPromotesTo().size() == 1)     klazz=p.getPromotesTo().get(0);
    while (klazz.equals("String_Node_Str")) {
      String result=(String)JOptionPane.showInputDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE,null,p.getPromotesTo().toArray(),null);
      if (result == null) {
        continue;
      }
      try {
        klazz=result;
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
 else   if (promo != null) {
    klazz=promo;
  }
  try {
    Piece promoted=PieceBuilder.makePiece(klazz,p.isBlack(),p.getSquare(),p.getBoard());
    if (promoted.isBlack()) {
      g.getBlackTeam().set(g.getBlackTeam().indexOf(p),promoted);
    }
 else {
      g.getWhiteTeam().set(g.getWhiteTeam().indexOf(p),promoted);
    }
    promoted.getLegalDests().clear();
    promoted.setMoveCount(p.getMoveCount());
    return promoted;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}
Program: 49977
Project: 49977
Buggy source:
/** 
 * @param isBlack
 */
private void setPieceOnBoard(boolean isBlack){
  if (option.isOccupied() == false) {
    if ((option.getColor().equals(Color.LIGHT_GRAY) == false) && (option.getColor().equals(Color.getHSBColor(30,70,70)) == false)) {
      square.setBackgroundColor(option.getColor());
    }
    if (option.isHabitable() == false) {
      square.setPiece(option.getPiece());
    }
    square.setHabitable(option.isHabitable());
    square.refresh();
  }
 else {
    if (square.isHabitable() == true) {
      Piece p=PieceBuilder.makePiece(option.getPiece().getName(),isBlack,square,board);
      if (isBlack)       blackTeam.add(p);
 else       whiteTeam.add(p);
      square.setPiece(p);
      square.refresh();
    }
 else {
      JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.WARNING_MESSAGE);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param isBlack
 */
private void setPieceOnBoard(boolean isBlack){
  if (!option.isOccupied()) {
    if ((option.getColor().equals(Color.LIGHT_GRAY) == false) && (option.getColor().equals(Color.getHSBColor(30,70,70)) == false)) {
      square.setBackgroundColor(option.getColor());
    }
    if (!option.isHabitable()) {
      square.setPiece(option.getPiece());
    }
    square.setHabitable(option.isHabitable());
    square.refresh();
  }
 else {
    if (square.isHabitable()) {
      if (square.isOccupied()) {
        Piece toRemove=square.getPiece();
        (toRemove.isBlack() ? blackTeam : whiteTeam).remove(toRemove);
      }
      Piece p=PieceBuilder.makePiece(option.getPiece().getName(),isBlack,square,board);
      if (isBlack)       blackTeam.add(p);
 else       whiteTeam.add(p);
      square.setPiece(p);
      square.refresh();
    }
 else {
      JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.WARNING_MESSAGE);
    }
  }
}
Program: 49980
Project: 49980
Buggy source:
/** 
 * @param name The name of the method
 * @param whiteMoves The number of white moves.
 * @param blackMoves The number of black moves
 * @param increment The increment.
 */
public NextTurn(String name,int whiteMoves,int blackMoves,int increment){
  this.name=name;
  doMethod=doMethods.get(name);
  undoMethod=undoMethods.get(name);
  NextTurn.whiteMoves=whiteMoves;
  NextTurn.blackMoves=blackMoves;
  NextTurn.increment=increment;
  currentNumMoves=0;
  isBlackMove=false;
}

Fixed version (ground truth):
/** 
 * @param name The name of the method
 * @param whiteMoves The number of white moves.
 * @param blackMoves The number of black moves
 * @param increment The increment.
 */
public NextTurn(String name,int whiteMoves,int blackMoves,int increment){
  this.name=name;
  doMethod=doMethods.get(name);
  undoMethod=undoMethods.get(name);
  this.whiteMoves=whiteMoves;
  this.blackMoves=blackMoves;
  this.increment=increment;
  currentNumMoves=0;
  isBlackMove=false;
}
Program: 49981
Project: 49981
Buggy source:
public void init(){
  label=new JLabel();
  label.setHorizontalAlignment(SwingConstants.CENTER);
  label.setOpaque(true);
  nf=NumberFormat.getNumberInstance();
  nf.setMinimumIntegerDigits(2);
  timer=new Timer(1000,this);
  timer.setInitialDelay(0);
}

Fixed version (ground truth):
/** 
 * Initialize the components of the timer.
 */
public void init(){
  label=new JLabel();
  label.setHorizontalAlignment(SwingConstants.CENTER);
  label.setOpaque(true);
  nf=NumberFormat.getNumberInstance();
  nf.setMinimumIntegerDigits(2);
  timer=new Timer(1000,this);
  timer.setInitialDelay(0);
}
Program: 49982
Project: 49982
Buggy source:
public abstract void start();

Fixed version (ground truth):
/** 
 * Start the timer
 */
public abstract void start();
Program: 49983
Project: 49983
Buggy source:
public abstract void stop();

Fixed version (ground truth):
/** 
 * Stop the timer.
 */
public abstract void stop();
Program: 49986
Project: 49986
Buggy source:
/** 
 * @param startBoard The original board
 * @return The same board.
 */
public Board classicGetBoard(Board startBoard){
  return g.getBoards()[0];
}

Fixed version (ground truth):
/** 
 * @param startBoard The original board
 * @return The same board.
 */
public Board classicGetBoard(Board startBoard){
  return startBoard;
}
Program: 49988
Project: 49988
Buggy source:
public JMenu createMenu(){
  menu=new JMenu("String_Node_Str");
  if (!isPlayback) {
    JMenuItem draw=new JMenuItem("String_Node_Str",KeyEvent.VK_R);
    draw.addActionListener(new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        if (g.getLastMove() == null)         return;
        g.getLastMove().setResult(new Result(Result.DRAW));
        endOfGame(new Result(Result.DRAW));
      }
    }
);
    menu.add(draw);
  }
  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 (g.getLastMove() == null)         return;
        g.getLastMove().setResult(new Result(Result.DRAW));
        endOfGame(new Result(Result.DRAW));
      }
    }
);
    menu.add(drawItem);
  }
  return menu;
}
Program: 49989
Project: 49989
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){
  if (isPlayback)   return;
  Object[] options=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
  int answer=JOptionPane.showOptionDialog(null,"String_Node_Str" + r.text() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",r.text(),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);
  g.saveGame("String_Node_Str",fileName,g.isClassicChess());
Driver.getInstance().revertPanel();
break;
case 2:
System.exit(0);
break;
default :
Driver.getInstance().revertPanel();
}
}

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){
  if (isPlayback)   return;
  Object[] options=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
  String toDisplay;
  System.out.println(r.isDraw());
  if (r.isDraw())   toDisplay="String_Node_Str" + "String_Node_Str";
 else   toDisplay="String_Node_Str" + r.text() + "String_Node_Str"+ "String_Node_Str";
  toDisplay+="String_Node_Str";
  int answer=JOptionPane.showOptionDialog(null,toDisplay,r.text(),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);
  g.saveGame("String_Node_Str",fileName,g.isClassicChess());
Driver.getInstance().revertPanel();
break;
case 2:
System.exit(0);
break;
default :
Driver.getInstance().revertPanel();
}
}
Program: 49990
Project: 49990
Buggy source:
/** 
 * Revert the piece back to what it was.
 * @param p The piece to unpromote
 * @return The unpromoted piece.
 */
public Piece classicUndo(Piece p){
  try {
    Constructor<?> con=lastPromoted.getConstructor(boolean.class,Square.class,Board.class);
    Piece promoted=(Piece)con.newInstance(p.isBlack(),p.getSquare(),p.getBoard());
    if (promoted.isBlack()) {
      g.getBlackTeam().set(g.getBlackTeam().indexOf(p),promoted);
    }
 else {
      g.getWhiteTeam().set(g.getWhiteTeam().indexOf(p),promoted);
    }
    promoted.getLegalDests().clear();
    promoted.setMoveCount(p.getMoveCount());
    return promoted;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Revert the piece back to what it was.
 * @param p The piece to unpromote
 * @return The unpromoted piece.
 */
public Piece classicUndo(Piece p){
  try {
    Piece promoted=PieceBuilder.makePiece(lastPromoted,p.isBlack(),p.getSquare(),p.getBoard());
    if (promoted.isBlack()) {
      g.getBlackTeam().set(g.getBlackTeam().indexOf(p),promoted);
    }
 else {
      g.getWhiteTeam().set(g.getWhiteTeam().indexOf(p),promoted);
    }
    promoted.getLegalDests().clear();
    promoted.setMoveCount(p.getMoveCount());
    return promoted;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}
Program: 49991
Project: 49991
Buggy source:
/** 
 * In this case, only pawns can promote, allow the user to pick which class it promotes to.
 * @param p The piece to promote
 * @param verified Whether it has been verified that thisis ok
 * @param promo What the piece was promoted to.
 * @return The promoted Piece.
 */
public Piece classicPromotion(Piece p,boolean verified,String promo){
  lastPromoted=p.getClass();
  if (!verified && promo == null) {
    klazz=null;
    while (klazz == null) {
      String result=(String)JOptionPane.showInputDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE,null,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},null);
      if (result == null) {
        continue;
      }
      try {
        klazz=result;
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
 else   if (promo != null) {
    klazz=promo;
  }
  try {
    Piece promoted=PieceBuilder.makePiece(klazz,p.isBlack(),p.getSquare(),p.getBoard());
    if (promoted.isBlack()) {
      g.getBlackTeam().set(g.getBlackTeam().indexOf(p),promoted);
    }
 else {
      g.getWhiteTeam().set(g.getWhiteTeam().indexOf(p),promoted);
    }
    promoted.getLegalDests().clear();
    promoted.setMoveCount(p.getMoveCount());
    return promoted;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * In this case, only pawns can promote, allow the user to pick which class it promotes to.
 * @param p The piece to promote
 * @param verified Whether it has been verified that thisis ok
 * @param promo What the piece was promoted to.
 * @return The promoted Piece.
 */
public Piece classicPromotion(Piece p,boolean verified,String promo){
  lastPromoted=p.getName();
  if (!verified && promo == null) {
    klazz=null;
    while (klazz == null) {
      String result=(String)JOptionPane.showInputDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE,null,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},null);
      if (result == null) {
        continue;
      }
      try {
        klazz=result;
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
 else   if (promo != null) {
    klazz=promo;
  }
  try {
    Piece promoted=PieceBuilder.makePiece(klazz,p.isBlack(),p.getSquare(),p.getBoard());
    if (promoted.isBlack()) {
      g.getBlackTeam().set(g.getBlackTeam().indexOf(p),promoted);
    }
 else {
      g.getWhiteTeam().set(g.getWhiteTeam().indexOf(p),promoted);
    }
    promoted.getLegalDests().clear();
    promoted.setMoveCount(p.getMoveCount());
    return promoted;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}
Program: 49992
Project: 49992
Buggy source:
private void setPieceOnBoard(boolean isBlack){
  System.out.println(option.isHabitable());
  if (option.isOccupied() == false) {
    square.setBackgroundColor(option.getColor());
    square.setHabitable(option.isHabitable());
    square.refresh();
    square.setPiece(null);
    System.out.println(option.getColor());
  }
 else {
    if (square.isHabitable() == true) {
      Piece p=PieceBuilder.makePiece(option.getPiece().getName(),isBlack,square,board);
      if (isBlack)       blackTeam.add(p);
 else       whiteTeam.add(p);
      square.setPiece(p);
      square.refresh();
    }
 else {
      JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.WARNING_MESSAGE);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param isBlack
 */
private void setPieceOnBoard(boolean isBlack){
  System.out.println(option.isHabitable());
  if (option.isOccupied() == false) {
    square.setBackgroundColor(option.getColor());
    square.setHabitable(option.isHabitable());
    square.refresh();
    square.setPiece(null);
    System.out.println(option.getColor());
  }
 else {
    if (square.isHabitable() == true) {
      Piece p=PieceBuilder.makePiece(option.getPiece().getName(),isBlack,square,board);
      if (isBlack)       blackTeam.add(p);
 else       whiteTeam.add(p);
      square.setPiece(p);
      square.refresh();
    }
 else {
      JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.WARNING_MESSAGE);
    }
  }
}
Program: 49993
Project: 49993
Buggy source:
@Override public void mouseExited(MouseEvent arg0){
}

Fixed version (ground truth):
public void mouseExited(MouseEvent arg0){
}
Program: 49994
Project: 49994
Buggy source:
@Override public void valueChanged(ListSelectionEvent e){
  ListSelectionModel lsm=(ListSelectionModel)e.getSource();
  int firstIndex=e.getFirstIndex();
  int lastIndex=e.getLastIndex();
  int selection=lsm.getAnchorSelectionIndex();
  if (!lsm.getValueIsAdjusting()) {
    if (((String)list.elementAt(selection)).equals("String_Node_Str")) {
      bShowPiece.getSquare(1,1).setPiece(null);
      bShowPiece.getSquare(1,1).setBackgroundColor(original);
      bShowPiece.getSquare(1,1).setHabitable(true);
      bShowPiece.getSquare(1,1).refresh();
    }
 else {
      if (bShowPiece.getSquare(1,1).isHabitable() == false)       bShowPiece.getSquare(1,1).setHabitable(true);
      if (bShowPiece.getSquare(1,1).getColor().equals(original) == false)       bShowPiece.getSquare(1,1).setBackgroundColor(original);
      Piece toAdd=PieceBuilder.makePiece((String)list.elementAt(selection),true,bShowPiece.getSquare(1,1),bShowPiece);
      bShowPiece.getSquare(1,1).setPiece(toAdd);
      bShowPiece.getSquare(1,1).refresh();
    }
  }
}

Fixed version (ground truth):
@Override public void valueChanged(ListSelectionEvent e){
  ListSelectionModel lsm=(ListSelectionModel)e.getSource();
  int selection=lsm.getAnchorSelectionIndex();
  if (!lsm.getValueIsAdjusting()) {
    if (((String)list.elementAt(selection)).equals("String_Node_Str")) {
      bShowPiece.getSquare(1,1).setPiece(null);
      bShowPiece.getSquare(1,1).setBackgroundColor(original);
      bShowPiece.getSquare(1,1).setHabitable(true);
      bShowPiece.getSquare(1,1).refresh();
    }
 else {
      if (bShowPiece.getSquare(1,1).isHabitable() == false)       bShowPiece.getSquare(1,1).setHabitable(true);
      if (bShowPiece.getSquare(1,1).getColor().equals(original) == false)       bShowPiece.getSquare(1,1).setBackgroundColor(original);
      Piece toAdd=PieceBuilder.makePiece((String)list.elementAt(selection),true,bShowPiece.getSquare(1,1),bShowPiece);
      bShowPiece.getSquare(1,1).setPiece(toAdd);
      bShowPiece.getSquare(1,1).refresh();
    }
  }
}
Program: 49995
Project: 49995
Buggy source:
/** 
 * Constructor. Initialize the ArrayLists and call initComponents to initialize the GUI.
 * @param b The builder which is creating the new game type.
 * @param whiteRules The whiteRules object.
 * @param blackRules The blackRules object.
 * @return 
 */
public CustomSetupMenu(Builder b,Rules whiteRules,Rules blackRules){
  this.b=b;
  whiteTeam=new ArrayList<Piece>();
  blackTeam=new ArrayList<Piece>();
  initComponents(whiteRules,blackRules);
}

Fixed version (ground truth):
/** 
 * Constructor. Initialize the ArrayLists and call initComponents to initialize the GUI.
 * @param b The builder which is creating the new game type.
 * @param whiteRules The whiteRules object.
 * @param blackRules The blackRules object.
 */
public CustomSetupMenu(Builder b,Rules whiteRules,Rules blackRules){
  this.b=b;
  whiteTeam=new ArrayList<Piece>();
  blackTeam=new ArrayList<Piece>();
  initComponents(whiteRules,blackRules);
}
Program: 49996
Project: 49996
Buggy source:
public SetUpMouseListener(Square square,Board board,Square option){
  this.square=square;
  this.board=board;
  this.option=option;
}

Fixed version (ground truth):
/** 
 * @param square
 * @param board
 * @param option
 */
public SetUpMouseListener(Square square,Board board,Square option){
  this.square=square;
  this.board=board;
  this.option=option;
}
Program: 49997
Project: 49997
Buggy source:
/** 
 * Constructor Set instance variables to passed parameters
 * @param square The square we are setting up.
 * @param board The board on which the square resides.
 */
public SetUpListener(Square square,Board board){
  this.square=square;
  this.board=board;
}

Fixed version (ground truth):
/** 
 * Constructor Set instance variables to passed parameters
 * @param square The square we are setting up.
 * @param board The board on which the square resides.
 */
public SetUpListener(Square square){
  this.square=square;
}
Program: 49999
Project: 49999
Buggy source:
/** 
 * GUI to collect the options desired for a Square. Make the pop up, create the components and add their ActionListeners to collect information.
 */
private void squareOptions(){
  final JFrame popup=new JFrame("String_Node_Str");
  popup.setSize(370,300);
  popup.setLocationRelativeTo(null);
  popup.setLayout(new FlowLayout());
  final JButton pickColor=new JButton("String_Node_Str");
  pickColor.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      Color color=JColorChooser.showDialog(popup,"String_Node_Str",square.getColor());
      if (color == null)       return;
      if (color != Square.HIGHLIGHT_COLOR) {
        square.setBackgroundColor(color);
        pickColor.setBackground(color);
      }
 else {
        JOptionPane.showMessageDialog(popup,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE);
      }
    }
  }
);
  popup.add(pickColor);
  final JCheckBox uninhabitable=new JCheckBox("String_Node_Str",!square.isHabitable());
  popup.add(uninhabitable);
  final JButton done=new JButton("String_Node_Str");
  done.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      square.setHabitable(!uninhabitable.isSelected());
      popup.dispose();
    }
  }
);
  popup.add(done);
  popup.setVisible(true);
}

Fixed version (ground truth):
/** 
 * GUI to collect the options desired for a Square. Make the pop up, create the components and add their ActionListeners to collect information.
 */
private void squareOptions(){
  final JFrame popup=new JFrame("String_Node_Str");
  popup.setSize(370,120);
  popup.setLocationRelativeTo(null);
  popup.setLayout(new FlowLayout());
  final JButton pickColor=new JButton("String_Node_Str");
  pickColor.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      Color color=JColorChooser.showDialog(popup,"String_Node_Str",square.getColor());
      if (color == null)       return;
      if (color != Square.HIGHLIGHT_COLOR) {
        square.setBackgroundColor(color);
        pickColor.setBackground(color);
      }
 else {
        JOptionPane.showMessageDialog(popup,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE);
      }
    }
  }
);
  popup.add(pickColor);
  final JCheckBox uninhabitable=new JCheckBox("String_Node_Str",!square.isHabitable());
  popup.add(uninhabitable);
  final JButton done=new JButton("String_Node_Str");
  done.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      square.setHabitable(!uninhabitable.isSelected());
      popup.dispose();
    }
  }
);
  popup.add(done);
  popup.setVisible(true);
}
Program: 50000
Project: 50000
Buggy source:
@Override public void mousePressed(MouseEvent arg0){
}

Fixed version (ground truth):
public void mousePressed(MouseEvent arg0){
}
Program: 50001
Project: 50001
Buggy source:
@Override public void mouseReleased(MouseEvent arg0){
}

Fixed version (ground truth):
public void mouseReleased(MouseEvent arg0){
}
Program: 50002
Project: 50002
Buggy source:
@Override public void mouseEntered(MouseEvent arg0){
}

Fixed version (ground truth):
public void mouseEntered(MouseEvent arg0){
}
Program: 50003
Project: 50003
Buggy source:
/** 
 * Create a pop up window with customization options. Let the user choose between adding a piece to the square or customizing options of the piece.
 */
private void options(){
  final JFrame popup=new JFrame("String_Node_Str");
  popup.setSize(300,160);
  popup.setLocationRelativeTo(null);
  popup.setLayout(new FlowLayout());
  popup.setResizable(false);
  final JButton squareButton=new JButton("String_Node_Str");
  squareButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      squareOptions();
      popup.dispose();
    }
  }
);
  popup.add(squareButton);
  final JButton makePiece=new JButton("String_Node_Str");
  makePiece.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      if (square.isHabitable()) {
        askForPiece();
      }
 else {
        JOptionPane.showMessageDialog(popup,"String_Node_Str");
      }
      popup.dispose();
    }
  }
);
  popup.add(makePiece);
  final JButton removePiece=new JButton("String_Node_Str");
  removePiece.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent arg0){
      square.setPiece(null);
      square.refresh();
      popup.dispose();
    }
  }
);
  if (square.isOccupied())   removePiece.setEnabled(true);
 else   removePiece.setEnabled(false);
  popup.add(removePiece);
  popup.setVisible(true);
}

Fixed version (ground truth):
/** 
 * Create a pop up window with customization options. Let the user choose between adding a piece to the square or customizing options of the piece.
 */
private void options(){
  final JFrame popup=new JFrame("String_Node_Str");
  popup.setSize(300,90);
  popup.setLocationRelativeTo(null);
  popup.setLayout(new FlowLayout());
  popup.setResizable(false);
  final JButton squareButton=new JButton("String_Node_Str");
  squareButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      squareOptions();
      popup.dispose();
    }
  }
);
  popup.add(squareButton);
  popup.setVisible(true);
}