nus-yam/ex-repair huggingface dataset:
Program: 56110
Project: 56110
Buggy source:
private IAttackable getEnemyInSearchArea(byte searchingPlayer,HexGridArea area,boolean isBowman){
  for (  ShortPoint2D curr : area) {
    short x=curr.x;
    short y=curr.y;
    if (0 <= x && x < width && 0 <= y && y < height) {
      IAttackable currAttackable=movableGrid.getMovableAt(x,y);
      if (currAttackable == null && !isBowman) {
        currAttackable=(IAttackable)objectsGrid.getMapObjectAt(x,y,EMapObjectType.ATTACKABLE_TOWER);
      }
      if (currAttackable != null && MovableGrid.isEnemy(searchingPlayer,currAttackable)) {
        return currAttackable;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private IAttackable getEnemyInSearchArea(byte searchingPlayer,HexGridArea area,boolean isBowman,boolean includeTowers){
  for (  ShortPoint2D curr : area) {
    short x=curr.x;
    short y=curr.y;
    if (0 <= x && x < width && 0 <= y && y < height) {
      IAttackable currAttackable=movableGrid.getMovableAt(x,y);
      if (includeTowers && !isBowman && currAttackable == null) {
        currAttackable=(IAttackable)objectsGrid.getMapObjectAt(x,y,EMapObjectType.ATTACKABLE_TOWER);
      }
      if (currAttackable != null && MovableGrid.isEnemy(searchingPlayer,currAttackable)) {
        return currAttackable;
      }
    }
  }
  return null;
}
Program: 56111
Project: 56111
Buggy source:
/** 
 * Searches for an enemy around the position of the given movable in it's search radius.
 * @param centerPos The center position to start the search.
 * @param movable The movable searching an enemy.
 * @param searchRadius The radius of the search for enemy attackables.
 * @return The closest enemy or null if none exists in the search radius.
 */
public abstract IAttackable getEnemyInSearchArea(ShortPoint2D centerPos,IAttackable movable,short searchRadius);

Fixed version (ground truth):
/** 
 * Searches for an enemy around the position of the given movable in it's search radius.
 * @param centerPos The center position to start the search.
 * @param movable The movable searching an enemy.
 * @param searchRadius The radius of the search for enemy attackables.
 * @param includeTowers If true, towers are included in the search, if false, only movables are searched.
 * @return The closest enemy or null if none exists in the search radius.
 */
public abstract IAttackable getEnemyInSearchArea(ShortPoint2D centerPos,IAttackable movable,short searchRadius,boolean includeTowers);
Program: 56112
Project: 56112
Buggy source:
@Override protected void moveToPathSet(ShortPoint2D oldPosition,ShortPoint2D oldTargetPos,ShortPoint2D targetPos){
  if (targetPos != null && this.oldPathTarget != null) {
    oldPathTarget=null;
    inSaveGotoMode=false;
  }
}

Fixed version (ground truth):
@Override protected void moveToPathSet(ShortPoint2D oldPosition,ShortPoint2D oldTargetPos,ShortPoint2D targetPos){
  if (targetPos != null && this.oldPathTarget != null) {
    oldPathTarget=null;
    inSaveGotoMode=false;
  }
  changeStateTo(ESoldierState.SEARCH_FOR_ENEMIES);
}
Program: 56114
Project: 56114
Buggy source:
private final boolean isAllowedLandscape(int x,int y,ELandscapeType[] landscapes){
  ELandscapeType landscapeAt=landscapeGrid.getLandscapeTypeAt(x,y);
  for (byte i=0; i < landscapes.length; i++) {
    if (landscapeAt == landscapes[i]) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean isAllowedLandscape(int x,int y,ELandscapeType[] landscapes){
  ELandscapeType landscapeAt=landscapeGrid.getLandscapeTypeAt(x,y);
  for (byte i=0; i < landscapes.length; i++) {
    if (landscapeAt == landscapes[i]) {
      return true;
    }
  }
  return false;
}
Program: 56115
Project: 56115
Buggy source:
@Override public final boolean canUsePositionForConstruction(int x,int y,ELandscapeType[] landscapeTypes,byte player){
  return isInBounds(x,y) && !flagsGrid.isProtected(x,y) && ((CommonConstants.ENABLE_ALL_PLAYER_SELECTION && partitionsGrid.getPlayerIdAt(x,y) >= 0) || partitionsGrid.getPlayerIdAt(x,y) == player)&& isAllowedLandscape(x,y,landscapeTypes);
}

Fixed version (ground truth):
@Override public boolean canUsePositionForConstruction(int x,int y,ELandscapeType[] landscapeTypes,short partitionId){
  return isInBounds(x,y) && !flagsGrid.isProtected(x,y) && partitionsGrid.getPartitionIdAt(x,y) == partitionId && isAllowedLandscape(x,y,landscapeTypes);
}
Program: 56116
Project: 56116
Buggy source:
private void handleDiggerRequest(){
  DiggerRequest request=diggerRequests.peek();
  if (request == null) {
    return;
  }
  if (request.requester.isDiggerRequestActive()) {
    IManageableDigger digger=joblessDiggers.removeObjectNextTo(request.getPos());
    if (digger != null) {
      digger.setDiggerJob(request.requester);
      request.amount--;
      if (request.creationRequested > 0) {
        request.creationRequested--;
      }
    }
 else {
      if (request.amount > request.creationRequested) {
        if (createNewToolUserIfLimitNotExceeded(EMovableType.DIGGER,request.getPos())) {
          request.creationRequested++;
        }
      }
    }
    if (request.amount <= 0) {
      diggerRequests.poll();
    }
  }
 else {
    diggerRequests.poll();
  }
}

Fixed version (ground truth):
private void handleDiggerRequest(){
  DiggerRequest request=diggerRequests.peek();
  if (request == null) {
    return;
  }
  if (request.requester.isDiggerRequestActive()) {
    IManageableDigger digger=joblessDiggers.removeObjectNextTo(request.getPos());
    if (digger != null) {
      if (digger.setDiggerJob(request.requester)) {
        request.amount--;
        if (request.creationRequested > 0) {
          request.creationRequested--;
        }
      }
    }
 else {
      if (request.amount > request.creationRequested) {
        if (createNewToolUserIfLimitNotExceeded(EMovableType.DIGGER,request.getPos())) {
          request.creationRequested++;
        }
      }
    }
    if (request.amount <= 0) {
      diggerRequests.poll();
    }
  }
 else {
    diggerRequests.poll();
  }
}
Program: 56117
Project: 56117
Buggy source:
private void handleBricklayerRequest(){
  BricklayerRequest bricklayerRequest=bricklayerRequests.poll();
  if (bricklayerRequest != null && !bricklayerRequest.building.isConstructionFinished()) {
    IManageableBricklayer bricklayer=joblessBricklayers.removeObjectNextTo(bricklayerRequest.getPos());
    if (bricklayer != null) {
      bricklayer.setBricklayerJob(bricklayerRequest.building,bricklayerRequest.bricklayerTargetPos,bricklayerRequest.direction);
    }
 else {
      createNewToolUserIfLimitNotExceeded(EMovableType.BRICKLAYER,bricklayerRequest.getPos());
      bricklayerRequests.offerLast(bricklayerRequest);
    }
  }
}

Fixed version (ground truth):
private void handleBricklayerRequest(){
  BricklayerRequest bricklayerRequest=bricklayerRequests.poll();
  if (bricklayerRequest != null && !bricklayerRequest.building.isConstructionFinished()) {
    IManageableBricklayer bricklayer=joblessBricklayers.removeObjectNextTo(bricklayerRequest.getPos());
    if (bricklayer != null) {
      if (!bricklayer.setBricklayerJob(bricklayerRequest.building,bricklayerRequest.bricklayerTargetPos,bricklayerRequest.direction)) {
        bricklayerRequests.add(bricklayerRequest);
      }
    }
 else {
      createNewToolUserIfLimitNotExceeded(EMovableType.BRICKLAYER,bricklayerRequest.getPos());
      bricklayerRequests.offerLast(bricklayerRequest);
    }
  }
}
Program: 56118
Project: 56118
Buggy source:
void setBricklayerJob(IConstructableBuilding constructionSite,ShortPoint2D bricklayerTargetPos,EDirection direction);

Fixed version (ground truth):
/** 
 * @param constructionSite
 * @param bricklayerTargetPos
 * @param direction
 * @return Returns true if the request can be handled by this bricklayer.
 */
boolean setBricklayerJob(IConstructableBuilding constructionSite,ShortPoint2D bricklayerTargetPos,EDirection direction);
Program: 56119
Project: 56119
Buggy source:
void setDiggerJob(IDiggerRequester requester);

Fixed version (ground truth):
/** 
 * @param requester
 * @return true if the job can be handled by this digger, false if another digger needs to be asked.
 */
boolean setDiggerJob(IDiggerRequester requester);
Program: 56120
Project: 56120
Buggy source:
/** 
 * Sets a job to this   {@link IManagerBearer} object. The job is to deliver the given offer tot the given request.
 * @param materialType
 * @param offerPosition
 * @param request
 */
void deliver(EMaterialType materialType,ShortPoint2D offerPosition,IMaterialRequest request);

Fixed version (ground truth):
/** 
 * Sets a job to this   {@link IManagerBearer} object. The job is to deliver the given offer tot the given request.
 * @param materialType
 * @param offerPosition
 * @param request
 * @return true if the job can be handled, false if another bearer needs to be asked.
 */
boolean deliver(EMaterialType materialType,ShortPoint2D offerPosition,IMaterialRequest request);
Program: 56121
Project: 56121
Buggy source:
@Override public void deliver(EMaterialType materialType,ShortPoint2D offer,IMaterialRequest request){
  this.offer=offer;
  this.request=request;
  this.materialType=materialType;
  this.state=EBearerState.INIT_CARRY_JOB;
  request.deliveryAccepted();
}

Fixed version (ground truth):
@Override public boolean deliver(EMaterialType materialType,ShortPoint2D offer,IMaterialRequest request){
  if (state == EBearerState.JOBLESS) {
    this.offer=offer;
    this.request=request;
    this.materialType=materialType;
    this.state=EBearerState.INIT_CARRY_JOB;
    request.deliveryAccepted();
    return true;
  }
 else {
    return false;
  }
}
Program: 56122
Project: 56122
Buggy source:
@Override public void setBricklayerJob(IConstructableBuilding constructionSite,ShortPoint2D bricklayerTargetPos,EDirection direction){
}

Fixed version (ground truth):
@Override public boolean setBricklayerJob(IConstructableBuilding constructionSite,ShortPoint2D bricklayerTargetPos,EDirection direction){
  if (state == EBricklayerState.JOBLESS) {
    this.constructionSite=constructionSite;
    this.bricklayerTargetPos=bricklayerTargetPos;
    this.lookDirection=direction;
    this.state=EBricklayerState.INIT_JOB;
    return true;
  }
 else {
    return false;
  }
}
Program: 56123
Project: 56123
Buggy source:
@Override protected void action(){
switch (state) {
case JOBLESS:
    break;
case INIT_JOB:
  if (!constructionSite.isConstructionFinished() && super.goToPos(bricklayerTargetPos)) {
    this.state=EBricklayerState.GOING_TO_POS;
  }
 else {
    makeJobless();
  }
break;
case GOING_TO_POS:
super.lookInDirection(lookDirection);
state=EBricklayerState.BUILDING;
case BUILDING:
tryToBuild();
break;
}
}

Fixed version (ground truth):
@Override protected void action(){
switch (state) {
case JOBLESS:
    break;
case INIT_JOB:
  if (!constructionSite.isConstructionFinished() && super.goToPos(bricklayerTargetPos)) {
    this.state=EBricklayerState.GOING_TO_POS;
  }
 else {
    makeJobless();
  }
break;
case GOING_TO_POS:
super.lookInDirection(lookDirection);
state=EBricklayerState.BUILDING;
case BUILDING:
tryToBuild();
break;
case DEAD_OBJECT:
break;
}
}
Program: 56124
Project: 56124
Buggy source:
@Override protected void strategyKilledEvent(ShortPoint2D pathTarget){
  if (state == EBricklayerState.JOBLESS) {
    super.getStrategyGrid().removeJobless(this);
  }
}

Fixed version (ground truth):
@Override protected void strategyKilledEvent(ShortPoint2D pathTarget){
  if (state == EBricklayerState.JOBLESS) {
    super.getStrategyGrid().removeJobless(this);
  }
  state=EBricklayerState.DEAD_OBJECT;
}
Program: 56125
Project: 56125
Buggy source:
@Override public void setDiggerJob(IDiggerRequester requester){
}

Fixed version (ground truth):
@Override public boolean setDiggerJob(IDiggerRequester requester){
  if (state == EDiggerState.JOBLESS) {
    this.requester=requester;
    this.state=EDiggerState.INIT_JOB;
    return true;
  }
 else {
    return false;
  }
}
Program: 56126
Project: 56126
Buggy source:
@Override protected void action(){
switch (state) {
case JOBLESS:
    break;
case INIT_JOB:
  goToDiggablePosition();
break;
case PLAYING_ACTION:
executeDigg();
if (!requester.isDiggerRequestActive()) {
reportAsJobless();
break;
}
case GOING_TO_POS:
if (needsToBeWorkedOn(super.getPos())) {
super.playAction(EAction.ACTION1,1f);
this.state=EDiggerState.PLAYING_ACTION;
}
 else {
goToDiggablePosition();
}
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()) {
reportAsJobless();
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: 56127
Project: 56127
Buggy source:
@Override protected void strategyKilledEvent(ShortPoint2D pathTarget){
  if (pathTarget != null) {
    super.getStrategyGrid().setMarked(pathTarget,false);
  }
  if (state == EDiggerState.JOBLESS) {
    super.getStrategyGrid().removeJobless(this);
  }
}

Fixed version (ground truth):
@Override protected void strategyKilledEvent(ShortPoint2D pathTarget){
  if (pathTarget != null) {
    super.getStrategyGrid().setMarked(pathTarget,false);
  }
  if (state == EDiggerState.JOBLESS) {
    super.getStrategyGrid().removeJobless(this);
  }
  state=EDiggerState.DEAD_OBJECT;
}
Program: 56128
Project: 56128
Buggy source:
@Override public boolean canUsePositionForConstruction(int x,int y,ELandscapeType[] landscapeTypes,byte player){
  return isInBounds(x,y) && !blockedSet.get(x + y * width);
}

Fixed version (ground truth):
@Override public boolean canUsePositionForConstruction(int x,int y,ELandscapeType[] landscapeTypes,short partitionId){
  return isInBounds(x,y) && !blockedSet.get(x + y * width);
}
Program: 56129
Project: 56129
Buggy source:
@Override public NewMovable getEnemyInSearchArea(ShortPoint2D centerPos,IAttackable attackable,short searchRadius){
  return null;
}

Fixed version (ground truth):
@Override public NewMovable getEnemyInSearchArea(ShortPoint2D centerPos,IAttackable attackable,short searchRadius,boolean includeTowers){
  return null;
}
Program: 56130
Project: 56130
Buggy source:
private void handleSelectPointAction(PointAction action){
  ShortPoint2D pos=action.getPosition();
  grid.postionClicked(pos.x,pos.y);
  if (activeAction == null) {
    ISelectable selected=getSelectableAt(pos);
    if (selected != null) {
      setSelection(new SelectionSet(selected));
    }
 else {
      setSelection(new SelectionSet());
    }
  }
 else {
switch (activeAction.getActionType()) {
case BUILD:
      EBuildingType type=previewBuilding;
    ShortPoint2D pos2=grid.getConstructablePosition(pos,type,playerId,InputSettings.USE_NEIGHBOR_POSITIONS_FOR_CONSTRUCTION);
  if (pos2 != null) {
    cancelBuildingCreation();
    scheduleTask(new GeneralGuiTask(EGuiAction.BUILD,playerId,pos2,type));
    break;
  }
 else {
    return;
  }
default :
break;
}
setActiveAction(null);
}
}

Fixed version (ground truth):
private void handleSelectPointAction(PointAction action){
  ShortPoint2D pos=action.getPosition();
  grid.postionClicked(pos.x,pos.y);
  if (activeAction == null) {
    ISelectable selected=getSelectableAt(pos);
    if (selected != null) {
      setSelection(new SelectionSet(selected));
    }
 else {
      setSelection(new SelectionSet());
    }
  }
 else {
switch (activeAction.getActionType()) {
case BUILD:
      EBuildingType type=previewBuilding;
    ShortPoint2D pos2=grid.getConstructablePosition(pos,type,playerId,InputSettings.USE_NEIGHBOR_POSITIONS_FOR_CONSTRUCTION);
  if (pos2 != null) {
    scheduleTask(new GeneralGuiTask(EGuiAction.BUILD,playerId,pos2,type));
  }
return;
default :
break;
}
setActiveAction(null);
}
}
Program: 56131
Project: 56131
Buggy source:
@Override public void deliver(EMaterialType materialType,ShortPoint2D offerPosition,IMaterialRequest request){
  request.deliveryAccepted();
  request.deliveryFulfilled();
}

Fixed version (ground truth):
@Override public boolean deliver(EMaterialType materialType,ShortPoint2D offerPosition,IMaterialRequest request){
  request.deliveryAccepted();
  request.deliveryFulfilled();
  return true;
}
Program: 56132
Project: 56132
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,    ShortPoint2D offerPosition,    IMaterialRequest request){
      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 getPos(){
      return pos;
    }
    @Override public boolean deliver(    EMaterialType materialType,    ShortPoint2D offerPosition,    IMaterialRequest request){
      request.deliveryAccepted();
      request.deliveryFulfilled();
      return true;
    }
  }
);
}
Program: 56133
Project: 56133
Buggy source:
private void handleDiggerRequest(){
  DiggerRequest request=diggerRequests.peek();
  if (request != null && request.requester.isDiggerRequestActive()) {
    IManageableDigger digger=joblessDiggers.removeObjectNextTo(request.getPos());
    if (digger != null) {
      digger.setDiggerJob(request.requester);
      request.amount--;
      if (request.creationRequested > 0) {
        request.creationRequested--;
      }
    }
 else {
      if (request.amount > request.creationRequested) {
        if (createNewToolUserIfLimitNotExceeded(EMovableType.DIGGER,request.getPos())) {
          request.creationRequested++;
        }
      }
    }
    if (request.amount <= 0) {
      diggerRequests.poll();
    }
  }
}

Fixed version (ground truth):
private void handleDiggerRequest(){
  DiggerRequest request=diggerRequests.peek();
  if (request == null) {
    return;
  }
  if (request.requester.isDiggerRequestActive()) {
    IManageableDigger digger=joblessDiggers.removeObjectNextTo(request.getPos());
    if (digger != null) {
      digger.setDiggerJob(request.requester);
      request.amount--;
      if (request.creationRequested > 0) {
        request.creationRequested--;
      }
    }
 else {
      if (request.amount > request.creationRequested) {
        if (createNewToolUserIfLimitNotExceeded(EMovableType.DIGGER,request.getPos())) {
          request.creationRequested++;
        }
      }
    }
    if (request.amount <= 0) {
      diggerRequests.poll();
    }
  }
 else {
    diggerRequests.poll();
  }
}
Program: 56134
Project: 56134
Buggy source:
/** 
 * Checks if the given position is valid to build a building of given player that can stand on the given   {@link ELandscapeType}s. Bounds checks will be done by this method.
 * @param x x coordinate of the target position
 * @param y y coordinate of the target position
 * @param landscapeTypes allowed landscape types
 * @param player player
 * @return true if a building can be positioned at the given position<br>false otherwise.
 */
public abstract boolean canUsePositionForConstruction(int x,int y,ELandscapeType[] landscapeTypes,byte player);

Fixed version (ground truth):
/** 
 * Checks if the given position is valid to build a building of given player that can stand on the given   {@link ELandscapeType}s. Bounds checks will be done by this method.
 * @param x x coordinate of the target position
 * @param y y coordinate of the target position
 * @param landscapeTypes allowed landscape types
 * @param partitionId player
 * @return true if a building can be positioned at the given position<br>false otherwise.
 */
public abstract boolean canUsePositionForConstruction(int x,int y,ELandscapeType[] landscapeTypes,short partitionId);
Program: 56136
Project: 56136
Buggy source:
public NewConstructionMarksAlgorithm(AbstractConstructionMarkableMap map,byte player){
  this.map=map;
  this.player=player;
}

Fixed version (ground truth):
public NewConstructionMarksAlgorithm(AbstractConstructionMarkableMap map,byte player){
  this.map=map;
  this.playerId=player;
}
Program: 56137
Project: 56137
Buggy source:
public boolean equals(ShortPoint2D other){
  return other != null && other.x == x && other.y == y;
}

Fixed version (ground truth):
public boolean equals(int x,int y){
  return this.x == x && this.y == y;
}
Program: 56138
Project: 56138
Buggy source:
@Override public final OccupyerPlace addSoldier(IBuildingOccupyableMovable soldier){
  OccupyerPlace freePosition=findFreePositionFor(soldier.getSoldierType());
  emptyPlaces.remove(freePosition);
  currentlyCommingSoldiers[freePosition.getType().ordinal()]--;
  TowerOccupier towerOccupier=new TowerOccupier(freePosition,soldier);
  occupiers.add(towerOccupier);
  occupyAreaIfNeeded();
  soldier.setSelected(super.isSelected());
  addInformableMapObject(towerOccupier,true);
  return freePosition;
}

Fixed version (ground truth):
@Override public final OccupyerPlace addSoldier(IBuildingOccupyableMovable soldier){
  OccupyerPlace freePosition=findFreePositionFor(soldier.getSoldierType());
  currentlyCommingSoldiers[freePosition.getType().ordinal()]--;
  emptyPlaces.remove(freePosition);
  TowerOccupier towerOccupier=new TowerOccupier(freePosition,soldier);
  occupiers.add(towerOccupier);
  occupyAreaIfNeeded();
  soldier.setSelected(super.isSelected());
  addInformableMapObject(towerOccupier,true);
  return freePosition;
}
Program: 56139
Project: 56139
Buggy source:
public final boolean canOccupyBuilding(){
  return getMovableType().getSelectionType() == ESelectionType.SOLDIERS;
}

Fixed version (ground truth):
public final boolean canOccupyBuilding(){
  return movableType.getSelectionType() == ESelectionType.SOLDIERS;
}
Program: 56140
Project: 56140
Buggy source:
public void checkPlayerOfPosition(Player playerOfPosition){
  if (playerOfPosition != player && !strategy.isMoveToAble() && strategy.getClass() != FleeStrategy.class) {
    setStrategy(new FleeStrategy(this));
  }
}

Fixed version (ground truth):
public void checkPlayerOfPosition(Player playerOfPosition){
  if (playerOfPosition != player && movableType.needsPlayersGround() && strategy.getClass() != FleeStrategy.class) {
    setStrategy(new FleeStrategy(this));
  }
}
Program: 56141
Project: 56141
Buggy source:
@Override protected void strategyKilledEvent(ShortPoint2D pathTarget){
  if (building != null) {
    if (isInTower) {
      building.removeSoldier(this);
    }
 else {
      building.requestFailed(movableType);
    }
  }
}

Fixed version (ground truth):
@Override protected void strategyKilledEvent(ShortPoint2D pathTarget){
  if (building != null) {
    if (isInTower) {
      building.removeSoldier(this);
    }
 else {
      notifyTowerThatRequestFailed();
    }
  }
}
Program: 56143
Project: 56143
Buggy source:
public static void main(String[] args) throws FileNotFoundException, IOException, InterruptedException {
  HashMap<String,String> argsMap=MainUtils.createArgumentsMap(args);
  SwingManagedJSettlers.setupResourceManagers(argsMap,new File("String_Node_Str"));
  int targetGameTime=Integer.valueOf(argsMap.get("String_Node_Str")) * 60 * 1000;
  OfflineNetworkConnector networkConnector=new OfflineNetworkConnector();
  JSettlersGame game=getReplayGame(argsMap,networkConnector);
  IStartingGame startingGame=game.start();
  ReplayToolApp replayTool=new ReplayToolApp();
  replayTool.waitForGameStartup(startingGame);
  networkConnector.scheduleTaskAt(targetGameTime / NetworkConstants.Client.LOCKSTEP_PERIOD,new SimpleGuiTask(EGuiAction.QUICK_SAVE,(byte)0));
  MatchConstants.clock.fastForwardTo(targetGameTime);
  MapLoader newSavegame=MapList.getDefaultList().getSavedMaps().get(0);
  replayTool.createReplayOfRemainingTasks(newSavegame);
  Thread.sleep(2000);
  System.exit(0);
}

Fixed version (ground truth):
public static void main(String[] args) throws FileNotFoundException, IOException, InterruptedException {
  HashMap<String,String> argsMap=MainUtils.createArgumentsMap(args);
  SwingManagedJSettlers.loadDebugSettings(argsMap);
  SwingManagedJSettlers.setupResourceManagers(argsMap,new File("String_Node_Str"));
  int targetGameTime=Integer.valueOf(argsMap.get("String_Node_Str")) * 60 * 1000;
  OfflineNetworkConnector networkConnector=new OfflineNetworkConnector();
  JSettlersGame game=getReplayGame(argsMap,networkConnector);
  IStartingGame startingGame=game.start();
  ReplayToolApp replayTool=new ReplayToolApp();
  replayTool.waitForGameStartup(startingGame);
  networkConnector.scheduleTaskAt(targetGameTime / NetworkConstants.Client.LOCKSTEP_PERIOD,new SimpleGuiTask(EGuiAction.QUICK_SAVE,(byte)0));
  MatchConstants.clock.fastForwardTo(targetGameTime);
  MapLoader newSavegame=MapList.getDefaultList().getSavedMaps().get(0);
  replayTool.createReplayOfRemainingTasks(newSavegame);
  Thread.sleep(2000);
  System.exit(0);
}
Program: 56144
Project: 56144
Buggy source:
private static void loadDebugSettings(HashMap<String,String> argsMap){
  if (argsMap.containsKey("String_Node_Str")) {
    CommonConstants.ENABLE_ALL_PLAYER_FOG_OF_WAR=true;
    CommonConstants.ENABLE_ALL_PLAYER_SELECTION=true;
    CommonConstants.ENABLE_FOG_OF_WAR_DISABLING=true;
  }
  if (argsMap.containsKey("String_Node_Str")) {
    CommonConstants.DEFAULT_SERVER_ADDRESS="String_Node_Str";
  }
}

Fixed version (ground truth):
public static void loadDebugSettings(HashMap<String,String> argsMap){
  if (argsMap.containsKey("String_Node_Str")) {
    CommonConstants.ENABLE_ALL_PLAYER_FOG_OF_WAR=true;
    CommonConstants.ENABLE_ALL_PLAYER_SELECTION=true;
    CommonConstants.ENABLE_FOG_OF_WAR_DISABLING=true;
  }
  if (argsMap.containsKey("String_Node_Str")) {
    CommonConstants.DEFAULT_SERVER_ADDRESS="String_Node_Str";
  }
}
Program: 56145
Project: 56145
Buggy source:
private void drawMovableAt(IMovable movable,Image image,int x,int y){
  byte fogstatus=context.getVisibleStatus(x,y);
  if (fogstatus == 0) {
    return;
  }
  Color color=context.getPlayerColor(movable.getPlayerId());
  float shade=MapObjectDrawer.getColor(fogstatus);
  float viewX;
  float viewY;
  if (movable.getAction() == EAction.WALKING) {
    int originx=x - movable.getDirection().getGridDeltaX();
    int originy=y - movable.getDirection().getGridDeltaY();
    viewX=betweenTilesX(originx,originy,x,y,movable.getMoveProgress());
    viewY=betweenTilesY;
  }
 else {
    int height=context.getHeight(x,y);
    viewX=context.getConverter().getViewX(x,y,height);
    viewY=context.getConverter().getViewY(x,y,height);
  }
  image.drawAt(context.getGl(),context.getDrawBuffer(),viewX,viewY,color,shade);
  if (movable.isSelected()) {
    drawSelectionMark(viewX,viewY,movable.getHealth());
  }
}

Fixed version (ground truth):
private void drawMovableAt(IMovable movable,Image image,int x,int y){
  byte fogstatus=context.getVisibleStatus(x,y);
  if (fogstatus <= CommonConstants.FOG_OF_WAR_EXPLORED) {
    return;
  }
  Color color=context.getPlayerColor(movable.getPlayerId());
  float shade=MapObjectDrawer.getColor(fogstatus);
  float viewX;
  float viewY;
  if (movable.getAction() == EAction.WALKING) {
    int originx=x - movable.getDirection().getGridDeltaX();
    int originy=y - movable.getDirection().getGridDeltaY();
    viewX=betweenTilesX(originx,originy,x,y,movable.getMoveProgress());
    viewY=betweenTilesY;
  }
 else {
    int height=context.getHeight(x,y);
    viewX=context.getConverter().getViewX(x,y,height);
    viewY=context.getConverter().getViewY(x,y,height);
  }
  image.drawAt(context.getGl(),context.getDrawBuffer(),viewX,viewY,color,shade);
  if (movable.isSelected()) {
    drawSelectionMark(viewX,viewY,movable.getHealth());
  }
}
Program: 56146
Project: 56146
Buggy source:
/** 
 * Draws a player border at a given position.
 * @param player The player.
 */
public void drawPlayerBorderObject(int x,int y,byte player){
  forceSetup();
  byte fogstatus=context.getVisibleStatus(x,y);
  if (fogstatus == 0) {
    return;
  }
  float base=getColor(fogstatus);
  Color color=context.getPlayerColor(player);
  draw(imageProvider.getSettlerSequence(FILE_BORDERPOST,65).getImageSafe(0),x,y,color,base);
}

Fixed version (ground truth):
/** 
 * Draws a player border at a given position.
 * @param player The player.
 */
public void drawPlayerBorderObject(int x,int y,byte player){
  forceSetup();
  byte fogstatus=context.getVisibleStatus(x,y);
  if (fogstatus <= CommonConstants.FOG_OF_WAR_EXPLORED) {
    return;
  }
  float base=getColor(fogstatus);
  Color color=context.getPlayerColor(player);
  draw(imageProvider.getSettlerSequence(FILE_BORDERPOST,65).getImageSafe(0),x,y,color,base);
}
Program: 56148
Project: 56148
Buggy source:
private void pathingAction(){
  if (progress >= 1) {
    if (path.isFinished() || !strategy.checkPathStepPreconditions(path.getTargetPos(),path.getStep())) {
      setState(ENewMovableState.DOING_NOTHING);
      movableAction=EAction.NO_ACTION;
      path=null;
      return;
    }
    direction=EDirection.getDirection(position.x,position.y,path.nextX(),path.nextY());
    if (grid.hasNoMovableAt(path.nextX(),path.nextY())) {
      goSinglePathStep();
    }
 else {
      boolean pushedSuccessful=grid.getMovableAt(path.nextX(),path.nextY()).push(this);
      if (!pushedSuccessful) {
        delayCtr++;
        if (delayCtr > 4) {
          delayCtr=0;
          path=strategy.findWayAroundObstacle(direction,position,path);
        }
      }
      return;
    }
  }
 else {
    progress+=WALKING_PROGRESS_INCREASE;
  }
}

Fixed version (ground truth):
private void pathingAction(){
  if (progress >= 1) {
    if (path.isFinished() || !strategy.checkPathStepPreconditions(path.getTargetPos(),path.getStep())) {
      setState(ENewMovableState.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())) {
      goSinglePathStep();
    }
 else {
      boolean pushedSuccessful=grid.getMovableAt(path.nextX(),path.nextY()).push(this);
      if (!pushedSuccessful) {
        delayCtr++;
        if (delayCtr > 4) {
          delayCtr=0;
          path=strategy.findWayAroundObstacle(direction,position,path);
        }
      }
      return;
    }
  }
 else {
    progress+=WALKING_PROGRESS_INCREASE;
  }
}
Program: 56149
Project: 56149
Buggy source:
public void checkPlayerOfPosition(Player currentPlayer){
  if (currentPlayer != player && !strategy.isMoveToAble()) {
    abortCurrentWork();
    Path path=grid.searchDijkstra(this,position.x,position.y,Constants.MOVABLE_FLEE_BACK_TO_COUNTRY_RADIUS,ESearchType.OWN_GROUND);
    if (path != null) {
      followPath(path);
    }
 else {
      kill();
    }
  }
}

Fixed version (ground truth):
public void checkPlayerOfPosition(Player playerOfPosition){
  if (playerOfPosition != player && !strategy.isMoveToAble()) {
    abortCurrentWork();
    Path path=grid.searchDijkstra(this,position.x,position.y,Constants.MOVABLE_FLEE_BACK_TO_COUNTRY_RADIUS,ESearchType.OWN_GROUND);
    if (path != null) {
      followPath(path);
    }
 else {
      kill();
    }
  }
}
Program: 56150
Project: 56150
Buggy source:
/** 
 * Adds all elements of this list to the given   {@link DoubleLinkedList}. After this operation this list will not contain any elements.
 * @param newList The list to append all the elements of this list.
 */
public void mergeInto(DoubleLinkedList<T> newList){
  newList.head.prev.next=this.head.next;
  this.head.next.prev=newList.head.prev;
  this.head.prev.next=newList.head;
  newList.head.prev=this.head.prev;
  this.head.next=this.head;
  this.head.prev=this.head;
  this.size=0;
}

Fixed version (ground truth):
/** 
 * Adds all elements of this list to the given   {@link DoubleLinkedList}. After this operation this list will not contain any elements.
 * @param newList The list to append all the elements of this list.
 */
public void mergeInto(DoubleLinkedList<T> newList){
  newList.head.prev.next=this.head.next;
  this.head.next.prev=newList.head.prev;
  this.head.prev.next=newList.head;
  newList.head.prev=this.head.prev;
  newList.size+=size;
  clear();
}
Program: 56151
Project: 56151
Buggy source:
@Override protected void action(){
switch (state) {
case JOBLESS:
    break;
case INIT_JOB:
  if (super.goToPos(bricklayerTargetPos)) {
    this.state=EBricklayerState.GOING_TO_POS;
  }
 else {
    makeJobless();
  }
break;
case GOING_TO_POS:
super.lookInDirection(lookDirection);
state=EBricklayerState.BUILDING;
case BUILDING:
tryToBuild();
break;
}
}

Fixed version (ground truth):
@Override protected void action(){
switch (state) {
case JOBLESS:
    break;
case INIT_JOB:
  if (!constructionSite.isConstructionFinished() && super.goToPos(bricklayerTargetPos)) {
    this.state=EBricklayerState.GOING_TO_POS;
  }
 else {
    makeJobless();
  }
break;
case GOING_TO_POS:
super.lookInDirection(lookDirection);
state=EBricklayerState.BUILDING;
case BUILDING:
tryToBuild();
break;
}
}
Program: 56152
Project: 56152
Buggy source:
@Test public void testMerge(){
  DoubleLinkedList<DoubleLinkedIntListItem> list2=new DoubleLinkedList<DoubleLinkedIntListItem>();
  for (int i=0; i < TEST_NUMBERS; i++) {
    list.pushEnd(new DoubleLinkedIntListItem(i));
    list2.pushEnd(new DoubleLinkedIntListItem(i));
  }
  list2.mergeInto(list);
  assertEquals(0,list2.size());
  assertEquals(list2.head,((DoubleLinkedListItem<DoubleLinkedIntListItem>)list2.head).next);
  assertEquals(list2.head,((DoubleLinkedListItem<DoubleLinkedIntListItem>)list2.head).prev);
  int i=0;
  for (  DoubleLinkedIntListItem curr : list) {
    assertEquals(i % TEST_NUMBERS,curr.value);
    i++;
  }
}

Fixed version (ground truth):
@Test public void testMerge(){
  DoubleLinkedList<DoubleLinkedIntListItem> list2=new DoubleLinkedList<DoubleLinkedIntListItem>();
  for (int i=0; i < TEST_NUMBERS; i++) {
    list.pushEnd(new DoubleLinkedIntListItem(i));
    list2.pushEnd(new DoubleLinkedIntListItem(i));
  }
  list2.mergeInto(list);
  assertEquals(0,list2.size());
  assertEquals(TEST_NUMBERS * 2,list.size());
  assertEquals(list2.head,((DoubleLinkedListItem<DoubleLinkedIntListItem>)list2.head).next);
  assertEquals(list2.head,((DoubleLinkedListItem<DoubleLinkedIntListItem>)list2.head).prev);
  int i=0;
  for (  DoubleLinkedIntListItem curr : list) {
    assertEquals(i % TEST_NUMBERS,curr.value);
    i++;
  }
}
Program: 56153
Project: 56153
Buggy source:
@Override public final boolean setBuilding(ShortPoint2D position,Building newBuilding){
  if (MainGrid.this.isInBounds(position.x,position.y)) {
    FreeMapArea protectedArea=new FreeMapArea(position,newBuilding.getBuildingType().getProtectedTiles());
    if (canConstructAt(protectedArea)) {
      setProtectedState(protectedArea,true);
      mapObjectsManager.addBuildingTo(position,newBuilding);
      objectsGrid.setBuildingArea(new FreeMapArea(position,newBuilding.getBuildingType().getBlockedTiles()),newBuilding);
      return true;
    }
 else {
      return false;
    }
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public final boolean setBuilding(ShortPoint2D position,Building newBuilding){
  if (MainGrid.this.isInBounds(position.x,position.y)) {
    FreeMapArea protectedArea=new FreeMapArea(position,newBuilding.getBuildingType().getProtectedTiles());
    if (canConstructAt(protectedArea)) {
      setProtectedState(protectedArea,true);
      mapObjectsManager.addBuildingTo(position,newBuilding);
      objectsGrid.setBuildingArea(new FreeMapArea(position,newBuilding.getBuildingType().getBlockedTiles()),newBuilding);
      landscapeGrid.stopUnflattening(protectedArea);
      return true;
    }
 else {
      return false;
    }
  }
 else {
    return false;
  }
}
Program: 56154
Project: 56154
Buggy source:
private final void setProtectedState(FreeMapArea area,boolean setProtected){
  for (  ShortPoint2D curr : area) {
    if (MainGrid.this.isInBounds(curr.x,curr.y))     flagsGrid.setProtected(curr.x,curr.y,setProtected);
  }
}

Fixed version (ground truth):
private final void setProtectedState(FreeMapArea area,boolean setProtected){
  for (  ShortPoint2D curr : area) {
    flagsGrid.setProtected(curr.x,curr.y,setProtected);
  }
}
Program: 56155
Project: 56155
Buggy source:
@Override public final int getDebugColorAt(int x,int y){
  final int SCALE=4;
  int value=partitionsGrid.getPartitionIdAt(x,y);
  return Color.getABGR(((float)(value % SCALE)) / SCALE,((float)((value / SCALE) % SCALE)) / SCALE,((float)((value / SCALE / SCALE) % SCALE)) / SCALE,1);
}

Fixed version (ground truth):
@Override public final int getDebugColorAt(int x,int y){
  return flagsGrid.isMarked(x,y) ? Color.ORANGE.getARGB() : (objectsGrid.getMapObjectAt(x,y,EMapObjectType.INFORMABLE_MAP_OBJECT) != null ? Color.GREEN.getARGB() : (objectsGrid.getMapObjectAt(x,y,EMapObjectType.ATTACKABLE_TOWER) != null ? Color.RED.getARGB() : (flagsGrid.isBlocked(x,y) ? Color.BLACK.getARGB() : (flagsGrid.isProtected(x,y) ? Color.BLUE.getARGB() : 0))));
}
Program: 56156
Project: 56156
Buggy source:
@Override public final int getDebugColorAt(int x,int y){
  return flagsGrid.isMarked(x,y) ? Color.ORANGE.getARGB() : (objectsGrid.getMapObjectAt(x,y,EMapObjectType.INFORMABLE_MAP_OBJECT) != null ? Color.GREEN.getARGB() : (objectsGrid.getMapObjectAt(x,y,EMapObjectType.ATTACKABLE_TOWER) != null ? Color.RED.getARGB() : (flagsGrid.isBlocked(x,y) ? Color.BLACK.getARGB() : (flagsGrid.isProtected(x,y) ? Color.BLUE.getARGB() : 0))));
}

Fixed version (ground truth):
@Override public final int getDebugColorAt(int x,int y){
  final int SCALE=4;
  int value=partitionsGrid.getPartitionIdAt(x,y);
  return Color.getABGR(((float)(value % SCALE)) / SCALE,((float)((value / SCALE) % SCALE)) / SCALE,((float)((value / SCALE / SCALE) % SCALE)) / SCALE,1);
}
Program: 56157
Project: 56157
Buggy source:
/** 
 * Lets the given movable enter the given position.
 * @param position Position to be entered.
 * @param movable Movable that enters the position.
 */
public final void movableEntered(ShortPoint2D position,NewMovable movable){
  short x=position.x;
  short y=position.y;
  int idx=x + y * width;
  if (idx < 0) {
    System.out.println("String_Node_Str");
  }
  this.movableGrid[idx]=movable;
  if (movable != null && movable.getMovableType() == EMovableType.BEARER) {
    ground.walkOn(x,y);
  }
}

Fixed version (ground truth):
/** 
 * Lets the given movable enter the given position.
 * @param position Position to be entered.
 * @param movable Movable that enters the position.
 */
public final void movableEntered(ShortPoint2D position,NewMovable movable){
  short x=position.x;
  short y=position.y;
  int idx=x + y * width;
  if (idx < 0) {
    System.out.println("String_Node_Str");
  }
  NewMovable oldMovable=this.movableGrid[idx];
  if (oldMovable != null && oldMovable.getID() == -2147481896) {
    System.out.println();
  }
  this.movableGrid[idx]=movable;
  if (movable != null && movable.getMovableType() == EMovableType.BEARER) {
    ground.walkOn(x,y);
  }
}
Program: 56158
Project: 56158
Buggy source:
/** 
 * kills this movable.
 */
@Override public final void kill(){
  MovableTimer.remove(this);
  grid.leavePosition(this.position,this);
  this.health=0;
  this.strategy.strategyKilledEvent(path != null ? path.getTargetPos() : null);
  movablesByID.remove(this.getID());
  allMovables.remove(this);
  grid.addSelfDeletingMapObject(position,EMapObjectType.GHOST,Constants.GHOST_PLAY_DURATION,player);
}

Fixed version (ground truth):
/** 
 * kills this movable.
 */
@Override public final void kill(){
  if (health == -100) {
    return;
  }
  MovableTimer.remove(this);
  grid.leavePosition(this.position,this);
  this.health=-100;
  this.strategy.strategyKilledEvent(path != null ? path.getTargetPos() : null);
  movablesByID.remove(this.getID());
  allMovables.remove(this);
  grid.addSelfDeletingMapObject(position,EMapObjectType.GHOST,Constants.GHOST_PLAY_DURATION,player);
}
Program: 56159
Project: 56159
Buggy source:
@Override public void eventDataChanged(GOEvent event){
  Action action=getActionForDraw((GODrawEvent)event);
  if (action.getActionType() == EActionType.PAN_TO) {
    minimap.getContext().scrollTo(((PointAction)action).getPosition());
  }
}

Fixed version (ground truth):
@Override public void eventDataChanged(GOEvent event){
  Action action=getActionForDraw((GODrawEvent)event);
  if (action != null && action.getActionType() == EActionType.PAN_TO) {
    minimap.getContext().scrollTo(((PointAction)action).getPosition());
  }
}
Program: 56160
Project: 56160
Buggy source:
private void handleJobFailed(boolean reportAsJobless){
switch (state) {
case INIT_CARRY_JOB:
case GOING_TO_OFFER:
    reoffer();
case TAKING:
  if (targetMovableType != null) {
    workerRequester.workerCreationRequestFailed(targetMovableType,super.getPos());
  }
case GOING_TO_REQUEST:
if (request != null && request.isActive()) {
  request.deliveryAborted();
}
break;
case INIT_BECOME_SOLDIER_JOB:
case GOING_TO_BARRACK:
barrack.bearerRequestFailed();
break;
case DROPPING:
break;
case INIT_CONVERT_WITH_TOOL_JOB:
reoffer();
case INIT_CONVERT_JOB:
workerRequester.workerCreationRequestFailed(targetMovableType,super.getPos());
break;
case DEAD_OBJECT:
break;
case JOBLESS:
break;
default :
break;
}
EMaterialType carriedMaterial=super.setMaterial(EMaterialType.NO_MATERIAL);
if (carriedMaterial != EMaterialType.NO_MATERIAL) {
super.getStrategyGrid().dropMaterial(super.getPos(),materialType,true);
}
offer=null;
request=null;
materialType=null;
targetMovableType=null;
workerRequester=null;
state=EBearerState.JOBLESS;
if (reportAsJobless) {
reportAsJobless();
}
}

Fixed version (ground truth):
private void handleJobFailed(boolean reportAsJobless){
switch (state) {
case INIT_CARRY_JOB:
case GOING_TO_OFFER:
    reoffer();
case TAKING:
  if (targetMovableType != null) {
    workerRequester.workerCreationRequestFailed(targetMovableType,super.getPos());
  }
case GOING_TO_REQUEST:
if (request != null) {
  request.deliveryAborted();
}
break;
case INIT_BECOME_SOLDIER_JOB:
case GOING_TO_BARRACK:
barrack.bearerRequestFailed();
break;
case DROPPING:
break;
case INIT_CONVERT_WITH_TOOL_JOB:
reoffer();
case INIT_CONVERT_JOB:
workerRequester.workerCreationRequestFailed(targetMovableType,super.getPos());
break;
case DEAD_OBJECT:
break;
case JOBLESS:
break;
default :
break;
}
EMaterialType carriedMaterial=super.setMaterial(EMaterialType.NO_MATERIAL);
if (carriedMaterial != EMaterialType.NO_MATERIAL) {
super.getStrategyGrid().dropMaterial(super.getPos(),materialType,true);
}
offer=null;
request=null;
materialType=null;
targetMovableType=null;
workerRequester=null;
state=EBearerState.JOBLESS;
if (reportAsJobless) {
reportAsJobless();
}
}
Program: 56162
Project: 56162
Buggy source:
public boolean needsUpdate(){
  return needsUpdate;
}

Fixed version (ground truth):
public boolean needsUpdate(){
  return prefs.getBoolean(PREF_OUTDATED,true);
}
Program: 56163
Project: 56163
Buggy source:
public void startUpdate(final UpdateListener listener){
  if (isUpdating()) {
    return;
  }
  needsUpdate=false;
  setUpdating(true);
  new Thread(new Runnable(){
    @Override public void run(){
      try {
        updateFiles(createClient(),listener);
      }
 catch (      Throwable t) {
        setUpdating(false);
      }
      listener.setProgressState("String_Node_Str",1);
      if (listener != null) {
        listener.resourceUpdateFinished();
      }
    }
  }
,"String_Node_Str").start();
}

Fixed version (ground truth):
public void startUpdate(final UpdateListener listener){
  if (isUpdating()) {
    return;
  }
  setUpdating(true);
  new Thread(new Runnable(){
    @Override public void run(){
      try {
synchronized (updateMutex) {
          updateFiles(createClient(),listener);
        }
      }
 catch (      Throwable t) {
        t.printStackTrace();
      }
      setUpdating(false);
      listener.setProgressState("String_Node_Str",1);
      if (listener != null) {
        listener.resourceUpdateFinished();
      }
    }
  }
,"String_Node_Str").start();
}
Program: 56164
Project: 56164
Buggy source:
public ResourceUpdater(Context context,File destdir){
  this.resources=context.getResources();
  this.prefs=context.getSharedPreferences("String_Node_Str",0);
  this.destdir=destdir;
  int revHash=Revision.REVISION + LogicRevision.REVISION * 10000;
  if (prefs.getInt(PREF_REVISION,-1) != revHash || prefs.getBoolean(PREF_OUTDATED,false)) {
    needsUpdate=true;
  }
}

Fixed version (ground truth):
public ResourceUpdater(Context context,File destdir){
  this.resources=context.getResources();
  this.prefs=context.getSharedPreferences("String_Node_Str",0);
  this.destdir=destdir;
  int revHash=REVISION;
  if (prefs.getInt(PREF_REVISION,-1) != revHash) {
    requireUpdate();
  }
}
Program: 56165
Project: 56165
Buggy source:
@Override public void run(){
  try {
    updateFiles(createClient(),listener);
  }
 catch (  Throwable t) {
    setUpdating(false);
  }
  listener.setProgressState("String_Node_Str",1);
  if (listener != null) {
    listener.resourceUpdateFinished();
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
synchronized (updateMutex) {
      updateFiles(createClient(),listener);
    }
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
  setUpdating(false);
  listener.setProgressState("String_Node_Str",1);
  if (listener != null) {
    listener.resourceUpdateFinished();
  }
}
Program: 56166
Project: 56166
Buggy source:
private static String loadRevision(DefaultHttpClient httpClient) throws IOException, ClientProtocolException {
  final String url=SERVER_ROOT + "String_Node_Str";
  HttpGet httpRequest=new HttpGet(url);
  HttpResponse response=httpClient.execute(httpRequest);
  InputStream inputStream=response.getEntity().getContent();
  return getString(inputStream);
}

Fixed version (ground truth):
private static ServerData loadRevision(DefaultHttpClient httpClient) throws IOException, ClientProtocolException {
  final String url=SERVER_ROOT + "String_Node_Str";
  HttpGet httpRequest=new HttpGet(url);
  HttpResponse response=httpClient.execute(httpRequest);
  InputStream inputStream=response.getEntity().getContent();
  return new ServerData(getString(inputStream));
}
Program: 56167
Project: 56167
Buggy source:
@Override public void run(){
  while (!stopped) {
    updateLine();
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (!stopped) {
    try {
      updateLine();
    }
 catch (    Throwable e) {
      e.printStackTrace();
    }
  }
}
Program: 56168
Project: 56168
Buggy source:
@Override public final int getDebugColorAt(int x,int y){
  int value=partitionsGrid.getPartitionIdAt(x,y);
  return Color.getABGR((value % 3) * 0.33f,((value / 3) % 3) * 0.33f,((value / 9) % 3) * 0.33f,1);
}

Fixed version (ground truth):
@Override public final int getDebugColorAt(int x,int y){
  int value=partitionsGrid.getTowerCountAt(x,y) + 1;
  return Color.getABGR((value % 3) * 0.33f,((value / 3) % 3) * 0.33f,((value / 9) % 3) * 0.33f,1);
}
Program: 56169
Project: 56169
Buggy source:
@Override public void kill(){
  System.out.println("String_Node_Str");
  Timer100Milli.remove(this);
  placeReusableMaterials();
  releaseRequestStacks();
  this.state=STATE_DESTROYED;
  grid.removeBuildingAt(pos);
  grid.getMapObjectsManager().addSelfDeletingMapObject(pos,EMapObjectType.BUILDING_DECONSTRUCTION_SMOKE,BUILDING_DESTRUCTION_SMOKE_DURATION,player);
  placeAdditionalMapObjects(grid,pos,false);
  placeFlag(false);
  allBuildings.remove(this);
  killedEvent();
}

Fixed version (ground truth):
@Override public void kill(){
  System.out.println("String_Node_Str");
  Timer100Milli.remove(this);
  this.state=STATE_DESTROYED;
  grid.removeBuildingAt(pos);
  grid.getMapObjectsManager().addSelfDeletingMapObject(pos,EMapObjectType.BUILDING_DECONSTRUCTION_SMOKE,BUILDING_DESTRUCTION_SMOKE_DURATION,player);
  placeAdditionalMapObjects(grid,pos,false);
  placeFlag(false);
  allBuildings.remove(this);
  placeReusableMaterials();
  releaseRequestStacks();
  killedEvent();
}