nus-yam/ex-repair huggingface dataset:
Program: 184211
Project: 184211
Buggy source:
public void parseStrings(String[] list){
  for (  String s : list) {
    String[] bits=s.split("String_Node_Str");
    String[] d=bits[0].split("String_Node_Str");
    Calendar cal=Calendar.getInstance();
    this.add(new Pant(cal.getTime(),Double.parseDouble(bits[1]),bits[2]));
  }
}

Fixed version (ground truth):
public void parseStrings(String[] list){
  for (  String s : list) {
    String[] bits=s.split("String_Node_Str");
    String[] d=bits[0].split("String_Node_Str");
    Calendar cal=Calendar.getInstance();
    cal.set(Integer.parseInt(d[0]),Integer.parseInt(d[1]),Integer.parseInt(d[2]));
    this.add(new Pant(cal.getTime(),Double.parseDouble(bits[1]),bits[2]));
  }
}
Program: 184212
Project: 184212
Buggy source:
public void drop(MouseUpEvent event,DNDContext dndContext){
  if (positioner == null) {
    dndContext.revert();
  }
 else {
    final boolean positionerOffset=isPositionerOffset();
    final DNDTreeViewModelAdaper.DNDNodeInfo parentDndNodeInfo=super.drop(positioner,dndContext);
    positioner.remove();
    if (positionerOffset) {
      open(parentDndNodeInfo,true);
    }
    positioner.refresh();
  }
  positioner=null;
}

Fixed version (ground truth):
public void drop(MouseUpEvent event,DNDContext dndContext){
  if (positioner == null) {
    dndContext.revert();
  }
 else {
    final boolean positionerOffset=isPositionerOffset();
    final DNDNodeInfo parentDndNodeInfo=super.drop(positioner,dndContext);
    positioner.remove();
    if (positionerOffset) {
      open(parentDndNodeInfo,true);
    }
    positioner.refresh();
  }
  positioner=null;
}
Program: 184213
Project: 184213
Buggy source:
public DNDTreeViewModelAdaper.DNDNodeInfo putPositioner(boolean xShifted,boolean insertBelow,String key){
  DNDTreeViewModelAdaper.DNDNodeInfo relativeNode=getDNDNodeInfo(key);
  if (relativeNode == null) {
    return null;
  }
  if (insertBelow && xShifted) {
    TreeNode treeNode=open(relativeNode,true);
    if (treeNode != null && treeNode.getChildCount() > 0) {
      xShifted=false;
    }
  }
 else {
    xShifted=false;
  }
  setPositionerOffset(xShifted);
  int idx=relativeNode.indexOf();
  if (insertBelow) {
    idx++;
  }
  @SuppressWarnings({"String_Node_Str"}) final DNDTreeViewModelAdaper.DNDNodeInfo res=relativeNode.addSibling(idx,getPositionerItem());
  res.refresh();
  return res;
}

Fixed version (ground truth):
public DNDNodeInfo putPositioner(boolean xShifted,boolean insertBelow,String key){
  DNDNodeInfo relativeNode=getDNDNodeInfo(key);
  if (relativeNode == null) {
    return null;
  }
  if (insertBelow && xShifted) {
    TreeNode treeNode=open(relativeNode,true);
    if (treeNode != null && treeNode.getChildCount() > 0) {
      xShifted=false;
    }
  }
 else {
    xShifted=false;
  }
  setPositionerOffset(xShifted);
  int idx=relativeNode.indexOf();
  if (insertBelow) {
    idx++;
  }
  @SuppressWarnings({"String_Node_Str"}) final DNDNodeInfo res=relativeNode.addSibling(idx,getPositionerItem());
  res.refresh();
  return res;
}
Program: 184214
Project: 184214
Buggy source:
public void onMouseMove(MouseMoveEvent event){
  NodeList<Element> dropTargetList=tree.getElement().getElementsByTagName(DNDTreeViewModelAdaper.TAG);
  Element dropTarget=findClosestElement(event,dropTargetList);
  int x=event.getRelativeX(dropTarget);
  int y=event.getRelativeY(dropTarget);
  String key=dropTarget.getAttribute(DNDTreeViewModelAdaper.KEY_ATTR);
  putPositionerAt(new Pos(x >= 16 ? 16 : 0,y > 10 ? 1 : 0,key));
}

Fixed version (ground truth):
public void onMouseMove(MouseMoveEvent event){
  NodeList<Element> dropTargetList=tree.getElement().getElementsByTagName(TAG);
  Element dropTarget=findClosestElement(event,dropTargetList);
  int x=event.getRelativeX(dropTarget);
  int y=event.getRelativeY(dropTarget);
  String key=dropTarget.getAttribute(KEY_ATTR);
  putPositionerAt(new Pos(x >= 16 ? 16 : 0,y > 10 ? 1 : 0,key));
}
Program: 184215
Project: 184215
Buggy source:
public TreeNode open(DNDTreeViewModelAdaper.DNDNodeInfo nodeToOpen,final boolean open){
  Stack<DNDTreeViewModelAdaper.DNDNodeInfo> nodesToOpen=new Stack<DNDTreeViewModelAdaper.DNDNodeInfo>();
  DNDTreeViewModelAdaper.DNDNodeInfo nodePos=nodeToOpen;
  while (nodePos != null) {
    if (nodePos.getParentDndNodeInfo() != null) {
      nodesToOpen.push(nodePos);
    }
    nodePos=nodePos.getParentDndNodeInfo();
  }
  TreeNode treeNode=tree.getRootTreeNode();
  while (!nodesToOpen.empty()) {
    nodePos=nodesToOpen.pop();
    final int idx=nodePos.indexOf();
    if (nodesToOpen.isEmpty()) {
      treeNode=treeNode.setChildOpen(idx,open);
    }
 else {
      treeNode=treeNode.setChildOpen(idx,true);
    }
  }
  return treeNode;
}

Fixed version (ground truth):
public TreeNode open(DNDNodeInfo nodeToOpen,final boolean open){
  Stack<DNDNodeInfo> nodesToOpen=new Stack<DNDNodeInfo>();
  DNDNodeInfo nodePos=nodeToOpen;
  while (nodePos != null) {
    if (nodePos.getParentDndNodeInfo() != null) {
      nodesToOpen.push(nodePos);
    }
    nodePos=nodePos.getParentDndNodeInfo();
  }
  TreeNode treeNode=tree.getRootTreeNode();
  while (!nodesToOpen.empty()) {
    nodePos=nodesToOpen.pop();
    final int idx=nodePos.indexOf();
    if (nodesToOpen.isEmpty()) {
      treeNode=treeNode.setChildOpen(idx,open);
    }
 else {
      treeNode=treeNode.setChildOpen(idx,true);
    }
  }
  return treeNode;
}
Program: 184216
Project: 184216
Buggy source:
public <T>boolean moveNode(T item,T newParent,int idx);

