nus-yam/ex-repair huggingface dataset:
Program: 55635
Project: 55635
Buggy source:
@Override public MainGridWithUiSettings loadMainGrid(PlayerSetting[] playerSettings,EMapStartResources startResources) throws MapLoadException {
  MilliStopWatch watch=new MilliStopWatch();
  loadMapContent(startResources);
  OriginalMapFileContent mapData=mapContent.mapData;
  mapData.calculateBlockedPartitions();
  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((byte)i);
    }
  }
  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,EMapStartResources startResources) throws MapLoadException {
  MilliStopWatch watch=new MilliStopWatch();
  loadMapContent(startResources,playerSettings);
  OriginalMapFileContent mapData=mapContent.mapData;
  mapData.calculateBlockedPartitions();
  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((byte)i);
    }
  }
  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: 55636
Project: 55636
Buggy source:
private void loadMapContent(EMapStartResources startResources) throws MapLoadException {
  try {
    mapContent.reOpen(this.listedMap.getInputStream());
  }
 catch (  Exception e) {
    throw new MapLoadException(e);
  }
  mapContent.loadMapResources();
  mapContent.readBasicMapInformation();
  mapContent.readMapData();
  mapContent.readStacks();
  mapContent.readSettlers();
  mapContent.readBuildings();
  mapContent.addStartTowerMaterialsAndSettlers(startResources);
}

Fixed version (ground truth):
private void loadMapContent(EMapStartResources startResources,PlayerSetting[] playerSettings) throws MapLoadException {
  try {
    mapContent.reOpen(this.listedMap.getInputStream());
  }
 catch (  Exception e) {
    throw new MapLoadException(e);
  }
  mapContent.loadMapResources();
  mapContent.readBasicMapInformation();
  mapContent.readMapData();
  mapContent.readStacks();
  mapContent.readSettlers();
  mapContent.readBuildings();
  mapContent.addStartTowerMaterialsAndSettlers(startResources,playerSettings);
}
Program: 55637
Project: 55637
Buggy source:
private JSettlersGame.GameRunner createStartingGame(PlayerSetting[] playerSettings) throws MapLoadException {
  byte playerId=0;
  for (byte i=0; i < playerSettings.length; i++) {
    if (playerSettings[i].isAvailable()) {
      playerId=i;
      break;
    }
  }
  MapLoader mapCreator=MapUtils.getSpezialSumpf();
  JSettlersGame game=new JSettlersGame(mapCreator,2L,new OfflineNetworkConnector(),playerId,playerSettings);
  return (JSettlersGame.GameRunner)game.start();
}

Fixed version (ground truth):
private JSettlersGame.GameRunner createStartingGame(PlayerSetting[] playerSettings) throws MapLoadException {
  byte playerId=0;
  for (byte i=0; i < playerSettings.length; i++) {
    if (playerSettings[i].isAvailable()) {
      playerId=i;
      break;
    }
  }
  MapLoader mapCreator=MapUtils.getSpezialSumpf();
  JSettlersGame game=new JSettlersGame(mapCreator,0L,new OfflineNetworkConnector(),playerId,playerSettings);
  return (JSettlersGame.GameRunner)game.start();
}
Program: 55638
Project: 55638
Buggy source:
@Test public void veryHardShouldProduceCertainAmountOfSoldiersWithin90Minutes() throws MapLoadException {
  byte playerId=(byte)0;
  PlayerSetting[] playerSettings=getDefaultPlayerSettings(12);
  playerSettings[playerId]=new PlayerSetting(EPlayerType.AI_VERY_HARD,ECivilisation.ROMAN,playerId);
  JSettlersGame.GameRunner startingGame=createStartingGame(playerSettings);
  IStartedGame startedGame=ReplayUtils.waitForGameStartup(startingGame);
  MatchConstants.clock().fastForwardTo(90 * MINUTES);
  short expectedMinimalProducedSoldiers=1000;
  short producedSoldiers=startingGame.getMainGrid().getPartitionsGrid().getPlayer(0).getEndgameStatistic().getAmountOfProducedSoldiers();
  if (producedSoldiers < expectedMinimalProducedSoldiers) {
    stopAndFail("String_Node_Str" + expectedMinimalProducedSoldiers + "String_Node_Str"+ producedSoldiers+ "String_Node_Str",startedGame,startingGame.getMainGrid(),playerId);
  }
  ensureRuntimePerformance("String_Node_Str",startingGame.getAiExecutor().getApplyRulesStopWatch(),200,2500);
  ensureRuntimePerformance("String_Node_Str",startingGame.getAiExecutor().getUpdateStatisticsStopWatch(),100,2500);
}

Fixed version (ground truth):
@Test public void veryHardShouldProduceCertainAmountOfSoldiersWithin90Minutes() throws MapLoadException {
  byte playerId=(byte)0;
  PlayerSetting[] playerSettings=getDefaultPlayerSettings(12);
  playerSettings[playerId]=new PlayerSetting(EPlayerType.AI_VERY_HARD,ECivilisation.ROMAN,playerId);
  JSettlersGame.GameRunner startingGame=createStartingGame(playerSettings);
  IStartedGame startedGame=ReplayUtils.waitForGameStartup(startingGame);
  MatchConstants.clock().fastForwardTo(90 * MINUTES);
  short expectedMinimalProducedSoldiers=920;
  short producedSoldiers=startingGame.getMainGrid().getPartitionsGrid().getPlayer(0).getEndgameStatistic().getAmountOfProducedSoldiers();
  if (producedSoldiers < expectedMinimalProducedSoldiers) {
    stopAndFail("String_Node_Str" + expectedMinimalProducedSoldiers + "String_Node_Str"+ producedSoldiers+ "String_Node_Str",startedGame,startingGame.getMainGrid(),playerId);
  }
  ensureRuntimePerformance("String_Node_Str",startingGame.getAiExecutor().getApplyRulesStopWatch(),200,2500);
  ensureRuntimePerformance("String_Node_Str",startingGame.getAiExecutor().getUpdateStatisticsStopWatch(),100,2500);
}
Program: 55639
Project: 55639
Buggy source:
@Test public void hardShouldConquerEasy() throws MapLoadException {
  holdBattleBetween(EPlayerType.AI_HARD,EPlayerType.AI_EASY,65 * MINUTES);
}

