nus-yam/ex-repair huggingface dataset:
Program: 55937
Project: 55937
Buggy source:
private void calculateForPosition(ShortPoint2D position){
  short x=position.x;
  short y=position.y;
  byte player=grid.getPlayerIdAt(x,y);
  boolean isBorder=false;
  if (grid.getBlockedPartition(x,y) > 0) {
    for (    EDirection currDir : EDirection.values) {
      short currNeighborX=currDir.getNextTileX(x);
      short currNeighborY=currDir.getNextTileY(y);
      if (!grid.isInBounds(currNeighborX,currNeighborY)) {
        continue;
      }
      byte neighborPlayer=grid.getPlayerIdAt(currNeighborX,currNeighborY);
      boolean neighborIsBorder=false;
      if (neighborPlayer != player && grid.getBlockedPartition(currNeighborX,currNeighborY) > 0) {
        isBorder=true;
      }
      if (neighborPlayer >= 0) {
        for (        EDirection currNeighborDir : EDirection.values) {
          short nextX=currNeighborDir.getNextTileX(currNeighborX);
          short nextY=currNeighborDir.getNextTileY(currNeighborY);
          if (grid.isInBounds(nextX,nextY) && grid.getPlayerIdAt(nextX,nextY) != neighborPlayer && grid.getBlockedPartition(nextX,nextY) > 0) {
            neighborIsBorder=true;
            break;
          }
        }
      }
      grid.setBorderAt(currNeighborX,currNeighborY,neighborIsBorder);
    }
  }
  grid.setBorderAt(x,y,isBorder && player >= 0);
}

Fixed version (ground truth):
private void calculateForPosition(ShortPoint2D position){
  short x=position.x;
  short y=position.y;
  byte player=grid.getPlayerIdAt(x,y);
  boolean isBorder=false;
  if (grid.getBlockedPartition(x,y) > 0) {
    for (    EDirection currDir : EDirection.values) {
      short currNeighborX=currDir.getNextTileX(x);
      short currNeighborY=currDir.getNextTileY(y);
      if (!grid.isInBounds(currNeighborX,currNeighborY)) {
        continue;
      }
      byte neighborPlayer=grid.getPlayerIdAt(currNeighborX,currNeighborY);
      boolean neighborIsBorder=false;
      if (neighborPlayer != player) {
        isBorder=true;
      }
      if (grid.getBlockedPartition(currNeighborX,currNeighborY) <= 0) {
        continue;
      }
      if (neighborPlayer >= 0) {
        for (        EDirection currNeighborDir : EDirection.values) {
          short nextX=currNeighborDir.getNextTileX(currNeighborX);
          short nextY=currNeighborDir.getNextTileY(currNeighborY);
          if (grid.isInBounds(nextX,nextY) && grid.getPlayerIdAt(nextX,nextY) != neighborPlayer && grid.getBlockedPartition(nextX,nextY) > 0) {
            neighborIsBorder=true;
            break;
          }
        }
      }
      grid.setBorderAt(currNeighborX,currNeighborY,neighborIsBorder);
    }
  }
  grid.setBorderAt(x,y,isBorder && player >= 0);
}
Program: 55939
Project: 55939
Buggy source:
private void pathingAction(){
  if (!path.hasNextStep() || !strategy.checkPathStepPreconditions(path.getTargetPos(),path.getStep())) {
    setState(EMovableState.DOING_NOTHING);
    movableAction=EAction.NO_ACTION;
    path=null;
    checkPlayerOfCurrentPosition();
    return;
  }
  direction=EDirection.getDirection(position.x,position.y,path.nextX(),path.nextY());
  Movable blockingMovable=grid.getMovableAt(path.nextX(),path.nextY());
  if (blockingMovable == null) {
    if (grid.isValidNextPathPosition(this,path.getNextPos(),path.getTargetPos())) {
      goSinglePathStep();
    }
 else {
      animationDuration=Constants.MOVABLE_INTERRUPT_PERIOD;
      Path newPath=grid.calculatePathTo(this,path.getTargetPos());
      if (newPath == null) {
        setState(EMovableState.DOING_NOTHING);
        movableAction=EAction.NO_ACTION;
        strategy.pathAborted(path.getTargetPos());
        path=null;
      }
 else {
        this.path=newPath;
      }
    }
  }
 else {
    movableAction=EAction.NO_ACTION;
    boolean pushedSuccessful=blockingMovable.push(this);
    if (!pushedSuccessful) {
      path=strategy.findWayAroundObstacle(direction,position,path);
      animationDuration=Constants.MOVABLE_INTERRUPT_PERIOD;
    }
 else     if (movableAction == EAction.NO_ACTION) {
      animationDuration=Constants.MOVABLE_INTERRUPT_PERIOD;
    }
  }
}