Fixed version (ground truth):
public boolean moveNode(Object item,Object newParent,int idx);
Program: 184217
Project: 184217
Buggy source:
public void drop(DNDNodeInfo positioner,DNDContext dndContext){
  int idx=positioner.indexOf();
  Object key=dndContext.getKey();
  final DNDNodeInfo dndNodeInfo=cache.get(key.toString());
  String parentKey;
  if (!positionerOffset) {
    parentKey=positioner.getParentKey();
  }
 else {
    T parentItem=positioner.dataProvider.getList().get(idx - 1);
    parentKey=idMap.get(parentItem).toString();
    idx=0;
  }
  DNDNodeInfo parentNodeInfo=cache.get(parentKey);
  moveNode(dndNodeInfo.item,parentNodeInfo.item,idx);
}

Fixed version (ground truth):
public void drop(DNDNodeInfo positioner,DNDContext dndContext){
  int idx=positioner.indexOf();
  Object key=dndContext.getKey();
  final DNDNodeInfo dndNodeInfo=cache.get(key.toString());
  String parentKey;
  if (!positionerOffset) {
    parentKey=positioner.getParentKey();
  }
 else {
    T parentItem=positioner.dataProvider.getList().get(idx - 1);
    parentKey=idMap.get(parentItem).toString();
    idx=0;
  }
  DNDNodeInfo parentNodeInfo=cache.get(parentKey);
  moveNode(dndNodeInfo.item,parentNodeInfo == null ? rootValue : parentNodeInfo.item,idx);
}
Program: 184218
Project: 184218
Buggy source:
/** 
 * Moves the game forward one step.
 * @return the resulting grid state
 */
public Grid iterate(){
  for (int i=0; i < threadList.length; i++) {
    threadList[i]=new LifeThread(i);
  }
  for (  LifeThread t : threadList) {
    t.start();
  }
  for (  LifeThread t : threadList) {
    try {
      t.join();
    }
 catch (    InterruptedException e) {
    }
  }
  for (int i=0; i < noise; i++) {
    int row=(int)(Math.random() * current.getRows());
    int col=(int)(Math.random() * current.getCols());
    boolean alive=next.isAlive(row,col);
    next.setAlive(row,col,!alive);
  }
  Grid temp=current;
  current=next;
  next=temp;
  iterationCount++;
  return current;
}

Fixed version (ground truth):
/** 
 * Moves the game forward one step.
 * @return the resulting grid state
 */
public Grid iterate(){
  for (int i=0; i < threadList.length; i++) {
    threadList[i]=new LifeThread(i);
  }
  for (  LifeThread t : threadList) {
    t.start();
  }
  for (  LifeThread t : threadList) {
    try {
      t.join();
    }
 catch (    InterruptedException e) {
    }
  }
  if (noise > 0) {
    int changed[][]=new int[noise][2];
    for (int i=0; i < noise; i++) {
      boolean repeat;
      int row, col;
      do {
        repeat=false;
        row=(int)(Math.random() * current.getRows());
        col=(int)(Math.random() * current.getCols());
        for (int j=0; j < i; j++) {
          if (changed[j][0] == row && changed[j][1] == col) {
            repeat=true;
            break;
          }
        }
      }
 while (repeat);
      boolean alive=next.isAlive(row,col);
      next.setAlive(row,col,!alive);
      changed[i][0]=row;
      changed[i][1]=col;
    }
  }
  Grid temp=current;
  current=next;
  next=temp;
  iterationCount++;
  return current;
}
Program: 184219
Project: 184219
Buggy source:
@Override public void onClick(View v){
  playAgain();
switch (mode) {
case MODE_MULTIPLAYER_HOST:
{
      out.println(NEW_GAME);
      break;
    }
case MODE_MULTIPLAYER_JOIN:
{
    gameView.setEnabled(false);
    out.println(NEW_GAME);
    break;
  }
case MODE_SINGLEPLAYER:
{
  AI=new GameAI(gameView.getBoard(),GameAI.EASY);
}
}
}

Fixed version (ground truth):
@Override public void onClick(View v){
  playAgain();
switch (mode) {
case MODE_MULTIPLAYER_HOST:
{
      out.println(NEW_GAME);
      gameView.setEnabled(true);
      break;
    }
case MODE_MULTIPLAYER_JOIN:
{
    gameView.setEnabled(false);
    out.println(NEW_GAME);
    break;
  }
case MODE_SINGLEPLAYER:
{
  AI=new GameAI(gameView.getBoard(),GameAI.EASY);
}
}
}
Program: 184220
Project: 184220
Buggy source:
/** 
 * Creates a Button for play again after a WIN or DRAW.
 */
private void setupPlayAgain(){
  replay.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT));
  replay.setBackgroundDrawable(getResources().getDrawable(R.drawable.button_playagain));
  replay.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      playAgain();
switch (mode) {
case MODE_MULTIPLAYER_HOST:
{
          out.println(NEW_GAME);
          break;
        }
case MODE_MULTIPLAYER_JOIN:
{
        gameView.setEnabled(false);
        out.println(NEW_GAME);
        break;
      }
case MODE_SINGLEPLAYER:
{
      AI=new GameAI(gameView.getBoard(),GameAI.EASY);
    }
}
}
}
);
gameViewLayout.addView(replay);
}

Fixed version (ground truth):
/** 
 * Creates a Button for play again after a WIN or DRAW.
 */
private void setupPlayAgain(){
  replay.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT));
  replay.setBackgroundDrawable(getResources().getDrawable(R.drawable.button_playagain));
  replay.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      playAgain();