Fixed version (ground truth):
@Test public void hardShouldConquerEasy() throws MapLoadException {
  holdBattleBetween(EPlayerType.AI_HARD,EPlayerType.AI_EASY,75 * MINUTES);
}
Program: 55640
Project: 55640
Buggy source:
@Override public void setMapViewport(MapRectangle screenArea){
  int centerX=screenArea.getLineStartX(screenArea.getLines() / 2) + screenArea.getLineLength() / 2;
  int centerY=screenArea.getLineY(screenArea.getLines() / 2);
  ShortPoint2D displayCenter=new ShortPoint2D(centerX,centerY);
  controlsAdapter.onPositionChanged(screenArea,displayCenter);
}

Fixed version (ground truth):
@Override public void setMapViewport(MapRectangle screenArea){
  int centerX=screenArea.getLineStartX(screenArea.getHeight() / 2) + screenArea.getWidth() / 2;
  int centerY=screenArea.getLineY(screenArea.getHeight() / 2);
  ShortPoint2D displayCenter=new ShortPoint2D(centerX,centerY);
  controlsAdapter.onPositionChanged(screenArea,displayCenter);
}
Program: 55641
Project: 55641
Buggy source:
@Test public void testStacksAreNotBlockedButProtected(){
  for (  RelativeStack stack : buildingType.getConstructionStacks()) {
    assertFalse(isBlocked(stack));
    assertTrue(isProtected(stack));
  }
  for (  RelativeStack stack : buildingType.getRequestStacks()) {
    assertFalse(isBlocked(stack));
    assertTrue(isProtected(stack));
  }
  for (  RelativeStack stack : buildingType.getOfferStacks()) {
    assertFalse(isBlocked(stack));
    assertTrue(isProtected(stack));
  }
}

Fixed version (ground truth):
@Test public void testStacksAreNotBlockedButProtected(){
  for (  RelativeStack stack : buildingType.getConstructionStacks()) {
    assertFalse(buildingType + "String_Node_Str",isBlocked(stack));
    assertTrue(buildingType + "String_Node_Str",isProtected(stack));
  }
  for (  RelativeStack stack : buildingType.getRequestStacks()) {
    assertFalse(buildingType + "String_Node_Str",isBlocked(stack));
    assertTrue(buildingType + "String_Node_Str",isProtected(stack));
  }
  for (  RelativeStack stack : buildingType.getOfferStacks()) {
    assertFalse(buildingType + "String_Node_Str",isBlocked(stack));
    assertTrue(buildingType + "String_Node_Str",isProtected(stack));
  }
}
Program: 55642
Project: 55642
Buggy source:
protected void notifyListeners(){
synchronized (listeners) {
    stream(listeners).forEach(listeners -> listeners.update(currentData));
  }
}

Fixed version (ground truth):
protected void notifyListeners(){
  if (currentData == null) {
    return;
  }
synchronized (listeners) {
    stream(listeners).forEach(listeners -> listeners.update(currentData));
  }
}
Program: 55643
Project: 55643
Buggy source:
public Movable(AbstractMovableGrid grid,EMovableType movableType,ShortPoint2D position,Player player){
  this.grid=grid;
  this.position=position;
  this.player=player;
  this.strategy=MovableStrategy.getStrategy(this,movableType);
  this.movableType=movableType;
  this.health=movableType.getHealth();
  this.direction=EDirection.VALUES[MatchConstants.random().nextInt(EDirection.NUMBER_OF_DIRECTIONS)];
  RescheduleTimer.add(this,Constants.MOVABLE_INTERRUPT_PERIOD);
  this.id=nextID++;
  movablesByID.put(this.id,this);
  allMovables.offer(this);
  if (isShip()) {
    BuildingFile file=new BuildingFile(this.movableType.toString());
    this.images=file.getImages();
    for (int i=0; i < this.cargoStacks; i++) {
      this.cargoType[i]=null;
      this.cargoCount[i]=0;
    }
  }
  grid.enterPosition(position,this,true);
}

Fixed version (ground truth):
public Movable(AbstractMovableGrid grid,EMovableType movableType,ShortPoint2D position,Player player){
  this.grid=grid;
  this.position=position;
  this.player=player;
  this.strategy=MovableStrategy.getStrategy(this,movableType);
  this.movableType=movableType;
  this.health=movableType.getHealth();
  this.direction=EDirection.VALUES[MatchConstants.random().nextInt(EDirection.NUMBER_OF_DIRECTIONS)];
  RescheduleTimer.add(this,Constants.MOVABLE_INTERRUPT_PERIOD);
  this.id=nextID++;
  movablesByID.put(this.id,this);
  allMovables.offer(this);
  if (isShip()) {
    for (int i=0; i < this.cargoStacks; i++) {
      this.cargoType[i]=null;
      this.cargoCount[i]=0;
    }
  }
  grid.enterPosition(position,this,true);
}
Program: 55644
Project: 55644
Buggy source:
private IPathCalculatable getPathable(final short x,final short y){
  return new IPathCalculatable(){
    @Override public ShortPoint2D getPos(){
      return new ShortPoint2D(x,y);
    }
    @Override public IPlayer getPlayer(){
      return new IPlayer.DummyPlayer();
    }
    @Override public boolean needsPlayersGround(){
      return false;
    }
    @Override public boolean isShip(){
      return false;
    }
  }
;
}

Fixed version (ground truth):
private IPathCalculatable getPathable(final short x,final short y){
  return new IPathCalculatable(){
    @Override public ShortPoint2D getPosition(){
      return new ShortPoint2D(x,y);
    }
    @Override public IPlayer getPlayer(){
      return new IPlayer.DummyPlayer();
    }
    @Override public boolean needsPlayersGround(){
      return false;
    }
    @Override public boolean isShip(){
      return false;
    }
  }
;
}
Program: 55645
Project: 55645
Buggy source:
@Override public IManagerBearer removeJoblessCloseTo(ShortPoint2D position){
  int closestDist=Integer.MAX_VALUE;
  IManagerBearer closest=null;
  for (  IManagerBearer curr : jobless) {
    int currDist=ShortPoint2D.getOnGridDist(curr.getPos().x - position.x,curr.getPos().y - position.y);
    if (closestDist > currDist) {
      closest=curr;
      closestDist=currDist;
    }
  }
  return closest;
}