Fixed version (ground truth):
private void pathingAction(){
  if (!path.hasNextStep() || !strategy.checkPathStepPreconditions(path.getTargetPos(),path.getStep())) {
    setState(EMovableState.DOING_NOTHING);
    movableAction=EAction.NO_ACTION;
    path=null;
    checkPlayerOfCurrentPosition();
    return;
  }
  direction=EDirection.getDirection(position.x,position.y,path.nextX(),path.nextY());
  Movable blockingMovable=grid.getMovableAt(path.nextX(),path.nextY());
  if (blockingMovable == null) {
    if (grid.isValidNextPathPosition(this,path.getNextPos(),path.getTargetPos())) {
      goSinglePathStep();
    }
 else {
      animationDuration=Constants.MOVABLE_INTERRUPT_PERIOD;
      Path newPath=grid.calculatePathTo(this,path.getTargetPos());
      if (newPath == null) {
        setState(EMovableState.DOING_NOTHING);
        movableAction=EAction.NO_ACTION;
        strategy.pathAborted(path.getTargetPos());
        path=null;
      }
 else {
        this.path=newPath;
        if (grid.hasNoMovableAt(path.nextX(),path.nextY())) {
          goSinglePathStep();
        }
      }
    }
  }
 else {
    movableAction=EAction.NO_ACTION;
    boolean pushedSuccessful=blockingMovable.push(this);
    if (!pushedSuccessful) {
      path=strategy.findWayAroundObstacle(direction,position,path);
      animationDuration=Constants.MOVABLE_INTERRUPT_PERIOD;
    }
 else     if (movableAction == EAction.NO_ACTION) {
      animationDuration=Constants.MOVABLE_INTERRUPT_PERIOD;
    }
  }
}
Program: 55940
Project: 55940
Buggy source:
@Override public void listMaps(IMapListerCallable callable){
  try {
    for (    String s : manager.list(prefix)) {
      if (s.endsWith(MapList.MAP_EXTENSION)) {
        callable.foundMap(new AndroidAssetMap(manager,prefix + "String_Node_Str" + s));
      }
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void listMaps(IMapListerCallable callable){
  try {
    for (    String s : manager.list(prefix)) {
      if (s.endsWith(MapLoader.MAP_EXTENSION)) {
        callable.foundMap(new AndroidAssetMap(manager,prefix + "String_Node_Str" + s));
      }
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 55941
Project: 55941
Buggy source:
@Override public boolean isCompressed(){
  return path.endsWith(MapList.COMPRESSED_MAP_EXTENSION);
}

Fixed version (ground truth):
@Override public boolean isCompressed(){
  return path.endsWith(MapLoader.MAP_EXTENSION_COMPRESSED);
}
Program: 55942
Project: 55942
Buggy source:
@Override public void write(int b) throws IOException {
  byteCounter++;
  if (byteCounter >= 4233202 && byteCounter <= 4233212) {
    System.out.println();
  }
  outputStream.write(b);
}

Fixed version (ground truth):
@Override public void write(int b) throws IOException {
  byteCounter++;
  if (byteCounter >= 4233202 && byteCounter <= 4233212) {
  }
  outputStream.write(b);
}
Program: 55943
Project: 55943
Buggy source:
private void checkMergesAndDividesOnPartitionsList(byte playerId,final short innerPartition,LinkedList<Tuple<Short,ShortPoint2D>> partitionsList){
  if (partitionsList.isEmpty()) {
    return;
  }
  HashMap<Short,ShortPoint2D> foundPartitionsSet=new HashMap<Short,ShortPoint2D>();
  for (  Tuple<Short,ShortPoint2D> currPartition : partitionsList) {
    ShortPoint2D existingPartitionPos=foundPartitionsSet.get(currPartition.e1);
    if (existingPartitionPos != null) {
      checkIfDividePartition(currPartition.e1,currPartition.e2,existingPartitionPos);
    }
 else {
      foundPartitionsSet.put(currPartition.e1,currPartition.e2);
    }
  }
  partitionsList.addLast(partitionsList.getFirst());
  for (  Tuple<Short,ShortPoint2D> currPartition : partitionsList) {
    Partition currPartitionObject=partitionObjects[currPartition.e1];
    if (currPartitionObject.playerId == playerId && partitionObjects[currPartition.e1] != partitionObjects[innerPartition]) {
      mergePartitions(currPartition.e1,innerPartition);
    }
  }
}

Fixed version (ground truth):
private void checkMergesAndDividesOnPartitionsList(byte playerId,final short innerPartition,LinkedList<Tuple<Short,ShortPoint2D>> partitionsList){
  if (partitionsList.isEmpty()) {
    return;
  }
  HashMap<Short,ShortPoint2D> foundPartitionsSet=new HashMap<Short,ShortPoint2D>();
  for (  Tuple<Short,ShortPoint2D> currPartition : partitionsList) {
    Short currPartitionId=currPartition.e1;
    ShortPoint2D existingPartitionPos=foundPartitionsSet.get(currPartitionId);
    if (existingPartitionPos != null) {
      checkIfDividePartition(currPartitionId,currPartition.e2,existingPartitionPos);
      if (getPartitionIdAt(existingPartitionPos.x,existingPartitionPos.y) != currPartitionId) {
        foundPartitionsSet.put(currPartitionId,currPartition.e2);
      }
    }
 else {
      foundPartitionsSet.put(currPartitionId,currPartition.e2);
    }
  }
  partitionsList.addLast(partitionsList.getFirst());
  for (  Tuple<Short,ShortPoint2D> currPartition : partitionsList) {
    Partition currPartitionObject=partitionObjects[currPartition.e1];
    if (currPartitionObject.playerId == playerId && partitionObjects[currPartition.e1] != partitionObjects[innerPartition]) {
      mergePartitions(currPartition.e1,innerPartition);
    }
  }
}
Program: 55944
Project: 55944
Buggy source:
/** 
 * Converts this movable to a movable of the given   {@link EMovableType}.
 * @param newMovableType
 */
public final void convertTo(EMovableType newMovableType){
  if (newMovableType == EMovableType.BEARER && !player.equals(grid.getPlayerAt(position))) {
    return;
  }
  this.movableType=newMovableType;
  setStrategy(MovableStrategy.getStrategy(this,newMovableType));
}

Fixed version (ground truth):
/** 
 * Converts this movable to a movable of the given   {@link EMovableType}.
 * @param newMovableType
 */
public final void convertTo(EMovableType newMovableType){
  if (newMovableType == EMovableType.BEARER && !player.equals(grid.getPlayerAt(position))) {
    return;
  }
  if (newMovableType == EMovableType.PIKEMAN_L1) {
    System.out.println();
  }
  this.health=(this.health * newMovableType.getHealth()) / this.movableType.getHealth();
  this.movableType=newMovableType;
  setStrategy(MovableStrategy.getStrategy(this,newMovableType));
}
Program: 55945
Project: 55945
Buggy source:
public OriginalMapLoader(IListedMap listedMap) throws IOException {
  this.listedMap=listedMap;
  fileName=listedMap.getFileName();
  creationDate=new Date(new File(fileName).lastModified());
  mapContent=new OriginalMapFileContentReader(listedMap.getInputStream());
  if (!mapContent.isChecksumValid()) {
    System.out.println("String_Node_Str");
    return;
  }
  mapContent.loadMapResources();
  mapContent.readBasicMapInformation();
}

Fixed version (ground truth):
public OriginalMapLoader(IListedMap listedMap) throws IOException {
  this.listedMap=listedMap;
  fileName=listedMap.getFileName();
  creationDate=new Date(new File(fileName).lastModified());
  mapContent=new OriginalMapFileContentReader(listedMap.getInputStream());
  if (!mapContent.isChecksumValid()) {
    System.out.println("String_Node_Str");
    return;
  }
  mapContent.loadMapResources();
  mapContent.readBasicMapInformation();
  mapContent.FreeBuffer();
}
Program: 55946
Project: 55946
Buggy source:
@Override public MainGridWithUiSettings loadMainGrid(PlayerSetting[] playerSettings) throws MapLoadException {
  MilliStopWatch watch=new MilliStopWatch();
  mapContent.readMapData();
  mapContent.readStacks();
  mapContent.readSettlers();
  mapContent.readBuildings();
  mapContent.addStartTowerMaterialsAndSettlers();
  OriginalMapFileContent MapData=mapContent.mapData;
  watch.stop("String_Node_Str");
  byte numberOfPlayers=(byte)getMaxPlayers();
  if (playerSettings == null || CommonConstants.ACTIVATE_ALL_PLAYERS) {
    playerSettings=new PlayerSetting[numberOfPlayers];
    for (int i=0; i < numberOfPlayers; i++) {
      playerSettings[i]=new PlayerSetting(true,null);
    }
  }
  MainGrid mainGrid=new MainGrid(getMapId(),getMapName(),MapData,playerSettings);
  PlayerState[] playerStates=new PlayerState[numberOfPlayers];
  for (byte playerId=0; playerId < numberOfPlayers; playerId++) {
    playerStates[playerId]=new PlayerState(playerId,new UIState(MapData.getStartPoint(playerId)));
  }
  return new MainGridWithUiSettings(mainGrid,playerStates);
}

Fixed version (ground truth):
@Override public MainGridWithUiSettings loadMainGrid(PlayerSetting[] playerSettings) throws MapLoadException {
  MilliStopWatch watch=new MilliStopWatch();
  try {
    mapContent.reOpen(this.listedMap.getInputStream());
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
  mapContent.loadMapResources();
  mapContent.readBasicMapInformation();
  mapContent.readMapData();
  mapContent.readStacks();
  mapContent.readSettlers();
  mapContent.readBuildings();
  mapContent.addStartTowerMaterialsAndSettlers();
  OriginalMapFileContent MapData=mapContent.mapData;
  watch.stop("String_Node_Str");
  byte numberOfPlayers=(byte)getMaxPlayers();
  if (playerSettings == null || CommonConstants.ACTIVATE_ALL_PLAYERS) {
    playerSettings=new PlayerSetting[numberOfPlayers];
    for (int i=0; i < numberOfPlayers; i++) {
      playerSettings[i]=new PlayerSetting(true,null);
    }
  }
  MainGrid mainGrid=new MainGrid(getMapId(),getMapName(),MapData,playerSettings);
  PlayerState[] playerStates=new PlayerState[numberOfPlayers];
  for (byte playerId=0; playerId < numberOfPlayers; playerId++) {
    playerStates[playerId]=new PlayerState(playerId,new UIState(MapData.getStartPoint(playerId)));
  }
  return new MainGridWithUiSettings(mainGrid,playerStates);
}
Program: 55948
Project: 55948
Buggy source:
boolean isChecksumValid(){
  long fileChecksum=readBytesFrom(4,0);
  System.out.println(fileChecksum);
  int count=mapContent.length - 8;
  int currentChecksum=0;
  for (int i=8; i < count; i+=4) {
    long currentInt=readBytesFrom(4,i);
    currentChecksum=(int)((currentChecksum * 2) ^ currentInt);
    if (i < 40) {
      System.out.println(i + "String_Node_Str" + currentInt+ "String_Node_Str"+ currentChecksum);
    }
    if (currentChecksum == fileChecksum) {
      System.out.println("String_Node_Str" + i);
    }
  }
  if (currentChecksum != fileChecksum) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
boolean isChecksumValid(){
  long fileChecksum=readBEIntFrom(4,0);
  System.out.println(fileChecksum);
  int count=mapContent.length;
  int currentChecksum=0;
  for (int i=8; i < count; i+=4) {
    int currentInt=readBEIntFrom(4,i);
    currentChecksum=((currentChecksum >>> 31) | ((currentChecksum << 1) ^ currentInt));
  }
  if (currentChecksum != fileChecksum) {
    return false;
  }
  return true;
}
Program: 55949
Project: 55949
Buggy source:
public static void replayAndCreateSavegame(File replayFile,int targetGameTimeMs,String newReplayFile) throws IOException {
  OfflineNetworkConnector networkConnector=new OfflineNetworkConnector();
  networkConnector.getGameClock().setPausing(true);
  ReplayStartInformation replayStartInformation=new ReplayStartInformation();
  JSettlersGame game=loadGameFromReplay(replayFile,networkConnector,replayStartInformation);
  IStartingGame startingGame=game.start();
  IStartedGame startedGame=waitForGameStartup(startingGame);
  networkConnector.scheduleTaskAt(targetGameTimeMs / NetworkConstants.Client.LOCKSTEP_PERIOD,new SimpleGuiTask(EGuiAction.QUICK_SAVE,(byte)0));
  MatchConstants.clock.fastForwardTo(targetGameTimeMs);
  MapLoader newSavegame=MapList.getDefaultList().getSavedMaps().getItems().get(0);
  createReplayOfRemainingTasks(newSavegame,replayStartInformation,newReplayFile);
  awaitShutdown(startedGame);
}

Fixed version (ground truth):
public static void replayAndCreateSavegame(File replayFile,int targetGameTimeMs,String newReplayFile) throws IOException {
  OfflineNetworkConnector networkConnector=new OfflineNetworkConnector();
  networkConnector.getGameClock().setPausing(true);
  ReplayStartInformation replayStartInformation=new ReplayStartInformation();
  JSettlersGame game=loadGameFromReplay(replayFile,networkConnector,replayStartInformation);
  IStartingGame startingGame=game.start();
  IStartedGame startedGame=waitForGameStartup(startingGame);
  networkConnector.scheduleTaskAt(targetGameTimeMs / NetworkConstants.Client.LOCKSTEP_PERIOD,new SimpleGuiTask(EGuiAction.QUICK_SAVE,(byte)0));
  MatchConstants.clock.fastForwardTo(targetGameTimeMs);
  MapLoader newSavegame=getNewestSavegame();
  createReplayOfRemainingTasks(newSavegame,replayStartInformation,newReplayFile);
  awaitShutdown(startedGame);
}
Program: 55950
Project: 55950
Buggy source:
private static void createReplayOfRemainingTasks(MapLoader newSavegame,ReplayStartInformation replayStartInformation,String newReplayFile) throws IOException {
  System.out.println("String_Node_Str" + newReplayFile + "String_Node_Str");
  new File(newReplayFile).getParentFile().mkdirs();
  ReplayStartInformation replayInfo=new ReplayStartInformation(0,newSavegame.getMapName(),newSavegame.getMapId(),replayStartInformation.getPlayerId(),replayStartInformation.getPlayerSettings());
  DataOutputStream dos=new DataOutputStream(new FileOutputStream(newReplayFile));
  replayInfo.serialize(dos);
  MatchConstants.clock.saveRemainingTasks(dos);
  dos.close();
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
private static void createReplayOfRemainingTasks(MapLoader newSavegame,ReplayStartInformation replayStartInformation,String newReplayFile) throws IOException {
  System.out.println("String_Node_Str" + newReplayFile + "String_Node_Str");
  new File(newReplayFile).getAbsoluteFile().getParentFile().mkdirs();
  ReplayStartInformation replayInfo=new ReplayStartInformation(0,newSavegame.getMapName(),newSavegame.getMapId(),replayStartInformation.getPlayerId(),replayStartInformation.getPlayerSettings());
  DataOutputStream dos=new DataOutputStream(new FileOutputStream(newReplayFile));
  replayInfo.serialize(dos);
  MatchConstants.clock.saveRemainingTasks(dos);
  dos.close();
  System.out.println("String_Node_Str");
}
Program: 55951
Project: 55951
Buggy source:
private void pathingAction(){
  if (!path.hasNextStep() || !strategy.checkPathStepPreconditions(path.getTargetPos(),path.getStep())) {
    setState(EMovableState.DOING_NOTHING);
    movableAction=EAction.NO_ACTION;
    path=null;
    checkPlayerOfCurrentPosition();
    return;
  }
  direction=EDirection.getDirection(position.x,position.y,path.nextX(),path.nextY());
  if (grid.hasNoMovableAt(path.nextX(),path.nextY())) {
    if (!grid.isValidNextPathPosition(this,path.getNextPos(),path.getTargetPos())) {
      Path newPath=grid.calculatePathTo(this,path.getTargetPos());
      if (newPath == null) {
        setState(EMovableState.DOING_NOTHING);
        movableAction=EAction.NO_ACTION;
        strategy.pathAborted(path.getTargetPos());
        path=null;
        return;
      }
 else {
        this.path=newPath;
      }
    }
    goSinglePathStep();
  }
 else {
    movableAction=EAction.NO_ACTION;
    boolean pushedSuccessful=grid.getMovableAt(path.nextX(),path.nextY()).push(this);
    if (!pushedSuccessful) {
      path=strategy.findWayAroundObstacle(direction,position,path);
    }
 else     if (movableAction == EAction.NO_ACTION) {
      animationDuration=Constants.MOVABLE_INTERRUPT_PERIOD;
    }
  }
}

Fixed version (ground truth):
private void pathingAction(){
  if (!path.hasNextStep() || !strategy.checkPathStepPreconditions(path.getTargetPos(),path.getStep())) {
    setState(EMovableState.DOING_NOTHING);
    movableAction=EAction.NO_ACTION;
    path=null;
    checkPlayerOfCurrentPosition();
    return;
  }
  direction=EDirection.getDirection(position.x,position.y,path.nextX(),path.nextY());
  Movable blockingMovable=grid.getMovableAt(path.nextX(),path.nextY());
  if (blockingMovable == null) {
    if (!grid.isValidNextPathPosition(this,path.getNextPos(),path.getTargetPos())) {
      Path newPath=grid.calculatePathTo(this,path.getTargetPos());
      if (newPath == null) {
        setState(EMovableState.DOING_NOTHING);
        movableAction=EAction.NO_ACTION;
        strategy.pathAborted(path.getTargetPos());
        path=null;
        return;
      }
 else {
        this.path=newPath;
      }
    }
    goSinglePathStep();
  }
 else {
    movableAction=EAction.NO_ACTION;
    boolean pushedSuccessful=blockingMovable.push(this);
    if (!pushedSuccessful) {
      path=strategy.findWayAroundObstacle(direction,position,path);
      animationDuration=Constants.MOVABLE_INTERRUPT_PERIOD;
    }
 else     if (movableAction == EAction.NO_ACTION) {
      animationDuration=Constants.MOVABLE_INTERRUPT_PERIOD;
    }
  }
}
Program: 55952
Project: 55952
Buggy source:
public static void main(String[] args) throws FileNotFoundException, IOException {
  new BuildingCreatorApp(MainUtils.createArgumentsMap(args));
}

Fixed version (ground truth):
public static void main(String[] args) throws FileNotFoundException, IOException, InvocationTargetException, InterruptedException {
  SwingUtilities.invokeAndWait(new BuildingCreatorApp(MainUtils.createArgumentsMap(args)));
}
Program: 55953
Project: 55953
Buggy source:
@Override public void action(Action action){
  if (action instanceof PointAction) {
    PointAction sAction=(PointAction)action;
    ShortPoint2D pos=sAction.getPosition();
    RelativePoint relative=absoluteToRelative(pos);
    positionDisplayer.setText("String_Node_Str" + (pos.x - BuildingtestMap.OFFSET) + "String_Node_Str"+ (pos.y - BuildingtestMap.OFFSET));
switch (tool) {
case SET_BLOCKED:
      toogleUsedTile(relative);
    break;
case SET_DOOR:
  setDoor(relative);
break;
case ADD_CONSTRUCTION_STACK:
addConstructionStack(relative);
break;
case ADD_REQUEST_STACK:
case ADD_OFFER_STACK:
addStack(relative,tool == ToolType.ADD_REQUEST_STACK);
break;
case REMOVE_STACK:
removeStack(relative);
break;
case SET_FLAG:
setFlag(relative);
break;
case SET_BUILDMARK:
definition.toggleBuildmarkStatus(relative);
break;
case BRICKLAYER_NE:
definition.toggleBrickayer(relative,EDirection.NORTH_EAST);
break;
case BRICKLAYER_NW:
definition.toggleBrickayer(relative,EDirection.NORTH_WEST);
break;
}
reloadColor(pos);
}
}

Fixed version (ground truth):
@Override public void action(final Action action){
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      doAction(action);
    }
  }
);
}
Program: 55954
Project: 55954
Buggy source:
private BuildingCreatorApp(HashMap<String,String> argsMap) throws FileNotFoundException, IOException {
  SwingManagedJSettlers.setupResourceManagers(argsMap,"String_Node_Str");
  EBuildingType type=askType();
  definition=new BuildingDefinition(type);
  map=new BuildingtestMap(definition);
  for (int x=0; x < map.getWidth(); x++) {
    for (int y=0; y < map.getHeight(); y++) {
      reloadColor(new ShortPoint2D(x,y));
    }
  }
  MapInterfaceConnector connector=startMapWindow();
  connector.addListener(this);
  JPanel menu=generateMenu();
  window=new JFrame("String_Node_Str" + type.toString());
  window.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
  window.add(menu);
  window.pack();
  window.setVisible(true);
  connector.fireAction(new Action(EActionType.TOGGLE_DEBUG));
}

Fixed version (ground truth):
private BuildingCreatorApp(HashMap<String,String> argsMap) throws FileNotFoundException, IOException {
  this.argsMap=argsMap;
  SwingManagedJSettlers.setupResourceManagers(argsMap,"String_Node_Str");
}
Program: 55955
Project: 55955
Buggy source:
private static float getGoldCombatStrength(byte numberOfPlayers,int amountOfGold){
  amountOfGold+=START_AMOUNT[numberOfPlayers - 1];
  if (amountOfGold <= BORDER_50_PERCENT) {
    return (amountOfGold / 12f) / 100f;
  }
 else   if (amountOfGold <= BORDER_85_PERCENT) {
    for (int i=COMBAT_STRENGTH_INCREASE.length; i >= 0; i--) {
      if (amountOfGold >= COMBAT_STRENGTH_INCREASE[i]) {
        return (51f + i) / 100f;
      }
    }
    return 0.5f;
  }
 else {
    return ((1700f + amountOfGold - BORDER_85_PERCENT) / 20f) / 100f;
  }
}

Fixed version (ground truth):
private static float getGoldCombatStrength(byte numberOfPlayers,int amountOfGold){
  amountOfGold+=START_AMOUNT[numberOfPlayers - 1];
  if (amountOfGold <= BORDER_50_PERCENT) {
    return (amountOfGold / 12f) / 100f;
  }
 else   if (amountOfGold <= BORDER_85_PERCENT) {
    for (int i=COMBAT_STRENGTH_INCREASE.length - 1; i >= 0; i--) {
      if (amountOfGold >= COMBAT_STRENGTH_INCREASE[i]) {
        return (51f + i) / 100f;
      }
    }
    return 0.5f;
  }
 else {
    return ((1700f + amountOfGold - BORDER_85_PERCENT) / 20f) / 100f;
  }
}
Program: 55956
Project: 55956
Buggy source:
private static float getGoldCombatStrength(byte numberOfPlayers,int amountOfGold){
  amountOfGold+=START_AMOUNT[numberOfPlayers - 1];
  if (amountOfGold <= BORDER_50_PERCENT) {
    return (amountOfGold / 12f) / 100f;
  }
  if (amountOfGold <= BORDER_85_PERCENT) {
    for (int i=COMBAT_STRENGTH_INCREASE.length; i >= 0; i--) {
      if (amountOfGold >= COMBAT_STRENGTH_INCREASE[i]) {
        return (51f + i) / 100f;
      }
      return 0.5f;
    }
  }
  return ((1700f + amountOfGold - BORDER_85_PERCENT) / 20f) / 100f;
}

Fixed version (ground truth):
private static float getGoldCombatStrength(byte numberOfPlayers,int amountOfGold){
  amountOfGold+=START_AMOUNT[numberOfPlayers - 1];
  if (amountOfGold <= BORDER_50_PERCENT) {
    return (amountOfGold / 12f) / 100f;
  }
 else   if (amountOfGold <= BORDER_85_PERCENT) {
    for (int i=COMBAT_STRENGTH_INCREASE.length; i >= 0; i--) {
      if (amountOfGold >= COMBAT_STRENGTH_INCREASE[i]) {
        return (51f + i) / 100f;
      }
    }
    return 0.5f;
  }
 else {
    return ((1700f + amountOfGold - BORDER_85_PERCENT) / 20f) / 100f;
  }
}
Program: 55957
Project: 55957
Buggy source:
public final RelativePoint[] getFlattenTiles(){
  return type.getProtectedTiles();
}

Fixed version (ground truth):
public final RelativePoint[] getFlattenTiles(){
  if (shouldBeFlatened()) {
    return type.getProtectedTiles();
  }
 else {
    return new RelativePoint[0];
  }
}
Program: 55958
Project: 55958
Buggy source:
@Override public final int hashCode(){
  return getDy() << 16 + getDx();
}

Fixed version (ground truth):
@Override public final int hashCode(){
  return (getDy() << 16) + getDx();
}
Program: 55959
Project: 55959
Buggy source:
public static void walkFileTree(File directory,IFileVisitor fileVisitor) throws IOException {
  for (  File file : directory.listFiles()) {
    fileVisitor.visitFile(file);
    if (file.isDirectory()) {
      walkFileTree(file,fileVisitor);
    }
  }
}

Fixed version (ground truth):
public static void walkFileTree(File directory,IFileVisitor fileVisitor) throws IOException {
  if (directory == null) {
    return;
  }
  File[] files=directory.listFiles();
  if (files == null) {
    return;
  }
  for (  File file : files) {
    fileVisitor.visitFile(file);
    if (file.isDirectory()) {
      walkFileTree(file,fileVisitor);
    }
  }
}
Program: 55960
Project: 55960
Buggy source:
@Override public final void requestFailed(EMovableType movableType){
  ESearchType searchType=getSearchType(movableType);
  currentlyCommingSoldiers[getSoldierClass(searchType).ordinal]--;
  if (searchType != null)   searchedSoldiers.add(searchType);
}

Fixed version (ground truth):
@Override public final void requestFailed(EMovableType movableType){
  ESearchType searchType=getSearchType(movableType);
  currentlyCommingSoldiers[getSoldierClass(searchType).ordinal]--;
  searchedSoldiers.add(searchType);
}
Program: 55962
Project: 55962
Buggy source:
public static void stop(){
  if (uniIns != null) {
    MatchConstants.clock.remove(uniIns);
    uniIns=null;
  }
}

Fixed version (ground truth):
public static synchronized void stop(){
  if (uniIns != null) {
    MatchConstants.clock.remove(uniIns);
    uniIns=null;
  }
}
Program: 55963
Project: 55963
Buggy source:
private static String getLogFile(IGameCreator mapcreator,String suffix){
  final String dateAndMap=logDateFormat.format(new Date()) + "String_Node_Str" + mapcreator.getMapName().replace("String_Node_Str","String_Node_Str");
  final String logFolder="String_Node_Str" + dateAndMap + "String_Node_Str";
  final String replayFilename=logFolder + dateAndMap + suffix;
  return replayFilename;
}

Fixed version (ground truth):
private static String getLogFile(IGameCreator mapcreator,String suffix){
  final String dateAndMap=getLogDateFormatter().format(new Date()) + "String_Node_Str" + mapcreator.getMapName().replace("String_Node_Str","String_Node_Str");
  final String logFolder="String_Node_Str" + dateAndMap + "String_Node_Str";
  final String replayFilename=logFolder + dateAndMap + suffix;
  return replayFilename;
}
Program: 55964
Project: 55964
Buggy source:
public IStartedGame waitForGameStartup(){
  while (startedGame == null) {
synchronized (waitMutex) {
      try {
        waitMutex.wait();
      }
 catch (      InterruptedException e) {
      }
    }
  }
  return startedGame;
}

Fixed version (ground truth):
public IStartedGame waitForGameStartup(){
synchronized (waitMutex) {
    while (startedGame == null) {
      try {
        waitMutex.wait();
      }
 catch (      InterruptedException e) {
      }
    }
  }
  return startedGame;
}
Program: 55965
Project: 55965
Buggy source:
private static void awaitShutdown(IStartedGame startedGame){
  final MutableInt gameStopped=new MutableInt(0);
  startedGame.setGameExitListener(new IGameExitListener(){
    @Override public void gameExited(    IStartedGame game){
      gameStopped.value=1;
synchronized (gameStopped) {
        gameStopped.notifyAll();
      }
    }
  }
);
  ((GameRunner)startedGame).stopGame();
  try {
    while (gameStopped.value == 0) {
synchronized (gameStopped) {
        gameStopped.wait();
      }
    }
  }
 catch (  InterruptedException e) {
  }
}

Fixed version (ground truth):
private static void awaitShutdown(IStartedGame startedGame){
  final MutableInt gameStopped=new MutableInt(0);
  startedGame.setGameExitListener(new IGameExitListener(){
    @Override public void gameExited(    IStartedGame game){
      gameStopped.value=1;
synchronized (gameStopped) {
        gameStopped.notifyAll();
      }
    }
  }
);
  ((GameRunner)startedGame).stopGame();
synchronized (gameStopped) {
    while (gameStopped.value == 0) {
      try {
        gameStopped.wait();
      }
 catch (      InterruptedException e) {
      }
    }
  }
}
Program: 55966
Project: 55966
Buggy source:
/** 
 * Applys a map delta. Does not do checking, so use with care!
 * @param delta
 */
public MapDataDelta apply(MapDataDelta delta){
  MapDataDelta inverse=new MapDataDelta();
  HeightChange c=delta.getHeightChanges();
  while (c != null) {
    inverse.addHeightChange(c.x,c.y,heights[c.x][c.y]);
    heights[c.x][c.y]=c.height;
    backgroundListener.backgroundChangedAt(c.x,c.y);
    c=c.next;
  }
  LandscapeChange cl=delta.getLandscapeChanges();
  while (cl != null) {
    inverse.addLandscapeChange(cl.x,cl.y,landscapes[cl.x][cl.y]);
    landscapes[cl.x][cl.y]=cl.landscape;
    backgroundListener.backgroundChangedAt(cl.x,cl.y);
    cl=cl.next;
  }
  ObjectRemover remove=delta.getRemoveObjects();
  while (remove != null) {
    inverse.addObject(remove.x,remove.y,objects[remove.x][remove.y]);
    objects[remove.x][remove.y]=null;
    remove=remove.next;
  }
  ObjectAdder adder=delta.getAddObjects();
  while (adder != null) {
    inverse.removeObject(adder.x,adder.y);
    objects[adder.x][adder.y]=adder.obj;
    adder=adder.next;
  }
  ResourceChanger res=delta.getChangeResources();
  while (res != null) {
    inverse.changeResource(res.x,res.y,resources[res.x][res.y],resourceAmount[res.x][res.y]);
    resources[res.x][res.y]=res.type;
    resourceAmount[res.x][res.y]=res.amount;
    res=res.next;
  }
  StartPointSetter start=delta.getStartPoints();
  while (start != null) {
    inverse.setStartPoint(start.player,playerStarts[start.player]);
    playerStarts[start.player]=start.pos;
  }
  return inverse;
}

Fixed version (ground truth):
/** 
 * Applys a map delta. Does not do checking, so use with care!
 * @param delta
 */
public MapDataDelta apply(MapDataDelta delta){
  MapDataDelta inverse=new MapDataDelta();
  HeightChange c=delta.getHeightChanges();
  while (c != null) {
    inverse.addHeightChange(c.x,c.y,heights[c.x][c.y]);
    heights[c.x][c.y]=c.height;
    backgroundListener.backgroundChangedAt(c.x,c.y);
    c=c.next;
  }
  LandscapeChange cl=delta.getLandscapeChanges();
  while (cl != null) {
    inverse.addLandscapeChange(cl.x,cl.y,landscapes[cl.x][cl.y]);
    landscapes[cl.x][cl.y]=cl.landscape;
    backgroundListener.backgroundChangedAt(cl.x,cl.y);
    cl=cl.next;
  }
  ObjectRemover remove=delta.getRemoveObjects();
  while (remove != null) {
    inverse.addObject(remove.x,remove.y,objects[remove.x][remove.y]);
    objects[remove.x][remove.y]=null;
    remove=remove.next;
  }
  ObjectAdder adder=delta.getAddObjects();
  while (adder != null) {
    inverse.removeObject(adder.x,adder.y);
    objects[adder.x][adder.y]=adder.obj;
    adder=adder.next;
  }
  ResourceChanger res=delta.getChangeResources();
  while (res != null) {
    inverse.changeResource(res.x,res.y,resources[res.x][res.y],resourceAmount[res.x][res.y]);
    resources[res.x][res.y]=res.type;
    resourceAmount[res.x][res.y]=res.amount;
    res=res.next;
  }
  StartPointSetter start=delta.getStartPoints();
  while (start != null) {
    inverse.setStartPoint(start.player,playerStarts[start.player]);
    playerStarts[start.player]=start.pos;
    start=start.next;
  }
  return inverse;
}
Program: 55967
Project: 55967
Buggy source:
protected void play(){
  try {
    File temp=File.createTempFile("String_Node_Str","String_Node_Str");
    data.doPreSaveActions();
    MapList.getDefaultList().saveNewMap(generateMapHeader(),data,new FileOutputStream(temp));
    String[] args=new String[]{"String_Node_Str","String_Node_Str",System.getProperty("String_Node_Str"),SwingManagedJSettlers.class.getName(),"String_Node_Str" + temp.getAbsolutePath(),"String_Node_Str","String_Node_Str"};
    System.out.println("String_Node_Str");
    for (    String arg : args) {
      System.out.print(arg + "String_Node_Str");
    }
    System.out.println();
    ProcessBuilder builder=new ProcessBuilder(args);
    builder.redirectErrorStream(true);
    final Process process=builder.start();
    new Thread(new Runnable(){
      @Override public void run(){
        BufferedReader reader=new BufferedReader(new InputStreamReader(process.getInputStream()));
        while (true) {
          String line;
          try {
            line=reader.readLine();
          }
 catch (          IOException e) {
            break;
          }
          if (line == null) {
            break;
          }
          System.out.println("String_Node_Str" + line);
        }
      }
    }
,"String_Node_Str");
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
protected void play(){
  try {
    File temp=File.createTempFile("String_Node_Str","String_Node_Str");
    data.doPreSaveActions();
    MapList.getDefaultList().saveNewMap(generateMapHeader(),data,new FileOutputStream(temp));
    String[] args=new String[]{"String_Node_Str","String_Node_Str",System.getProperty("String_Node_Str"),SwingManagedJSettlers.class.getName(),"String_Node_Str" + temp.getAbsolutePath(),"String_Node_Str","String_Node_Str"};
    System.out.println("String_Node_Str");
    for (    String arg : args) {
      System.out.print(arg + "String_Node_Str");
    }
    System.out.println();
    ProcessBuilder builder=new ProcessBuilder(args);
    builder.redirectErrorStream(true);
    final Process process=builder.start();
    Thread streamReader=new Thread(new Runnable(){
      @Override public void run(){
        BufferedReader reader=new BufferedReader(new InputStreamReader(process.getInputStream()));
        while (true) {
          String line;
          try {
            line=reader.readLine();
          }
 catch (          IOException e) {
            break;
          }
          if (line == null) {
            break;
          }
          System.out.println("String_Node_Str" + line);
        }
      }
    }
,"String_Node_Str");
    streamReader.setDaemon(true);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 55968
Project: 55968
Buggy source:
@Override public void action(Action action){
  System.out.println("String_Node_Str" + action.getActionType());
  if (action.getActionType() == EActionType.SELECT_AREA) {
  }
 else   if (action instanceof DrawLineAction) {
    if (tool != null) {
      DrawLineAction lineAction=(DrawLineAction)action;
      ShapeType shape=getActiveShape();
      tool.apply(data,shape,lineAction.getStart(),lineAction.getEnd(),lineAction.getUidy());
      dataTester.retest();
    }
  }
 else   if (action instanceof StartDrawingAction) {
    if (tool != null) {
      StartDrawingAction lineAction=(StartDrawingAction)action;
      ShapeType shape=getActiveShape();
      tool.start(data,shape,lineAction.getPos());
      dataTester.retest();
    }
  }
 else   if (action instanceof EndDrawingAction) {
    endUseStep();
    dataTester.retest();
  }
 else   if (action instanceof AbortDrawingAction) {
    MapDataDelta delta=data.getUndoDelta();
    data.apply(delta);
    data.resetUndoDelta();
    dataTester.retest();
  }
 else   if (action.getActionType() == EActionType.SELECT_POINT) {
    if (tool != null) {
      PointAction lineAction=(PointAction)action;
      ShapeType shape=getActiveShape();
      tool.start(data,shape,lineAction.getPosition());
      tool.apply(data,shape,lineAction.getPosition(),lineAction.getPosition(),0);
      endUseStep();
      dataTester.retest();
    }
  }
}

Fixed version (ground truth):
@Override public void action(Action action){
  System.out.println("String_Node_Str" + action.getActionType());
  if (action.getActionType() == EActionType.SELECT_AREA) {
  }
 else   if (action instanceof DrawLineAction) {
    if (tool != null && !(tool instanceof SetStartpointTool)) {
      DrawLineAction lineAction=(DrawLineAction)action;
      ShapeType shape=getActiveShape();
      tool.apply(data,shape,lineAction.getStart(),lineAction.getEnd(),lineAction.getUidy());
      dataTester.retest();
    }
  }
 else   if (action instanceof StartDrawingAction) {
    if (tool != null && !(tool instanceof SetStartpointTool)) {
      StartDrawingAction lineAction=(StartDrawingAction)action;
      ShapeType shape=getActiveShape();
      tool.start(data,shape,lineAction.getPos());
      dataTester.retest();
    }
  }
 else   if (action instanceof EndDrawingAction) {
    endUseStep();
    dataTester.retest();
  }
 else   if (action instanceof AbortDrawingAction) {
    MapDataDelta delta=data.getUndoDelta();
    data.apply(delta);
    data.resetUndoDelta();
    dataTester.retest();
  }
 else   if (action.getActionType() == EActionType.SELECT_POINT) {
    if (tool != null) {
      PointAction lineAction=(PointAction)action;
      ShapeType shape=getActiveShape();
      tool.start(data,shape,lineAction.getPosition());
      tool.apply(data,shape,lineAction.getPosition(),lineAction.getPosition(),0);
      endUseStep();
      dataTester.retest();
    }
  }
}
Program: 55969
Project: 55969
Buggy source:
@Override protected byte getFieldRating(int x,int y,double distance){
  if (x % 2 == 0 && y % 2 == 1) {
    return super.getFieldRating(x,y,distance);
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
@Override protected byte getFieldRating(int x,int y,double distance){
  if (x % 2 == 0 && y % 2 != 0) {
    return super.getFieldRating(x,y,distance);
  }
 else {
    return 0;
  }
}
Program: 55970
Project: 55970
Buggy source:
@Override protected boolean shouldDrawAt(ShortPoint2D current){
  return current.x % 2 == 0 && current.y % 2 == 1;
}

Fixed version (ground truth):
@Override protected boolean shouldDrawAt(ShortPoint2D current){
  return current.x % 2 == 0 && current.y % 2 != 0;
}
Program: 55971
Project: 55971
Buggy source:
private synchronized void println(String msg){
  outStream.println(Logger.DATE_FORMAT.format(new Date()) + "String_Node_Str" + msg);
}

Fixed version (ground truth):
private synchronized void println(String msg){
  outStream.println(DATE_FORMAT.format(new Date()) + "String_Node_Str" + msg);
}
Program: 55972
Project: 55972
Buggy source:
@Test public void testFilterUneven(){
  LinkedList<Integer> expected=new LinkedList<Integer>();
  for (  Integer curr : list) {
    if (curr % 2 == 1)     expected.add(curr);
  }
  assertEqualality(expected,new IteratorFilter<Integer>(list,new IPredicate<Integer>(){
    @Override public boolean evaluate(    Integer object){
      return object % 2 == 1;
    }
  }
));
}

Fixed version (ground truth):
@Test public void testFilterUneven(){
  LinkedList<Integer> expected=new LinkedList<Integer>();
  for (  Integer curr : list) {
    if (curr % 2 != 0)     expected.add(curr);
  }
  assertEqualality(expected,new IteratorFilter<Integer>(list,new IPredicate<Integer>(){
    @Override public boolean evaluate(    Integer object){
      return object % 2 != 0;
    }
  }
));
}
Program: 55973
Project: 55973
Buggy source:
public static void main(String[] args) throws IOException, MapLoadException {
  System.out.println("String_Node_Str");
  for (  Object[] replaySet : replaySets()) {
    String folderName=(String)replaySet[0];
    int targetTimeMinutes=(Integer)replaySet[1];
    AutoReplayIT replayIT=new AutoReplayIT(folderName,targetTimeMinutes);
    Path newSavegame=AutoReplayIT.replayAndGetSavegame(replayIT.getReplayPath(),targetTimeMinutes);
    Path expectedSavegamePath=replayIT.getSavegamePath();
    try {
      compareMapFiles(expectedSavegamePath,newSavegame);
      System.out.println("String_Node_Str");
      Files.delete(newSavegame);
    }
 catch (    AssertionError|NoSuchFileException ex) {
      Files.move(newSavegame,expectedSavegamePath,StandardCopyOption.REPLACE_EXISTING);
      System.out.println("String_Node_Str" + expectedSavegamePath + "String_Node_Str"+ newSavegame+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, MapLoadException {
  System.out.println("String_Node_Str");
  for (  Object[] replaySet : replaySets()) {
    String folderName=(String)replaySet[0];
    int targetTimeMinutes=(Integer)replaySet[1];
    AutoReplayIT replayIT=new AutoReplayIT(folderName,targetTimeMinutes);
    Path newSavegame=AutoReplayIT.replayAndGetSavegame(replayIT.getReplayPath(),targetTimeMinutes);
    Path expectedSavegamePath=replayIT.getSavegamePath();
    try {
      compareMapFiles(expectedSavegamePath,newSavegame);
      System.out.println("String_Node_Str");
      Files.delete(newSavegame);
    }
 catch (    AssertionError|NoSuchFileException|FileNotFoundException ex) {
      Files.move(newSavegame,expectedSavegamePath,StandardCopyOption.REPLACE_EXISTING);
      System.out.println("String_Node_Str" + expectedSavegamePath + "String_Node_Str"+ newSavegame+ "String_Node_Str");
    }
  }
}
Program: 55974
Project: 55974
Buggy source:
/** 
 * Gets the productivity of this mine.
 * @return The productivity in range 0..1
 */
float getProductivity();

Fixed version (ground truth):
/** 
 * Gets the productivity of this   {@link IResourceBuilding}.
 * @return The productivity in the interval [0,1].
 */
float getProductivity();
Program: 55975
Project: 55975
Buggy source:
@Override public final boolean executeSearchType(ShortPoint2D position,ESearchType searchType){
  return mapObjectsManager.executeSearchType(position,searchType);
}

Fixed version (ground truth):
@Override public final boolean executeSearchType(IPathCalculatable pathCalculable,ShortPoint2D position,ESearchType searchType){
  if (fitsSearchType(pathCalculable,position,searchType)) {
    return mapObjectsManager.executeSearchType(position,searchType);
  }
 else {
    return false;
  }
}
Program: 55976
Project: 55976
Buggy source:
@Override public boolean fitsSearchType(IPathCalculatable pathCalculable,ShortPoint2D pos,ESearchType searchType){
  return pathfinderGrid.fitsSearchType(pos.x,pos.y,searchType,pathCalculable);
}

Fixed version (ground truth):
@Override public boolean fitsSearchType(IPathCalculatable pathCalculable,ShortPoint2D position,ESearchType searchType){
  return pathfinderGrid.fitsSearchType(position.x,position.y,searchType,pathCalculable);
}
Program: 55977
Project: 55977
Buggy source:
/** 
 * @param pos
 * @param searchType
 * @return true if the given position can be used to execute the search type.<br>false if it can not
 */
public abstract boolean executeSearchType(ShortPoint2D pos,ESearchType searchType);

Fixed version (ground truth):
/** 
 * @param pathCalculatable requester
 * @param position Position to execute the given  {@link ESearchType}.
 * @param searchType
 * @return true if the given position can be used to execute the search type.<br>false if it can not
 */
public abstract boolean executeSearchType(IPathCalculatable pathCalculatable,ShortPoint2D position,ESearchType searchType);
Program: 55978
Project: 55978
Buggy source:
/** 
 * Checks if the given position fits the given search type.
 * @param pathCalculateable path requester
 * @param pos position
 * @param searchType search type to be checked
 * @return true if the search type fits the given position.
 */
public abstract boolean fitsSearchType(IPathCalculatable pathCalculateable,ShortPoint2D pos,ESearchType searchType);

Fixed version (ground truth):
/** 
 * Checks if the given position fits the given search type.
 * @param pathCalculateable path requester
 * @param position position to check the given  {@link ESearchType}.
 * @param searchType search type to be checked
 * @return true if the search type fits the given position.
 */
public abstract boolean fitsSearchType(IPathCalculatable pathCalculateable,ShortPoint2D position,ESearchType searchType);
Program: 55979
Project: 55979
Buggy source:
private void executeAction(){
  if (super.getStrategyGrid().executeSearchType(super.getPos(),currentJob.getSearchType())) {
    jobFinished();
  }
 else {
    jobFailed();
  }
}

Fixed version (ground truth):
private void executeAction(){
  if (super.getStrategyGrid().executeSearchType(super.getMovable(),super.getPos(),currentJob.getSearchType())) {
    jobFinished();
  }
 else {
    jobFailed();
  }
}
Program: 55980
Project: 55980
Buggy source:
private void executeAction(ShortPoint2D pos){
  super.getStrategyGrid().executeSearchType(pos,ESearchType.RESOURCE_SIGNABLE);
}

Fixed version (ground truth):
private void executeAction(ShortPoint2D pos){
  super.getStrategyGrid().executeSearchType(super.getMovable(),pos,ESearchType.RESOURCE_SIGNABLE);
}
Program: 55981
Project: 55981
Buggy source:
@Override protected void action(){
switch (state) {
case JOBLESS:
    break;
case INIT_JOB:
  goToDiggablePosition();
break;
case PLAYING_ACTION:
executeDigg();
if (!requester.isDiggerRequestActive()) {
reportJobless();
break;
}
case GOING_TO_POS:
if (needsToBeWorkedOn(super.getPos())) {
super.playAction(EAction.ACTION1,1f);
this.state=EDiggerState.PLAYING_ACTION;
}
 else {
goToDiggablePosition();
}
break;
case DEAD_OBJECT:
break;
}
}

Fixed version (ground truth):
@Override protected void action(){
switch (state) {
case JOBLESS:
    break;
case INIT_JOB:
  goToDiggablePosition();
break;
case PLAYING_ACTION:
executeDigg();
if (!requester.isDiggerRequestActive()) {
super.getStrategyGrid().setMarked(super.getPos(),false);
reportJobless();
break;
}
case GOING_TO_POS:
if (needsToBeWorkedOn(super.getPos())) {
super.playAction(EAction.ACTION1,1f);
this.state=EDiggerState.PLAYING_ACTION;
}
 else {
goToDiggablePosition();
}
break;
case DEAD_OBJECT:
break;
}
}
Program: 55982
Project: 55982
Buggy source:
private void createNewToolUser(IWorkerCreationRequest workerCreationRequest){
  workerCreationRequests.offer(workerCreationRequest);
}

Fixed version (ground truth):
private void createNewToolUser(WorkerCreationRequest workerCreationRequest){
  workerCreationRequests.offer(workerCreationRequest);
}