switch (mode) {
case MODE_MULTIPLAYER_HOST:
{
          out.println(NEW_GAME);
          gameView.setEnabled(true);
          break;
        }
case MODE_MULTIPLAYER_JOIN:
{
        gameView.setEnabled(false);
        out.println(NEW_GAME);
        break;
      }
case MODE_SINGLEPLAYER:
{
      AI=new GameAI(gameView.getBoard(),GameAI.EASY);
    }
}
}
}
);
gameViewLayout.addView(replay);
}
Program: 184221
Project: 184221
Buggy source:
private void putPlayer(int x,int y,GamePlayer player){
  if (gameView.getBoard().put(x,y,player) == GameState.INVALID_MOVE) {
    return;
  }
switch (mode) {
case MODE_SINGLEPLAYER:
{
      if (gameView.getBoard().getState() == GameState.NEUTRAL) {
        if (gameView.getBoard().getCurrentPlayer() == GamePlayer.PLAYER1) {
          gameView.setEnabled(false);
          gameView.getBoard().setCurrentPlayer(GamePlayer.PLAYER2);
          Position AImove=AI.getMove();
          putPlayer(AImove.getX(),AImove.getY(),gameView.getBoard().getCurrentPlayer());
          return;
        }
 else {
          gameView.getBoard().setCurrentPlayer(GamePlayer.PLAYER1);
          gameView.setEnabled(true);
        }
      }
      break;
    }
case MODE_MULTIPLAYER_SHARED:
{
    if (gameView.getBoard().getState() == GameState.NEUTRAL) {
      if (gameView.getBoard().getCurrentPlayer() == GamePlayer.PLAYER1) {
        gameView.getBoard().setCurrentPlayer(GamePlayer.PLAYER2);
      }
 else {
        gameView.getBoard().setCurrentPlayer(GamePlayer.PLAYER1);
      }
    }
    break;
  }
case MODE_MULTIPLAYER_HOST:
{
  out.printf("String_Node_Str",x,y);
  gameView.getBoard().setCurrentPlayer(GamePlayer.PLAYER2);
  gameView.setEnabled(false);
  break;
}
case MODE_MULTIPLAYER_JOIN:
{
out.printf("String_Node_Str",x,y);
gameView.getBoard().setCurrentPlayer(GamePlayer.PLAYER1);
gameView.setEnabled(false);
break;
}
}
updateStatus();
updateState(gameView.getBoard().getCurrentPlayer());
gameView.invalidate();
}

Fixed version (ground truth):
private void putPlayer(int x,int y,GamePlayer player){
  if (gameView.getBoard().put(x,y,player) == GameState.INVALID_MOVE) {
    return;
  }
switch (mode) {
case MODE_SINGLEPLAYER:
{
      if (gameView.getBoard().getState() == GameState.NEUTRAL) {
        if (gameView.getBoard().getCurrentPlayer() == GamePlayer.PLAYER1) {
          gameView.setEnabled(false);
          gameView.getBoard().setCurrentPlayer(GamePlayer.PLAYER2);
          Position AImove=AI.getMove();
          putPlayer(AImove.getX(),AImove.getY(),gameView.getBoard().getCurrentPlayer());
          return;
        }
 else {
          gameView.getBoard().setCurrentPlayer(GamePlayer.PLAYER1);
          gameView.setEnabled(true);
        }
      }
      break;
    }
case MODE_MULTIPLAYER_SHARED:
{
    if (gameView.getBoard().getState() == GameState.NEUTRAL) {
      if (gameView.getBoard().getCurrentPlayer() == GamePlayer.PLAYER1) {
        gameView.getBoard().setCurrentPlayer(GamePlayer.PLAYER2);
      }
 else {
        gameView.getBoard().setCurrentPlayer(GamePlayer.PLAYER1);
      }
    }
    break;
  }
case MODE_MULTIPLAYER_HOST:
{
  out.printf("String_Node_Str",x,y);
  gameView.getBoard().setCurrentPlayer(GamePlayer.PLAYER2);
  gameView.setEnabled(false);
  break;
}
case MODE_MULTIPLAYER_JOIN:
{
out.printf("String_Node_Str",x,y);
gameView.getBoard().setCurrentPlayer(GamePlayer.PLAYER1);
gameView.setEnabled(false);
break;
}
}
updateStatus();
if (mode != MODE_SINGLEPLAYER) {
updateState(player);
}
 else {
updateState(gameView.getBoard().getCurrentPlayer());
}
gameView.invalidate();
}
Program: 184222
Project: 184222
Buggy source:
private void createGameView(int boardSize,int inRow){
  this.gameView=new GameView(this,boardSize,inRow);
  this.gameView.setFocusable(true);
  this.gameView.setFocusableInTouchMode(true);
  this.gameView.setOnTouchListener(new View.OnTouchListener(){
    @Override public boolean onTouch(    View v,    MotionEvent event){
      int action=event.getAction();
      if (action == MotionEvent.ACTION_DOWN) {
        return true;
      }
 else       if (action == MotionEvent.ACTION_UP) {
        int sxy=gameView.getSxy();
        int x=(int)event.getX() / sxy;
        int y=(int)event.getY() / sxy;
        if (gameView.isEnabled() && x >= 0 && x < gameView.getBoardSize() && y >= 0 & y < gameView.getBoardSize()) {
          if (gameView.getBoard().get(x,y) == GamePlayer.EMPTY) {
            putPlayer(x,y,gameView.getBoard().getCurrentPlayer());
          }
        }
        return true;
      }
      return false;
    }
  }
);
  gameViewHolder.addView(gameView);
}