Fixed version (ground truth):
@Override public IManagerBearer removeJoblessCloseTo(ShortPoint2D position){
  int closestDist=Integer.MAX_VALUE;
  IManagerBearer closest=null;
  for (  IManagerBearer curr : jobless) {
    int currDist=ShortPoint2D.getOnGridDist(curr.getPosition().x - position.x,curr.getPosition().y - position.y);
    if (closestDist > currDist) {
      closest=curr;
      closestDist=currDist;
    }
  }
  return closest;
}
Program: 55646
Project: 55646
Buggy source:
public void addJoblessAt(final ShortPoint2D pos){
  jobless.add(new IManagerBearer(){
    private static final long serialVersionUID=3833820381369081344L;
    @Override public ShortPoint2D getPos(){
      return pos;
    }
    @Override public void deliver(    EMaterialType materialType,    IMaterialOffer offer,    IMaterialRequest request){
      offer.distributionAccepted();
      offer.offerTaken();
      request.deliveryAccepted();
      request.deliveryFulfilled();
    }
  }
);
}

Fixed version (ground truth):
public void addJoblessAt(final ShortPoint2D position){
  jobless.add(new IManagerBearer(){
    private static final long serialVersionUID=3833820381369081344L;
    @Override public ShortPoint2D getPosition(){
      return position;
    }
    @Override public void deliver(    EMaterialType materialType,    IMaterialOffer offer,    IMaterialRequest request){
      offer.distributionAccepted();
      offer.offerTaken();
      request.deliveryAccepted();
      request.deliveryFulfilled();
    }
  }
);
}
Program: 55647
Project: 55647
Buggy source:
private IPathCalculatable getPathable(final short x,final short y){
  return new IPathCalculatable(){
    @Override public ShortPoint2D getPos(){
      return new ShortPoint2D(x,y);
    }
    @Override public IPlayer getPlayer(){
      return new IPlayer.DummyPlayer();
    }
    @Override public boolean needsPlayersGround(){
      return false;
    }
    @Override public boolean isShip(){
      return false;
    }
  }
;
}

Fixed version (ground truth):
private IPathCalculatable getPathable(final short x,final short y){
  return new IPathCalculatable(){
    @Override public ShortPoint2D getPosition(){
      return new ShortPoint2D(x,y);
    }
    @Override public IPlayer getPlayer(){
      return new IPlayer.DummyPlayer();
    }
    @Override public boolean needsPlayersGround(){
      return false;
    }
    @Override public boolean isShip(){
      return false;
    }
  }
;
}
Program: 55648
Project: 55648
Buggy source:
@Override public IManagerBearer removeJoblessCloseTo(ShortPoint2D position){
  int closestDist=Integer.MAX_VALUE;
  IManagerBearer closest=null;
  for (  IManagerBearer curr : jobless) {
    int currDist=ShortPoint2D.getOnGridDist(curr.getPos().x - position.x,curr.getPos().y - position.y);
    if (closestDist > currDist) {
      closest=curr;
      closestDist=currDist;
    }
  }
  return closest;
}

Fixed version (ground truth):
@Override public IManagerBearer removeJoblessCloseTo(ShortPoint2D position){
  int closestDist=Integer.MAX_VALUE;
  IManagerBearer closest=null;
  for (  IManagerBearer curr : jobless) {
    int currDist=ShortPoint2D.getOnGridDist(curr.getPosition().x - position.x,curr.getPosition().y - position.y);
    if (closestDist > currDist) {
      closest=curr;
      closestDist=currDist;
    }
  }
  return closest;
}
Program: 55649
Project: 55649
Buggy source:
public void addJoblessAt(final ShortPoint2D pos){
  jobless.add(new IManagerBearer(){
    private static final long serialVersionUID=3833820381369081344L;
    @Override public ShortPoint2D getPos(){
      return pos;
    }
    @Override public void deliver(    EMaterialType materialType,    IMaterialOffer offer,    IMaterialRequest request){
      offer.distributionAccepted();
      offer.offerTaken();
      request.deliveryAccepted();
      request.deliveryFulfilled();
    }
  }
);
}

Fixed version (ground truth):
public void addJoblessAt(final ShortPoint2D pos){
  jobless.add(new IManagerBearer(){
    private static final long serialVersionUID=3833820381369081344L;
    @Override public ShortPoint2D getPosition(){
      return pos;
    }
    @Override public void deliver(    EMaterialType materialType,    IMaterialOffer offer,    IMaterialRequest request){
      offer.distributionAccepted();
      offer.offerTaken();
      request.deliveryAccepted();
      request.deliveryFulfilled();
    }
  }
);
}
Program: 55650
Project: 55650
Buggy source:
public static void main(String args[]){
  IDijkstraPathMap map=new IDijkstraPathMap(){
    @Override public boolean fitsSearchType(    int x,    int y,    ESearchType type,    IPathCalculatable requester){
      if (x == 120 && y == 100)       return true;
      if (x == 110 && y == 110)       return true;
      return x == 118 && y == 115;
    }
    @Override public boolean fitsSearchType(    int x,    int y,    Set<ESearchType> types,    IPathCalculatable requester){
      return false;
    }
    @Override public void setDijkstraSearched(    int x,    int y){
    }
  }
;
  DummyEmptyAStarMap aStarMap=new DummyEmptyAStarMap(WIDTH,HEIGHT);
  aStarMap.setBlocked(120,100,true);
  DijkstraAlgorithm dijkstra=new DijkstraAlgorithm(map,new BucketQueueAStar(aStarMap,WIDTH,HEIGHT),WIDTH,HEIGHT);
  IPathCalculatable requester=new IPathCalculatable(){
    @Override public ShortPoint2D getPos(){
      return new ShortPoint2D(100,100);
    }
    @Override public IPlayer getPlayer(){
      return new IPlayer.DummyPlayer();
    }
    @Override public boolean needsPlayersGround(){
      return false;
    }
  }
;
  Path path=dijkstra.find(requester,(short)100,(short)100,(short)1,(short)30,null);
  System.out.println("String_Node_Str" + path);
}

Fixed version (ground truth):
public static void main(String args[]){
  IDijkstraPathMap map=new IDijkstraPathMap(){
    @Override public boolean fitsSearchType(    int x,    int y,    ESearchType type,    IPathCalculatable requester){
      if (x == 120 && y == 100)       return true;
      if (x == 110 && y == 110)       return true;
      return x == 118 && y == 115;
    }
    @Override public boolean fitsSearchType(    int x,    int y,    Set<ESearchType> types,    IPathCalculatable requester){
      return false;
    }
    @Override public void setDijkstraSearched(    int x,    int y){
    }
  }
;
  DummyEmptyAStarMap aStarMap=new DummyEmptyAStarMap(WIDTH,HEIGHT);
  aStarMap.setBlocked(120,100,true);
  DijkstraAlgorithm dijkstra=new DijkstraAlgorithm(map,new BucketQueueAStar(aStarMap,WIDTH,HEIGHT),WIDTH,HEIGHT);
  IPathCalculatable requester=new IPathCalculatable(){
    @Override public ShortPoint2D getPosition(){
      return new ShortPoint2D(100,100);
    }
    @Override public IPlayer getPlayer(){
      return new IPlayer.DummyPlayer();
    }
    @Override public boolean needsPlayersGround(){
      return false;
    }
    @Override public boolean isShip(){
      return false;
    }
  }
;
  Path path=dijkstra.find(requester,(short)100,(short)100,(short)1,(short)30,null);
  System.out.println("String_Node_Str" + path);
}
Program: 55651
Project: 55651
Buggy source:
public void moveStep(){
  for (  TestSettler settler : this.settlers) {
    settler.increaseProgress();
    if (settler.moveOn()) {
      TestTile newPosition=this.getTile(settler.getDirection().getNextHexPoint(settler.getPos()));
      if (newPosition == null) {
        EDirection direction=getRandomDirection();
        settler.setDirection(direction);
      }
 else {
        TestTile nextPosition=this.getTile(settler.getDirection().getNextHexPoint(newPosition.getPos()));
        this.getTile(settler.getPos()).setMovable(null);
        newPosition.setMovable(settler);
        settler.setPosition(newPosition);
        if (nextPosition == null || nextPosition.getMovable() != null || nextPosition.getLandscapeType() == ELandscapeType.WATER1) {
          EDirection direction=getRandomDirection();
          settler.setDirection(direction);
        }
      }
    }
  }
  for (  TestBuilding bulding : this.buildings) {
    bulding.increaseConstructed();
  }
}

Fixed version (ground truth):
public void moveStep(){
  for (  TestSettler settler : this.settlers) {
    settler.increaseProgress();
    if (settler.moveOn()) {
      TestTile newPosition=this.getTile(settler.getDirection().getNextHexPoint(settler.getPosition()));
      if (newPosition == null) {
        EDirection direction=getRandomDirection();
        settler.setDirection(direction);
      }
 else {
        TestTile nextPosition=this.getTile(settler.getDirection().getNextHexPoint(newPosition.getPos()));
        this.getTile(settler.getPosition()).setMovable(null);
        newPosition.setMovable(settler);
        settler.setPosition(newPosition);
        if (nextPosition == null || nextPosition.getMovable() != null || nextPosition.getLandscapeType() == ELandscapeType.WATER1) {
          EDirection direction=getRandomDirection();
          settler.setDirection(direction);
        }
      }
    }
  }
  for (  TestBuilding bulding : this.buildings) {
    bulding.increaseConstructed();
  }
}
Program: 55652
Project: 55652
Buggy source:
public T drawRandom(){
  float random=MatchConstants.random().nextFloat() * sum;
  if (sum == 0) {
    return null;
  }
  float prefixSum=0;
  for (int index=0; index < userValues.length; index++) {
    prefixSum+=userValues[index];
    if (random <= prefixSum) {
      if (decreaseOnDraw) {
        changeUserValue(index,-1);
      }
      return ordinalToTypeMapper.map(index);
    }
  }
  return null;
}

Fixed version (ground truth):
public T drawRandom(){
  float random=MatchConstants.random().nextFloat() * sum;
  if (sum == 0) {
    return null;
  }
  float prefixSum=0;
  for (int index=0; index < userValues.length; index++) {
    prefixSum+=userValues[index];
    if (random < prefixSum) {
      if (decreaseOnDraw) {
        changeUserValue(index,-1);
      }
      return ordinalToTypeMapper.map(index);
    }
  }
  return null;
}
Program: 55653
Project: 55653
Buggy source:
public void finish(){
  drawControls.removeDrawListener(this);
}