Fixed version (ground truth):
private void createGameView(int boardSize,int inRow){
  this.gameView=new GameView(this,boardSize,inRow);
  this.gameView.setFocusable(true);
  this.gameView.setFocusableInTouchMode(true);
  this.gameView.setOnTouchListener(new View.OnTouchListener(){
    @Override public boolean onTouch(    View v,    MotionEvent event){
      int action=event.getAction();
      if (action == MotionEvent.ACTION_DOWN) {
        return true;
      }
 else       if (action == MotionEvent.ACTION_UP) {
        int sxy=gameView.getSxy();
        int x=(int)event.getX() / sxy;
        int y=(int)event.getY() / sxy;
        if (gameView.isEnabled() && x >= 0 && x < gameView.getBoardSize() && y >= 0 & y < gameView.getBoardSize()) {
          if (gameView.getBoard().get(x,y) == GamePlayer.EMPTY) {
            GamePlayer player=gameView.getBoard().getCurrentPlayer();
            putPlayer(x,y,player);
          }
        }
        return true;
      }
      return false;
    }
  }
);
  gameViewHolder.addView(gameView);
}
Program: 184223
Project: 184223
Buggy source:
@Override public boolean onTouch(View v,MotionEvent event){
  int action=event.getAction();
  if (action == MotionEvent.ACTION_DOWN) {
    return true;
  }
 else   if (action == MotionEvent.ACTION_UP) {
    int sxy=gameView.getSxy();
    int x=(int)event.getX() / sxy;
    int y=(int)event.getY() / sxy;
    if (gameView.isEnabled() && x >= 0 && x < gameView.getBoardSize() && y >= 0 & y < gameView.getBoardSize()) {
      if (gameView.getBoard().get(x,y) == GamePlayer.EMPTY) {
        putPlayer(x,y,gameView.getBoard().getCurrentPlayer());
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onTouch(View v,MotionEvent event){
  int action=event.getAction();
  if (action == MotionEvent.ACTION_DOWN) {
    return true;
  }
 else   if (action == MotionEvent.ACTION_UP) {
    int sxy=gameView.getSxy();
    int x=(int)event.getX() / sxy;
    int y=(int)event.getY() / sxy;
    if (gameView.isEnabled() && x >= 0 && x < gameView.getBoardSize() && y >= 0 & y < gameView.getBoardSize()) {
      if (gameView.getBoard().get(x,y) == GamePlayer.EMPTY) {
        GamePlayer player=gameView.getBoard().getCurrentPlayer();
        putPlayer(x,y,player);
      }
    }
    return true;
  }
  return false;
}
Program: 184224
Project: 184224
Buggy source:
/** 
 * Get the current game state
 * @return State of the game
 */
public GameState getState(){
  for (int i=0, n=0; i < board.length; i++) {
    if (board[x][i] == player) {
      n++;
    }
 else     if (board[x][i] == GamePlayer.EMPTY) {
      if (n > 0) {
        n--;
      }
    }
 else {
      break;
    }
    if (n == inRow) {
      return GameState.WIN;
    }
  }
  for (int i=0, n=0; i < board.length; i++) {
    if (board[i][y] == player) {
      n++;
    }
 else     if (board[i][y] == GamePlayer.EMPTY) {
      if (n > 0) {
        n--;
      }
    }
 else {
      break;
    }
    if (n == inRow) {
      return GameState.WIN;
    }
  }
  if (x == y) {
    for (int i=0, n=0; i < board.length; i++) {
      if (board[i][i] == player) {
        n++;
      }
 else       if (board[i][i] == GamePlayer.EMPTY) {
        if (n > 0) {
          n--;
        }
      }
 else {
        break;
      }
      if (n == inRow) {
        return GameState.WIN;
      }
    }
  }
  for (int i=0, n=0; i < board.length; i++) {
    if (board[i][(board.length - 1) - i] == player) {
      n++;
    }
 else     if (board[i][(board.length - 1) - i] == GamePlayer.EMPTY) {
      if (n > 0) {
        n--;
      }
    }
    if (n == inRow) {
      return GameState.WIN;
    }
  }
  if (moveCount == Math.pow(board.length,2) - 1) {
    return GameState.DRAW;
  }
  return GameState.NEUTRAL;
}

Fixed version (ground truth):
/** 
 * Get the current game state
 * @return State of the game
 */
public GameState getState(){
  for (int i=0, n=0; i < board.length; i++) {
    if (board[x][i] == player) {
      n++;
    }
 else     if (board[x][i] == GamePlayer.EMPTY) {
      n=0;
    }
 else {
      break;
    }
    if (n == inRow) {
      return GameState.WIN;
    }
  }
  for (int i=0, n=0; i < board.length; i++) {
    if (board[i][y] == player) {
      n++;
    }
 else     if (board[i][y] == GamePlayer.EMPTY) {
      n=0;
    }
 else {
      break;
    }
    if (n == inRow) {
      return GameState.WIN;
    }
  }
  if (x == y) {
    for (int i=0, n=0; i < board.length; i++) {
      if (board[i][i] == player) {
        n++;
      }
 else       if (board[i][i] == GamePlayer.EMPTY) {
        n=0;
      }
 else {
        break;
      }
      if (n == inRow) {
        return GameState.WIN;
      }
    }
  }
  for (int i=0, n=0; i < board.length; i++) {
    if (board[i][(board.length - 1) - i] == player) {
      n++;
    }
 else     if (board[i][(board.length - 1) - i] == GamePlayer.EMPTY) {
      n=0;
    }
    if (n == inRow) {
      return GameState.WIN;
    }
  }
  if (moveCount == Math.pow(board.length,2) - 1) {
    return GameState.DRAW;
  }
  return GameState.NEUTRAL;
}
Program: 184225
Project: 184225
Buggy source:
/** 
 * Test 3x3 game with a column win
 */
@Test public void testGame3x3_ColumnWin(){
  final GameBoard b=new GameBoard(3,3);
  assertEquals(VALID_MOVE,b.put(0,0,PLAYER1));
  assertEquals(PLAYER1,b.get(0,0));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(1,0,PLAYER2));
  assertEquals(PLAYER2,b.get(1,0));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(0,1,PLAYER1));
  assertEquals(PLAYER1,b.get(0,1));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(1,1,PLAYER2));
  assertEquals(PLAYER2,b.get(1,1));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(0,2,PLAYER1));
  assertEquals(PLAYER1,b.get(0,2));
  System.out.println(b.toString());
  assertEquals(WIN,b.getState());
}

Fixed version (ground truth):
/** 
 * Test 3x3 game with a column win
 */
@Test public void testGame3x3_ColumnWin(){
  final GameBoard b=new GameBoard(3,3);
  assertEquals(VALID_MOVE,b.put(0,0,PLAYER1));
  assertEquals(PLAYER1,b.get(0,0));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(1,0,PLAYER2));
  assertEquals(PLAYER2,b.get(1,0));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(0,1,PLAYER1));
  assertEquals(PLAYER1,b.get(0,1));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(1,1,PLAYER2));
  assertEquals(PLAYER2,b.get(1,1));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(0,2,PLAYER1));
  assertEquals(PLAYER1,b.get(0,2));
  assertEquals(WIN,b.getState());
}
Program: 184226
Project: 184226
Buggy source:
/** 
 * Get the current game state
 * @return State of the game
 */
public GameState getState(){
  for (int i=0; i < inRow; i++) {
    if (board[x][i] != player) {
      break;
    }
    if (i == inRow - 1) {
      return GameState.WIN;
    }
  }
  for (int i=0; i < inRow; i++) {
    if (board[i][y] != player) {
      break;
    }
    if (i == inRow - 1) {
      return GameState.WIN;
    }
  }
  if (x == y) {
    for (int i=0; i < inRow; i++) {
      if (board[i][i] != player) {
        break;
      }
      if (i == inRow - 1) {
        return GameState.WIN;
      }
    }
  }
  for (int i=0; i < inRow; i++) {
    if (board[i][(inRow - 1) - i] != player) {
      break;
    }
    if (i == inRow - 1) {
      return GameState.WIN;
    }
  }
  if (moveCount == (inRow ^ 2) - 1) {
    return GameState.DRAW;
  }
  return GameState.NEUTRAL;
}