Fixed version (ground truth):
public void finish(){
  drawControls.removeInfrequentDrawListener(this);
}
Program: 55655
Project: 55655
Buggy source:
private boolean isEnoughSpace(int[] buildingCounts,long grasTiles){
  long grasTilesWithoutBuffer=Math.round(grasTiles / 3F);
  for (int i=0; i < buildingCounts.length; i++) {
    EBuildingType buildingType=EBuildingType.VALUES[i];
    if (!buildingType.isMine()) {
      grasTilesWithoutBuffer-=EBuildingType.VALUES[i].getProtectedTiles().length * buildingCounts[i];
      if (grasTilesWithoutBuffer < 0) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean isEnoughSpace(int[] buildingCounts,long grassTiles){
  long grassTilesWithoutBuffer=Math.round(grassTiles / 3F);
  for (int i=0; i < buildingCounts.length; i++) {
    EBuildingType buildingType=EBuildingType.VALUES[i];
    if (!buildingType.isMine()) {
      grassTilesWithoutBuffer-=EBuildingType.VALUES[i].getProtectedTiles().length * buildingCounts[i];
      if (grassTilesWithoutBuffer < 0) {
        return false;
      }
    }
  }
  return true;
}
Program: 55656
Project: 55656
Buggy source:
private boolean isIngestibleByPioneersOf(int x,int y,Player player){
  Player otherPlayer=partitionsGrid.getPlayerAt(x,y);
  return !player.hasSameTeam(otherPlayer) && !landscapeGrid.getLandscapeTypeAt(x,y).isBlocking && !partitionsGrid.isEnforcedByTower(x,y);
}

Fixed version (ground truth):
private boolean isIngestibleByPioneersOf(int x,int y,Player player){
  Player otherPlayer=partitionsGrid.getPlayerAt(x,y);
  return !player.hasSameTeam(otherPlayer) && !flagsGrid.isBlocked(x,y) && !partitionsGrid.isEnforcedByTower(x,y);
}
Program: 55657
Project: 55657
Buggy source:
public void addStartTowerMaterialsAndSettlers(EMapStartResources startResources){
  if (hasBuildings)   return;
  int playerCount=mapData.getPlayerCount();
  for (byte playerId=0; playerId < playerCount; playerId++) {
    ShortPoint2D startPoint=mapData.getStartPoint(playerId);
    mapData.setMapObject(startPoint.x,startPoint.y,new BuildingObject(EBuildingType.TOWER,playerId));
    List<MapObject> mapObjects=EMapStartResources.generateStackObjects(startResources);
    mapObjects.addAll(EMapStartResources.generateMovableObjects(startResources,playerId));
    List<RelativePoint> towerTiles=Arrays.asList(EBuildingType.TOWER.getProtectedTiles());
    RelativePoint relativeMapObjectPoint=new RelativePoint(-3,3);
    for (    MapObject currentMapObject : mapObjects) {
      do {
        relativeMapObjectPoint=nextPointOnSpiral(relativeMapObjectPoint);
        if (towerTiles.contains(relativeMapObjectPoint))         continue;
        int x=relativeMapObjectPoint.calculateX(startPoint.x);
        int y=relativeMapObjectPoint.calculateY(startPoint.y);
        if (mapData.getMapObject(x,y) == null) {
          mapData.setMapObject(x,y,currentMapObject);
          break;
        }
      }
 while (true);
    }
  }
}

Fixed version (ground truth):
public void addStartTowerMaterialsAndSettlers(EMapStartResources startResources,PlayerSetting[] playerSettings){
  if (hasBuildings)   return;
  int playerCount=mapData.getPlayerCount();
  for (byte playerId=0; playerId < playerCount; playerId++) {
    if (playerSettings != null && !playerSettings[playerId].isAvailable())     continue;
    ShortPoint2D startPoint=mapData.getStartPoint(playerId);
    mapData.setMapObject(startPoint.x,startPoint.y,new BuildingObject(EBuildingType.TOWER,playerId));
    List<MapObject> mapObjects=EMapStartResources.generateStackObjects(startResources);
    mapObjects.addAll(EMapStartResources.generateMovableObjects(startResources,playerId));
    List<RelativePoint> towerTiles=Arrays.asList(EBuildingType.TOWER.getProtectedTiles());
    RelativePoint relativeMapObjectPoint=new RelativePoint(-3,3);
    for (    MapObject currentMapObject : mapObjects) {
      do {
        relativeMapObjectPoint=nextPointOnSpiral(relativeMapObjectPoint);
        if (towerTiles.contains(relativeMapObjectPoint))         continue;
        int x=relativeMapObjectPoint.calculateX(startPoint.x);
        int y=relativeMapObjectPoint.calculateY(startPoint.y);
        if (mapData.getMapObject(x,y) == null) {
          mapData.setMapObject(x,y,currentMapObject);
          break;
        }
      }
 while (true);
    }
  }
}
Program: 55658
Project: 55658
Buggy source:
@Override public MainGridWithUiSettings loadMainGrid(PlayerSetting[] playerSettings,EMapStartResources startResources) throws MapLoadException {
  MilliStopWatch watch=new MilliStopWatch();
  try {
    mapContent.reOpen(this.listedMap.getInputStream());
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
  if (!mapContent.loadMapResources()) {
    System.out.println("String_Node_Str" + fileName + "String_Node_Str");
    return null;
  }
  mapContent.readBasicMapInformation();
  mapContent.readMapData();
  mapContent.readStacks();
  mapContent.readSettlers();
  mapContent.readBuildings();
  mapContent.addStartTowerMaterialsAndSettlers(startResources);
  OriginalMapFileContent mapData=mapContent.mapData;
  mapData.calculateBlockedPartitions();
  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((byte)i);
    }
  }
  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,EMapStartResources startResources) throws MapLoadException {
  MilliStopWatch watch=new MilliStopWatch();
  try {
    mapContent.reOpen(this.listedMap.getInputStream());
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
  if (!mapContent.loadMapResources()) {
    System.out.println("String_Node_Str" + fileName + "String_Node_Str");
    return null;
  }
  mapContent.readBasicMapInformation();
  mapContent.readMapData();
  mapContent.readStacks();
  mapContent.readSettlers();
  mapContent.readBuildings();
  mapContent.addStartTowerMaterialsAndSettlers(startResources,playerSettings);
  OriginalMapFileContent mapData=mapContent.mapData;
  mapData.calculateBlockedPartitions();
  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((byte)i);
    }
  }
  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: 55659
Project: 55659
Buggy source:
@Override public byte getTeamId(){
  return 0;
}

Fixed version (ground truth):
@Override public byte getTeamId(){
  return playerAndTeamid;
}
Program: 55660
Project: 55660
Buggy source:
@Override public byte getPlayerId(){
  return 0;
}

Fixed version (ground truth):
@Override public byte getPlayerId(){
  return playerAndTeamid;
}
Program: 55661
Project: 55661
Buggy source:
private IPathCalculatable getPathable(final short x,final short y){
  return new IPathCalculatable(){
    private static final long serialVersionUID=-7744309931981354171L;
    @Override public ShortPoint2D getPos(){
      return new ShortPoint2D(x,y);
    }
    @Override public byte getPlayerId(){
      return 0;
    }
    @Override public boolean needsPlayersGround(){
      return false;
    }
  }
;
}

Fixed version (ground truth):
private IPathCalculatable getPathable(final short x,final short y){
  return new IPathCalculatable(){
    @Override public ShortPoint2D getPos(){
      return new ShortPoint2D(x,y);
    }
    @Override public IPlayer getPlayer(){
      return new IPlayer.DummyPlayer();
    }
    @Override public boolean needsPlayersGround(){
      return false;
    }
  }
;
}
Program: 55662
Project: 55662
Buggy source:
public BuildingContainer(BuildingMapDataObject buildingObject,ShortPoint2D position){
  this.buildingObject=buildingObject;
  this.position=position;
}

Fixed version (ground truth):
public BuildingContainer(BuildingMapDataObject buildingObject,ShortPoint2D position){
  this.buildingObject=buildingObject;
  this.position=position;
  this.player=new IPlayer.DummyPlayer(buildingObject.getPlayerId());
}
Program: 55663
Project: 55663
Buggy source:
public MovableObjectContainer(MovableObject movableObject,int x,int y){
  this.movableObject=movableObject;
  this.pos=new ShortPoint2D(x,y);
}

Fixed version (ground truth):
public MovableObjectContainer(MovableObject movableObject,int x,int y){
  this.movableObject=movableObject;
  this.pos=new ShortPoint2D(x,y);
  this.player=new IPlayer.DummyPlayer(movableObject.getPlayerId());
}
Program: 55664
Project: 55664
Buggy source:
@Override public void doTest(){
  int playerCount=header.getMaxPlayers();
  addHeader("String_Node_Str",fix);
  for (int x=0; x < data.getWidth(); x++) {
    for (int y=0; y < data.getHeight(); y++) {
      MapDataObject mapObject=data.getMapObject(x,y);
      if (mapObject instanceof IPlayerable) {
        int p=((IPlayerable)mapObject).getPlayerId();
        if (p >= playerCount) {
          fix.addInvalidObject(new ShortPoint2D(x,y));
          addErrorMessage("String_Node_Str",new ShortPoint2D(x,y));
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void doTest(){
  int playerCount=header.getMaxPlayers();
  addHeader("String_Node_Str",fix);
  for (int x=0; x < data.getWidth(); x++) {
    for (int y=0; y < data.getHeight(); y++) {
      MapDataObject mapObject=data.getMapObject(x,y);
      if (mapObject instanceof IPlayerIdProvider) {
        int p=((IPlayerIdProvider)mapObject).getPlayerId();
        if (p >= playerCount) {
          fix.addInvalidObject(new ShortPoint2D(x,y));
          addErrorMessage("String_Node_Str",new ShortPoint2D(x,y));
        }
      }
    }
  }
}
Program: 55665
Project: 55665
Buggy source:
public static void main(String args[]){
  IDijkstraPathMap map=new IDijkstraPathMap(){
    @Override public boolean fitsSearchType(    int x,    int y,    ESearchType type,    IPathCalculatable requester){
      if (x == 120 && y == 100)       return true;
      if (x == 110 && y == 110)       return true;
      return x == 118 && y == 115;
    }
    @Override public boolean fitsSearchType(    int x,    int y,    Set<ESearchType> types,    IPathCalculatable requester){
      return false;
    }
    @Override public void setDijkstraSearched(    int x,    int y){
    }
  }
;
  DummyEmptyAStarMap aStarMap=new DummyEmptyAStarMap(WIDTH,HEIGHT);
  aStarMap.setBlocked(120,100,true);
  DijkstraAlgorithm dijkstra=new DijkstraAlgorithm(map,new BucketQueueAStar(aStarMap,WIDTH,HEIGHT),WIDTH,HEIGHT);
  IPathCalculatable requester=new IPathCalculatable(){
    private static final long serialVersionUID=8994674255605105284L;
    @Override public ShortPoint2D getPos(){
      return new ShortPoint2D(100,100);
    }
    @Override public byte getPlayerId(){
      return 0;
    }
    @Override public boolean needsPlayersGround(){
      return false;
    }
  }
;
  Path path=dijkstra.find(requester,(short)100,(short)100,(short)1,(short)30,null);
  System.out.println("String_Node_Str" + path);
}

Fixed version (ground truth):
public static void main(String args[]){
  IDijkstraPathMap map=new IDijkstraPathMap(){
    @Override public boolean fitsSearchType(    int x,    int y,    ESearchType type,    IPathCalculatable requester){
      if (x == 120 && y == 100)       return true;
      if (x == 110 && y == 110)       return true;
      return x == 118 && y == 115;
    }
    @Override public boolean fitsSearchType(    int x,    int y,    Set<ESearchType> types,    IPathCalculatable requester){
      return false;
    }
    @Override public void setDijkstraSearched(    int x,    int y){
    }
  }
;
  DummyEmptyAStarMap aStarMap=new DummyEmptyAStarMap(WIDTH,HEIGHT);
  aStarMap.setBlocked(120,100,true);
  DijkstraAlgorithm dijkstra=new DijkstraAlgorithm(map,new BucketQueueAStar(aStarMap,WIDTH,HEIGHT),WIDTH,HEIGHT);
  IPathCalculatable requester=new IPathCalculatable(){
    @Override public ShortPoint2D getPos(){
      return new ShortPoint2D(100,100);
    }
    @Override public IPlayer getPlayer(){
      return new IPlayer.DummyPlayer();
    }
    @Override public boolean needsPlayersGround(){
      return false;
    }
  }
;
  Path path=dijkstra.find(requester,(short)100,(short)100,(short)1,(short)30,null);
  System.out.println("String_Node_Str" + path);
}
Program: 55666
Project: 55666
Buggy source:
public TestSettler(EDirection direction,EMovableType type,TestTile tile,byte player){
  this.type=type;
  this.setDirection(direction);
  this.setPosition(tile);
  this.player=player;
}

Fixed version (ground truth):
public TestSettler(EDirection direction,EMovableType type,TestTile tile,byte player){
  this.type=type;
  this.setDirection(direction);
  this.setPosition(tile);
  this.player=new IPlayer.DummyPlayer(player);
}
Program: 55667
Project: 55667
Buggy source:
@Override public boolean isValidPosition(IPathCalculatable pathCalculatable,int x,int y){
  return isInBounds(x,y) && !isBlocked(x,y) && (!pathCalculatable.needsPlayersGround() || pathCalculatable.getPlayerId() == getPlayerIdAt(x,y));
}

Fixed version (ground truth):
@Override public boolean isValidPosition(IPathCalculatable pathCalculatable,int x,int y){
  return isInBounds(x,y) && !isBlocked(x,y) && (!pathCalculatable.needsPlayersGround() || pathCalculatable.getPlayer().getPlayerId() == getPlayerIdAt(x,y));
}
Program: 55668
Project: 55668
Buggy source:
@Override public void freeAreaOccupiedByTower(ShortPoint2D towerPosition){
  CoordinateStream positions=partitionsGrid.removeTowerAndFreeOccupiedArea(towerPosition);
  checkAllPositionsForEnclosedBlockedAreas(positions);
}

Fixed version (ground truth):
@Override public void freeAreaOccupiedByTower(ShortPoint2D towerPosition){
  partitionsGrid.removeTowerAndFreeOccupiedArea(towerPosition);
}
Program: 55669
Project: 55669
Buggy source:
private void destroyBuildingOrTakeOver(int x,int y,byte player){
  if (flagsGrid.isBlocked(x,y)) {
    partitionsGrid.changePlayerAt(x,y,player);
  }
  Building building=objectsGrid.getBuildingAt(x,y);
  if (building != null) {
    building.kill();
  }
}

Fixed version (ground truth):
private void destroyBuildingOrTakeOver(int x,int y,byte playerId){
  if (flagsGrid.isBlocked(x,y)) {
    partitionsGrid.changePlayerAt(x,y,playerId);
  }
  Building building=objectsGrid.getBuildingAt(x,y);
  if (building != null && building.getPlayerId() != playerId) {
    building.kill();
  }
}
Program: 55670
Project: 55670
Buggy source:
/** 
 * Removes the tower at the given position from the grid.
 * @param pos The position of the tower.
 * @return
 */
public CoordinateStream removeTowerAndFreeOccupiedArea(ShortPoint2D pos){
  PartitionOccupyingTower tower=occupyingTowers.removeAt(pos);
  if (tower == null) {
    return CoordinateStream.EMPTY;
  }
  CoordinateStream towerStream=tower.area.stream();
  changeTowerCounter(tower.playerId,towerStream,-1);
  checkOtherTowersInArea(tower);
  return towerStream;
}

Fixed version (ground truth):
/** 
 * Removes the tower at the given position from the grid.
 * @param pos The position of the tower.
 */
public void removeTowerAndFreeOccupiedArea(ShortPoint2D pos){
  PartitionOccupyingTower tower=occupyingTowers.removeAt(pos);
  if (tower == null) {
    return;
  }
  changeTowerCounter(tower.playerId,tower.area.stream(),-1);
  checkOtherTowersInArea(tower);
}
Program: 55671
Project: 55671
Buggy source:
/** 
 * Gets the number of tiles a movable must at least walk to get from (0|0) to (dx|dy).
 * @param dx
 * @param dy
 * @return
 */
public static int getOnGridDist(final int dx,final int dy){
  final int absDx=Math.abs(dx);
  final int absDy=Math.abs(dy);
  if (dx * dy > 0) {
    if (absDx > absDy) {
      return absDx;
    }
 else {
      return absDy;
    }
  }
 else {
    return absDx + absDy;
  }
}

Fixed version (ground truth):
public static int getOnGridDist(int startX,int startY,int endX,int endY){
  return getOnGridDist(endX - startX,endY - startY);
}
Program: 55672
Project: 55672
Buggy source:
public abstract boolean canConstructAt(short x,short y,EBuildingType type,byte playerId);

Fixed version (ground truth):
public abstract boolean canConstructAt(int x,int y,EBuildingType type,byte playerId);
Program: 55673
Project: 55673
Buggy source:
private final List<Integer> getIDsOfSelected(){
  return getIDsOfIterable(currentSelection);
}

Fixed version (ground truth):
private List<Integer> getIDsOfSelected(){
  return getIDsOfIterable(currentSelection);
}
Program: 55674
Project: 55674
Buggy source:
private void selectPointType(PointAction action){
  final ShortPoint2D actionPosition=action.getPosition();
  final IGuiMovable selectedMovable=getSelectableMovable(actionPosition.x,actionPosition.y);
  if (selectedMovable == null) {
    setSelection(new SelectionSet());
    return;
  }
  EMovableType selectedType=selectedMovable.getMovableType();
  byte selectedPlayerId=selectedMovable.getPlayerId();
  Set<EMovableType> selectableTypes;
  if (selectedType.isSwordsman()) {
    selectableTypes=EMovableType.swordsmen;
  }
 else   if (selectedType.isPikeman()) {
    selectableTypes=EMovableType.pikemen;
  }
 else   if (selectedType.isBowman()) {
    selectableTypes=EMovableType.bowmen;
  }
 else {
    selectableTypes=EnumSet.of(selectedType);
  }
  final List<ISelectable> selected=new LinkedList<>();
  MapCircle.stream(actionPosition,SELECT_BY_TYPE_RADIUS).forEach((x,y) -> {
    final IGuiMovable movable=grid.getMovable(x,y);
    if (movable != null && selectableTypes.contains(movable.getMovableType()) && selectedPlayerId == movable.getPlayerId()) {
      selected.add(movable);
    }
  }
);
  setSelection(new SelectionSet(selected));
}

Fixed version (ground truth):
private void selectPointType(PointAction action){
  final ShortPoint2D actionPosition=action.getPosition();
  final IGuiMovable selectedMovable=getSelectableMovable(actionPosition.x,actionPosition.y);
  if (selectedMovable == null) {
    setSelection(new SelectionSet());
    return;
  }
  EMovableType selectedType=selectedMovable.getMovableType();
  byte selectedPlayerId=selectedMovable.getPlayerId();
  Set<EMovableType> selectableTypes;
  if (selectedType.isSwordsman()) {
    selectableTypes=EMovableType.swordsmen;
  }
 else   if (selectedType.isPikeman()) {
    selectableTypes=EMovableType.pikemen;
  }
 else   if (selectedType.isBowman()) {
    selectableTypes=EMovableType.bowmen;
  }
 else {
    selectableTypes=EnumSet.of(selectedType);
  }
  final List<ISelectable> selected=new LinkedList<>();
  MapCircle.stream(actionPosition,SELECT_BY_TYPE_RADIUS).filterBounds(grid.getWidth(),grid.getHeight()).forEach((x,y) -> {
    final IGuiMovable movable=grid.getMovable(x,y);
    if (movable != null && selectableTypes.contains(movable.getMovableType()) && selectedPlayerId == movable.getPlayerId()) {
      selected.add(movable);
    }
  }
);
  setSelection(new SelectionSet(selected));
}
Program: 55676
Project: 55676
Buggy source:
private final static List<Integer> getIDsOfIterable(Iterable<? extends ISelectable> iterable){
  final List<Integer> selectedIds=new LinkedList<>();
  for (  final ISelectable curr : iterable) {
    if (curr instanceof IIDable) {
      selectedIds.add(((IIDable)curr).getID());
    }
  }
  return selectedIds;
}

Fixed version (ground truth):
private static List<Integer> getIDsOfIterable(Iterable<? extends ISelectable> iterable){
  final List<Integer> selectedIds=new LinkedList<>();
  for (  final ISelectable curr : iterable) {
    if (curr instanceof IIDable) {
      selectedIds.add(((IIDable)curr).getID());
    }
  }
  return selectedIds;
}
Program: 55677
Project: 55677
Buggy source:
/** 
 * Gets a position where the building can be constructed some points around pos.
 * @param position THe position
 * @param type The type of the building
 * @param player The player that wants to construct the building.
 * @param useNeighbors If this is true, not only the given position is checked, if it can be used to construct a building, but also the neighbors.<br> If this is false, only the given position will be checked.
 * @return <code>null</code> if no position was found, the position otherwise.
 */
ShortPoint2D getConstructablePosition(ShortPoint2D position,EBuildingType type,byte player,boolean useNeighbors);

Fixed version (ground truth):
/** 
 * Gets a position where the building can be constructed some points around pos.
 * @param position THe position
 * @param type The type of the building
 * @param player The player that wants to construct the building.
 * @return <code>null</code> if no position was found, the position otherwise.
 */
Optional<ShortPoint2D> getConstructablePosition(ShortPoint2D position,EBuildingType type,byte player);
Program: 55678
Project: 55678
Buggy source:
@Override public final ShortPoint2D getConstructablePosition(ShortPoint2D pos,EBuildingType type,byte playerId,boolean useNeighbors){
  if (constructionMarksGrid.canConstructAt(pos.x,pos.y,type,playerId)) {
    return pos;
  }
 else   if (useNeighbors) {
    for (    ShortPoint2D neighbour : new MapNeighboursArea(pos)) {
      if (constructionMarksGrid.canConstructAt(neighbour.x,neighbour.y,type,playerId)) {
        return neighbour;
      }
    }
    return null;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public final Optional<ShortPoint2D> getConstructablePosition(ShortPoint2D pos,EBuildingType type,byte playerId){
  return MapCircle.stream(pos,Constants.BUILDING_PLACEMENT_MAX_SEARCH_RADIUS).filterBounds(width,height).filter((x,y) -> constructionMarksGrid.canConstructAt(x,y,type,playerId)).min((x,y) -> ShortPoint2D.getOnGridDist(pos.x,pos.y,x,y));
}
Program: 55679
Project: 55679
Buggy source:
@Override public boolean canConstructAt(short x,short y,EBuildingType type,byte playerId){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override public boolean canConstructAt(int x,int y,EBuildingType type,byte playerId){
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 55680
Project: 55680
Buggy source:
private void onPlayersChanges(ChangingList<? extends IMultiplayerPlayer> changingPlayers,IJoinPhaseMultiplayerGameConnector joinMultiPlayerMap){
  SwingUtilities.invokeLater(() -> {
    List<? extends IMultiplayerPlayer> players=changingPlayers.getItems();
    String myId=SettingsManager.getInstance().get(SettingsManager.SETTING_UUID);
    for (int i=0; i < players.size(); i++) {
      PlayerSlot playerSlot=playerSlots.get(i);
      IMultiplayerPlayer player=players.get(i);
      playerSlot.setPlayerName(player.getName());
      playerSlot.setReady(player.isReady());
      if (player.getId().equals(myId)) {
        playerSlot.setReadyButtonEnabled(true);
        playerSlot.informGameAboutReady(joinMultiPlayerMap);
      }
 else {
        playerSlot.setReadyButtonEnabled(false);
      }
    }
    for (int i=players.size(); i < playerSlots.size(); i++) {
      playerSlots.get(i).setPlayerType(EPlayerType.AI_VERY_HARD,false);
    }
    setCancelButtonActionListener(e -> {
      joinMultiPlayerMap.abort();
      settlersFrame.showMainMenu();
    }
);
  }
);
}

Fixed version (ground truth):
private void onPlayersChanges(ChangingList<? extends IMultiplayerPlayer> changingPlayers,IJoinPhaseMultiplayerGameConnector joinMultiPlayerMap){
  SwingUtilities.invokeLater(() -> {
    List<? extends IMultiplayerPlayer> players=changingPlayers.getItems();
    String myId=SettingsManager.getInstance().get(SettingsManager.SETTING_UUID);
    for (int i=0; i < players.size(); i++) {
      PlayerSlot playerSlot=playerSlots.get(i);
      IMultiplayerPlayer player=players.get(i);
      playerSlot.setPlayerName(player.getName());
      playerSlot.setReady(player.isReady());
      playerSlot.setPlayerType(EPlayerType.HUMAN,false);
      if (player.getId().equals(myId)) {
        playerSlot.setReadyButtonEnabled(true);
        playerSlot.informGameAboutReady(joinMultiPlayerMap);
      }
 else {
        playerSlot.setReadyButtonEnabled(false);
      }
    }
    for (int i=players.size(); i < playerSlots.size(); i++) {
      playerSlots.get(i).setPlayerType(EPlayerType.AI_VERY_HARD,false);
    }
    setCancelButtonActionListener(e -> {
      joinMultiPlayerMap.abort();
      settlersFrame.showMainMenu();
    }
);
  }
);
}
Program: 55681
Project: 55681
Buggy source:
@Override public void drawWorkAreaCircle(ShortPoint2D buildingPosition,ShortPoint2D workAreaCenter,short radius,boolean draw){
  short buildingPartition=partitionsGrid.getPartitionIdAt(buildingPosition.x,buildingPosition.y);
  final int numCircles=4;
  for (int circle=1; circle <= 4; circle++) {
    float circleRadius=radius * circle / (float)numCircles;
    float mapObjectProgress=(circle - 1) / (float)(numCircles - 1);
    MapCircle.streamBorder(workAreaCenter.x,workAreaCenter.y,circleRadius).forEach((x,y) -> addOrRemoveMarkObject(buildingPartition,draw,new ShortPoint2D(x,y),mapObjectProgress));
  }
}

Fixed version (ground truth):
@Override public void drawWorkAreaCircle(ShortPoint2D buildingPosition,ShortPoint2D workAreaCenter,short radius,boolean draw){
  short buildingPartition=partitionsGrid.getPartitionIdAt(buildingPosition.x,buildingPosition.y);
  final int numCircles=4;
  for (int circle=1; circle <= 4; circle++) {
    float circleRadius=radius * circle / (float)numCircles;
    float mapObjectProgress=(circle - 1) / (float)(numCircles - 1);
    MapCircle.streamBorder(workAreaCenter.x,workAreaCenter.y,circleRadius).filterBounds(width,height).forEach((x,y) -> addOrRemoveMarkObject(buildingPartition,draw,x,y,mapObjectProgress));
  }
}