Fixed version (ground truth):
/** 
 * Get the current game state
 * @return State of the game
 */
public GameState getState(){
  for (int i=0; i < inRow; i++) {
    if (board[x][i] != player) {
      break;
    }
    if (i == inRow - 1) {
      return GameState.WIN;
    }
  }
  for (int i=0; i < inRow; i++) {
    if (board[i][y] != player) {
      break;
    }
    if (i == inRow - 1) {
      return GameState.WIN;
    }
  }
  if (x == y) {
    for (int i=0; i < inRow; i++) {
      if (board[i][i] != player) {
        break;
      }
      if (i == inRow - 1) {
        return GameState.WIN;
      }
    }
  }
  for (int i=0; i < inRow; i++) {
    if (board[i][(inRow - 1) - i] != player) {
      break;
    }
    if (i == inRow - 1) {
      return GameState.WIN;
    }
  }
  if (moveCount == Math.pow(inRow,2)) {
    return GameState.DRAW;
  }
  return GameState.NEUTRAL;
}
Program: 184227
Project: 184227
Buggy source:
/** 
 * Set the position to the given player
 * @param x X coordinate
 * @param y Y coordinate
 * @param p Player to set
 * @return Game state
 */
public GameState put(int x,int y,GamePlayer p){
  if (board[x][y] == GamePlayer.EMPTY) {
    board[x][y]=p;
    this.x=x;
    this.y=y;
    this.player=p;
    moveCount++;
    return GameState.VALID_MOVE;
  }
 else {
    return GameState.INVALID_MOVE;
  }
}

Fixed version (ground truth):
/** 
 * Set the position to the given player
 * @param x X coordinate
 * @param y Y coordinate
 * @param p Player to set
 * @return Game state
 */
public GameState put(int x,int y,GamePlayer p){
  if (x < 0 || x >= board.length) {
    throw new IllegalArgumentException(String.format("String_Node_Str",board.length - 1));
  }
  if (y < 0 || y >= board[x].length) {
    throw new IllegalArgumentException(String.format("String_Node_Str",board[x].length - 1));
  }
  if (board[x][y] == GamePlayer.EMPTY) {
    board[x][y]=p;
    this.x=x;
    this.y=y;
    this.player=p;
    moveCount++;
    return GameState.VALID_MOVE;
  }
 else {
    return GameState.INVALID_MOVE;
  }
}
Program: 184228
Project: 184228
Buggy source:
public GameState put(int x,int y,GameState s){
  if (board[x][y] == GameState.EMPTY) {
    board[x][y]=s;
    this.x=x;
    this.y=x;
    this.player=s;
    moveCount++;
    return GameState.VALID_MOVE;
  }
 else {
    return GameState.INVALID_MOVE;
  }
}

Fixed version (ground truth):
/** 
 * Set the position to the given state
 * @param x X coordinate
 * @param y Y coordinate
 * @param s State to set
 * @return
 */
public GameState put(int x,int y,GameState s){
  if (board[x][y] == GameState.EMPTY) {
    board[x][y]=s;
    this.x=x;
    this.y=y;
    this.player=s;
    moveCount++;
    return GameState.VALID_MOVE;
  }
 else {
    return GameState.INVALID_MOVE;
  }
}
Program: 184229
Project: 184229
Buggy source:
@Test public void testGame3x3(){
  GameBoard b=new GameBoard(3);
  b.setInRow(3);
  assertEquals(VALID_MOVE,b.put(0,0,PLAYER1));
  assertEquals(PLAYER1,b.get(0,0));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(0,1,PLAYER2));
  assertEquals(PLAYER2,b.get(0,1));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(1,0,PLAYER1));
  assertEquals(PLAYER1,b.get(1,0));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(1,1,PLAYER2));
  assertEquals(PLAYER2,b.get(1,1));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(2,0,PLAYER1));
  assertEquals(PLAYER1,b.get(2,0));
  assertEquals(WIN,b.getState());
}

Fixed version (ground truth):
@Test public void testGame3x3(){
  GameBoard b=new GameBoard(3);
  b.setInRow(3);
  assertEquals(VALID_MOVE,b.put(0,0,PLAYER1));
  assertEquals(PLAYER1,b.get(0,0));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(0,1,PLAYER2));
  assertEquals(PLAYER2,b.get(0,1));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(1,0,PLAYER1));
  assertEquals(PLAYER1,b.get(1,0));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(1,1,PLAYER2));
  assertEquals(PLAYER2,b.get(1,1));
  assertEquals(NEUTRAL,b.getState());
  assertEquals(VALID_MOVE,b.put(2,0,PLAYER1));
  assertEquals(PLAYER1,b.get(2,0));
  System.out.println(b.toString());
  assertEquals(WIN,b.getState());
}
Program: 184230
Project: 184230
Buggy source:
public void updateVariableValue(String variable,Object componentValue){
  processVariables.put(variable,componentValue);
}

Fixed version (ground truth):
public void updateVariableValue(String variable,Object componentValue){
  processVariables.put(variable,componentValue);
  groovyContext.put(variable,componentValue);
}
Program: 184231
Project: 184231
Buggy source:
/** 
 * Open already started task
 * @param taskInstance
 * @return
 * @throws Exception
 */
public void openTask(TaskInstance taskInstance) throws Exception {
  this.taskInstance=taskInstance;
  if (!activityDefinitions.containsKey(taskInstance.getActivityName()))   return;
  processInstanceUUID=taskInstance.getProcessInstanceUUID();
  Activity activity=activityDefinitions.get(taskInstance.getActivityName());
  PageFlow pageFlow=activity.getPageflow();
  taskManager=new TaskManager(this);
  taskManager.setActivity(activity);
  initProcessVariables();
  updateView(taskManager.renderPageflow(pageFlow));
}

Fixed version (ground truth):
/** 
 * Open already started task
 * @param taskInstance
 * @return
 * @throws Exception
 */
public void openTask(TaskInstance taskInstance) throws Exception {
  this.taskInstance=taskInstance;
  if (taskInstance.getProcessDefinitionUUID().equals(this.processDefinitionUUID) == false) {
    this.processDefinitionUUID=taskInstance.getProcessDefinitionUUID();
    initManagerVariables();
  }
  if (!activityDefinitions.containsKey(taskInstance.getActivityName()))   return;
  processInstanceUUID=taskInstance.getProcessInstanceUUID();
  Activity activity=activityDefinitions.get(taskInstance.getActivityName());
  PageFlow pageFlow=activity.getPageflow();
  taskManager=new TaskManager(this);
  taskManager.setActivity(activity);
  updateView(taskManager.renderPageflow(pageFlow));
}
Program: 184232
Project: 184232
Buggy source:
private void updateView(List<Component> components){
  this.buttons.removeAllComponents();
  this.taskPanel.removeAllComponents();
  if (components.size() == 1) {
    Component c=components.get(0);
    this.taskPanel.addComponent(c);
  }
 else {
    Accordion accordionLayout=new Accordion();
    accordionLayout.setSizeFull();
    for (    Component component : components) {
      accordionLayout.addTab(component,component.getCaption(),null);
    }
    this.taskPanel.addComponent(accordionLayout);
  }
  for (  Entry<String,TaskField> component : this.taskManager.getFields().entrySet()) {
    TaskField tf=component.getValue();
    if (tf.getWidget().getType() == WidgetType.BUTTON_SUBMIT) {
      Button button=(Button)tf.getComponent();
      this.buttons.addButton(button);
    }
  }
  Button buttonKatkesta=new Button("String_Node_Str");
  this.buttons.addButton(buttonKatkesta);
  this.buttons.setComponentAlignment(buttonKatkesta,Alignment.MIDDLE_RIGHT);
  buttonKatkesta.setSizeUndefined();
  Button buttonSulge=new Button("String_Node_Str");
  this.buttons.addButton(buttonSulge);
  this.buttons.setComponentAlignment(buttonSulge,Alignment.MIDDLE_RIGHT);
  buttonSulge.setSizeUndefined();
}

Fixed version (ground truth):
private void updateView(List<Component> components){
  this.buttons.removeAllComponents();
  this.taskPanel.removeAllComponents();
  if (components.size() == 1) {
    Component c=components.get(0);
    this.taskPanel.addComponent(c);
  }
 else {
    Accordion accordionLayout=new Accordion();
    accordionLayout.setSizeFull();
    for (    Component component : components) {
      accordionLayout.addTab(component,component.getCaption(),null);
    }
    this.taskPanel.addComponent(accordionLayout);
  }
  for (  Entry<String,TaskField> component : this.taskManager.getFields().entrySet()) {
    TaskField tf=component.getValue();
    if (tf.getWidget().getType() == WidgetType.BUTTON_SUBMIT) {
      Button button=(Button)tf.getComponent();
      this.buttons.addButton(button);
    }
  }
  Button buttonKatkesta=new Button("String_Node_Str");
  buttonKatkesta.addListener(new Button.ClickListener(){
    public void buttonClick(    ClickEvent event){
      try {
        if (taskInstance != null)         getBpmModule().cancelProcessInstance(getProcessInstanceUUID());
        getWindow().close();
      }
 catch (      Exception e) {
        getWindow().showError("String_Node_Str");
        throw new RuntimeException(e);
      }
    }
  }
);
  this.buttons.addButton(buttonKatkesta);
  this.buttons.setComponentAlignment(buttonKatkesta,Alignment.MIDDLE_RIGHT);
  buttonKatkesta.setWidth("String_Node_Str");
  Button buttonClose=new Button("String_Node_Str");
  buttonClose.addListener(new Button.ClickListener(){
    public void buttonClick(    ClickEvent event){
      getWindow().close();
    }
  }
);
  this.buttons.addButton(buttonClose);
  this.buttons.setComponentAlignment(buttonClose,Alignment.MIDDLE_RIGHT);
  buttonClose.setWidth("String_Node_Str");
}
Program: 184233
Project: 184233
Buggy source:
public void finishTask(TaskManager manager){
  try {
    String confirmationMessage=manager.getConfirmationMessage();
    if (!StringUtils.isNullOrEmpty(confirmationMessage)) {
      getWindow().showInformation(confirmationMessage);
    }
    if (taskInstance != null) {
      getBpmModule().finishTask(taskInstance,true,getProcessVariables(),manager.getActivityVariables(),null);
    }
    taskInstance=bpmModule.nextUserTask(getProcessInstanceUUID(),ProcessbaseApplication.getCurrent().getUserName());
    if (taskInstance != null) {
      manager.Dispose();
      openTask(taskInstance);
    }
 else {
      if (window != null) {
        window.showInformation("String_Node_Str");
        window.close();
        return;
      }
    }
  }
 catch (  TaskNotFoundException e) {
    window.showError(e.getMessage());
  }
catch (  IllegalTaskStateException e) {
    window.showError(e.getMessage());
  }
catch (  InstanceNotFoundException e) {
    window.showError(e.getMessage());
  }
catch (  VariableNotFoundException e) {
    window.showError(e.getMessage());
  }
catch (  Exception e) {
    window.showError(e.getMessage());
  }
}

Fixed version (ground truth):
public void finishTask(TaskManager manager){
  try {
    String confirmationMessage=manager.getConfirmationMessage();
    if (!StringUtils.isNullOrEmpty(confirmationMessage)) {
      getWindow().showInformation(confirmationMessage);
    }
    if (taskInstance != null) {
      getBpmModule().finishTask(taskInstance,true,getProcessVariables(),manager.getActivityVariables(),null);
    }
    taskInstance=bpmModule.nextUserTask(getProcessInstanceUUID(),ProcessbaseApplication.getCurrent().getUserName());
    if (taskInstance != null) {
      manager.Dispose();
      openTask(taskInstance);
    }
 else     if (window != null) {
      window.showInformation("String_Node_Str");
      window.close();
      return;
    }
  }
 catch (  TaskNotFoundException e) {
    window.showError(e.getMessage());
  }
catch (  IllegalTaskStateException e) {
    window.showError(e.getMessage());
  }
catch (  InstanceNotFoundException e) {
    window.showError(e.getMessage());
  }
catch (  VariableNotFoundException e) {
    window.showError(e.getMessage());
  }
catch (  Exception e) {
    window.showError(e.getMessage());
  }
}
Program: 184234
Project: 184234
Buggy source:
public Map<String,Object> initGroovyContext(){
  if (groovyContext == null) {
    groovyContext=new Hashtable<String,Object>();
    ProcessbaseApplication application=ProcessbaseApplication.getCurrent();
    groovyContext.put("String_Node_Str",application);
    groovyContext.put("String_Node_Str",application.getUserName());
  }
  return groovyContext;
}

Fixed version (ground truth):
public Map<String,Object> initGroovyContext(){
  groovyContext=new HashMap<String,Object>();
  ProcessbaseApplication application=ProcessbaseApplication.getCurrent();
  groovyContext.put("String_Node_Str",application);
  groovyContext.put("String_Node_Str",application.getUserName());
  for (  Entry<String,Object> pvar : processVariables.entrySet()) {
    Object value=pvar.getValue();
    groovyContext.put(pvar.getKey(),value);
  }
  return groovyContext;
}
Program: 184235
Project: 184235
Buggy source:
private void initProcessVariables(){
  try {
    if (this.getTaskInstance() != null) {
      processDataFields=getBpmModule().getProcessDataFields(this.getTaskInstance().getProcessDefinitionUUID());
      processVariables=getBpmModule().getProcessInstanceVariables(this.getTaskInstance().getProcessInstanceUUID());
    }
 else {
      processDataFields=getBpmModule().getProcessDataFields(processDefinitionUUID);
    }
    initGroovyContext();
    label=process.getProcessLabel();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
void initProcessVariables(){
  try {
    if (this.getTaskInstance() != null) {
      processDataFields=getBpmModule().getProcessDataFields(this.getTaskInstance().getProcessDefinitionUUID());
      processVariables=getBpmModule().getProcessInstanceVariables(this.getTaskInstance().getProcessInstanceUUID());
    }
 else {
      processDataFields=getBpmModule().getProcessDataFields(processDefinitionUUID);
    }
    initGroovyContext();
    label=process.getProcessLabel();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}
Program: 184236
Project: 184236
Buggy source:
private void defineAccess() throws Exception {
  accessSet=new HashSet<String>();
  String userName=ProcessbaseApplication.getCurrent().getUserName();
  BPMModule bpmModule=ProcessbaseApplication.getCurrent().getBpmModule();
  user=bpmModule.findUserByUserName(userName);
  if (userName.equals(BPMModule.USER_GUEST)) {
    accessSet.add("String_Node_Str");
    return;
  }
  for (  Membership membership : user.getMemberships()) {
    if (membership.getRole().getName().equals(IdentityAPI.ADMIN_ROLE_NAME)) {
      if (membership.getGroup().getName().equalsIgnoreCase("String_Node_Str")) {
        accessSet.add("String_Node_Str");
      }
 else       if (membership.getGroup().getName().equalsIgnoreCase("String_Node_Str")) {
        accessSet.add("String_Node_Str");
      }
 else       if (membership.getGroup().getName().equalsIgnoreCase("String_Node_Str")) {
        accessSet.add("String_Node_Str");
      }
 else       if (membership.getGroup().getName().equalsIgnoreCase("String_Node_Str")) {
        accessSet.add("String_Node_Str");
      }
 else       if (membership.getGroup().getName().equalsIgnoreCase("String_Node_Str")) {
        accessSet.add("String_Node_Str");
      }
    }
  }
  if (bpmModule.isUserAdmin()) {
    accessSet.add("String_Node_Str");
    accessSet.add("String_Node_Str");
    accessSet.add("String_Node_Str");
    accessSet.add("String_Node_Str");
    accessSet.add("String_Node_Str");
  }
  accessSet.add("String_Node_Str");
}

Fixed version (ground truth):
private void defineAccess() throws Exception {
  accessSet=new HashSet<String>();
  String userName=ProcessbaseApplication.getCurrent().getUserName();
  BPMModule bpmModule=ProcessbaseApplication.getCurrent().getBpmModule();
  user=bpmModule.findUserByUserName(userName);
  if (userName.equals(BPMModule.USER_GUEST)) {
    accessSet.add("String_Node_Str");
    return;
  }
  for (  Membership membership : user.getMemberships()) {
    if (membership.getRole().getName().equals(IdentityAPI.ADMIN_ROLE_NAME)) {
      if (membership.getGroup().getName().equalsIgnoreCase("String_Node_Str")) {
        accessSet.add("String_Node_Str");
      }
 else       if (membership.getGroup().getName().equalsIgnoreCase("String_Node_Str")) {
        accessSet.add("String_Node_Str");
      }
 else       if (membership.getGroup().getName().equalsIgnoreCase("String_Node_Str")) {
        accessSet.add("String_Node_Str");
      }
 else       if (membership.getGroup().getName().equalsIgnoreCase("String_Node_Str")) {
        accessSet.add("String_Node_Str");
      }
 else       if (membership.getGroup().getName().equalsIgnoreCase("String_Node_Str")) {
        accessSet.add("String_Node_Str");
      }
    }
  }
  if (bpmModule.isUserAdmin() || "String_Node_Str".equals(userName)) {
    accessSet.add("String_Node_Str");
    accessSet.add("String_Node_Str");
    accessSet.add("String_Node_Str");
    accessSet.add("String_Node_Str");
    accessSet.add("String_Node_Str");
  }
  accessSet.add("String_Node_Str");
}
Program: 184237
Project: 184237
Buggy source:
protected void finishProcess(){
  if (processManagerStack.size() > 0) {
    ProcessManager pm=processManagerStack.pop();
    setContent(pm);
    pm.reloadTask();
    pm.setWindow(this);
    setCaption(pm.getLabel());
    processManager=pm;
  }
 else {
    this.getParent().showNotification("String_Node_Str");
    this.close();
  }
}

Fixed version (ground truth):
protected void finishProcess(){
  if (processManagerStack.size() > 0) {
    ProcessManager pm=processManagerStack.pop();
    setContent(pm);
    pm.reloadTask();
    pm.setWindow(this);
    setCaption(pm.getLabel());
    processManager=pm;
  }
 else {
    if (processManager != null && processManager.getTaskManager() != null && StringUtils.isNotBlank(processManager.getTaskManager().getConfirmationMessage()))     this.getParent().showNotification(processManager.getTaskManager().getConfirmationMessage());
 else     this.getParent().showNotification("String_Node_Str");
    this.close();
  }
}
Program: 184238
Project: 184238
Buggy source:
public void reloadTask(){
  try {
    TaskInstance nextTask=bpmModule.nextUserTask(getProcessInstanceUUID(),ProcessbaseApplication.getCurrent().getUserName());
    if (nextTask != null) {
      openTask(nextTask);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void reloadTask(){
  try {
    TaskInstance nextTask=bpmModule.nextUserTask(getProcessInstanceUUID(),ProcessbaseApplication.getCurrent().getUserName());
    if (nextTask != null) {
      openTask(nextTask);
      return;
    }
    if (actions != null)     actions.onFinishProcess(processDefinitionUUID);
    return;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 184239
Project: 184239
Buggy source:
private ImmediateUpload getUpload(String fileName){
  ImmediateUpload component=null;
  String processUUID=null;
  boolean hasFile=false;
  ProcessManager processManager=taskManager.getProcessManager();
  if (processManager.getTaskInstance() != null) {
    processUUID=processManager.getTaskInstance().getProcessInstanceUUID().toString();
    try {
      AttachmentInstance attachment=processManager.getBpmModule().getAttachment(processUUID,widget.getVariableBound());
      fileName=attachment.getFileName();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    if (fileName != null) {
      hasFile=true;
    }
  }
  component=new ImmediateUpload(processUUID,widget.getLabel(),widget.getInitialValue().getExpression(),fileName,hasFile,widget.isReadonly(),ProcessbaseApplication.getCurrent().getPbMessages());
  return component;
}

Fixed version (ground truth):
private ImmediateUpload getUpload(String fileName){
  ImmediateUpload component=null;
  String processUUID=null;
  boolean hasFile=false;
  String boundVariable=widget.getVariableBound();
  ProcessManager processManager=taskManager.getProcessManager();
  if (processManager.getTaskInstance() != null) {
    processUUID=processManager.getTaskInstance().getProcessInstanceUUID().toString();
    try {
      AttachmentInstance attachment=processManager.getBpmModule().getAttachment(processUUID,boundVariable);
      fileName=attachment.getFileName();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    if (fileName != null) {
      hasFile=true;
    }
  }
  String expression="String_Node_Str";
  if (widget.getInitialValue() != null)   expression=widget.getInitialValue().getExpression();
  component=new ImmediateUpload(processUUID,widget.getLabel(),boundVariable,fileName,hasFile,widget.isReadonly(),ProcessbaseApplication.getCurrent().getPbMessages());
  return component;
}
Program: 184240
Project: 184240
Buggy source:
public Object getComponentValue(){
  if (component != null) {
    if (component instanceof AbstractField) {
      return ((AbstractField)component).getValue();
    }
 else     if (component instanceof GeneratedTable) {
      return ((GeneratedTable)component).getTableValue();
    }
 else     if (component instanceof CheckBox) {
      return ((CheckBox)component).booleanValue();
    }
 else {
    }
  }
  if (widget == null) {
    return null;
  }
  return null;
}

Fixed version (ground truth):
public Object getComponentValue(Action action){
  if (component != null) {
    if (component instanceof CheckBox) {
      return ((CheckBox)component).booleanValue();
    }
 else     if (component instanceof Button) {
      return action.getExpression();
    }
 else     if (component instanceof AbstractField) {
      return ((AbstractField)component).getValue();
    }
 else     if (component instanceof GeneratedTable) {
      return ((GeneratedTable)component).getTableValue();
    }
 else {
    }
  }
  if (widget == null) {
    return null;
  }
  return null;
}
Program: 184241
Project: 184241
Buggy source:
public void onTaskFieldButtonClick(TaskField field,ClickEvent event) throws Exception {
  if (field.getWidget().getType() == WidgetType.BUTTON_SUBMIT) {
    if (actions != null) {
      for (      Action action : actions) {
        if (action.getSubmitButton() != null && action.getSubmitButton().equalsIgnoreCase(field.getName())) {
          field.addAction(action);
        }
      }
    }
    onFinishTask();
  }
}

Fixed version (ground truth):
public void onTaskFieldButtonClick(TaskField field,ClickEvent event) throws Exception {
  if (field.getWidget().getType() == WidgetType.BUTTON_SUBMIT) {
    if (actions != null) {
      for (      Action action : actions) {
        if (action.getSubmitButton() != null && action.getSubmitButton().equalsIgnoreCase(field.getName())) {
          field.addAction(action);
        }
      }
    }
    try {
      onFinishTask();
    }
 catch (    Validator.InvalidValueException e) {
      getProcessManager().getWindow().showError(e.getMessage());
    }
  }
}
Program: 184243
Project: 184243
Buggy source:
public Set<LightProcessDefinition> getAllowedLightProcessDefinitions(Group groupFilter) throws Exception {
  logger.debug("String_Node_Str");
  initContext();
  User user=getIdentityAPI().findUserByUserName(currentUserUID);
  Set<String> membershipUUIDs=new HashSet<String>();
  for (  Membership membership : user.getMemberships()) {
    if (groupFilter == null)     membershipUUIDs.add(membership.getUUID());
 else     if (membership.getGroup().getName().equals(groupFilter.getName()))     membershipUUIDs.add(membership.getUUID());
  }
  List<Rule> userRules=getManagementAPI().getApplicableRules(RuleType.PROCESS_START,null,null,null,membershipUUIDs,null);
  Set<String> processException;
  Set<ProcessDefinitionUUID> processUUIDException=new HashSet<ProcessDefinitionUUID>();
  for (  Rule r : userRules) {
    processException=r.getEntities();
    for (    String processID : processException) {
      processUUIDException.add(new ProcessDefinitionUUID(processID));
    }
  }
  Set<LightProcessDefinition> result=new HashSet<LightProcessDefinition>();
  for (  LightProcessDefinition lpd : getQueryDefinitionAPI().getLightProcesses(processUUIDException)) {
    if (lpd.getState().equals(ProcessState.ENABLED)) {
      result.add(lpd);
    }
  }
  return result;
}

Fixed version (ground truth):
public Set<LightProcessDefinition> getAllowedLightProcessDefinitions(Group groupFilter) throws Exception {
  logger.debug("String_Node_Str");
  initContext();
  User user=getIdentityAPI().findUserByUserName(currentUserUID);
  Set<String> membershipUUIDs=new HashSet<String>();
  if (groupFilter == null) {
    return getQueryDefinitionAPI().getLightProcesses(ProcessState.ENABLED);
  }
  for (  Membership membership : user.getMemberships()) {
    if (groupFilter == null)     membershipUUIDs.add(membership.getUUID());
 else     if (membership.getGroup().getName().equals(groupFilter.getName()))     membershipUUIDs.add(membership.getUUID());
  }
  List<Rule> userRules=getManagementAPI().getApplicableRules(RuleType.PROCESS_START,null,null,null,membershipUUIDs,null);
  Set<String> processException;
  Set<ProcessDefinitionUUID> processUUIDException=new HashSet<ProcessDefinitionUUID>();
  for (  Rule r : userRules) {
    processException=r.getEntities();
    for (    String processID : processException) {
      processUUIDException.add(new ProcessDefinitionUUID(processID));
    }
  }
  Set<LightProcessDefinition> result=new HashSet<LightProcessDefinition>();
  for (  LightProcessDefinition lpd : getQueryDefinitionAPI().getLightProcesses(processUUIDException)) {
    if (lpd.getState().equals(ProcessState.ENABLED)) {
      result.add(lpd);
    }
  }
  return result;
}