nus-yam/ex-repair huggingface dataset:
Program: 56052
Project: 56052
Buggy source:
@Override public ShortPoint2D findBestConstructionPosition(AiStatistics aiStatistics,AbstractConstructionMarkableMap constructionMap,byte playerId){
  List<ScoredConstructionPosition> scoredConstructionPositions=new ArrayList<ScoredConstructionPosition>();
  for (  ShortPoint2D point : aiStatistics.getLandForPlayer(playerId)) {
    if (constructionMap.canConstructAt(point.x,point.y,buildingType,playerId) && !aiStatistics.blocksWorkingAreaOfOtherBuilding(point)) {
      ShortPoint2D fishPosition=aiStatistics.getNearestResourcePointForPlayer(point,FISH,playerId);
      if (fishPosition != null) {
        double fishDistance=aiStatistics.getDistance(point,fishPosition);
        scoredConstructionPositions.add(new ScoredConstructionPosition(point,fishDistance));
      }
    }
  }
  return ScoredConstructionPosition.detectPositionWithLowestScore(scoredConstructionPositions);
}

Fixed version (ground truth):
@Override public ShortPoint2D findBestConstructionPosition(AiStatistics aiStatistics,AbstractConstructionMarkableMap constructionMap,byte playerId){
  List<ScoredConstructionPosition> scoredConstructionPositions=new ArrayList<ScoredConstructionPosition>();
  double fishDistance=Double.MAX_VALUE;
  for (  ShortPoint2D point : aiStatistics.getLandForPlayer(playerId)) {
    if (constructionMap.canConstructAt(point.x,point.y,buildingType,playerId) && !aiStatistics.blocksWorkingAreaOfOtherBuilding(point)) {
      ShortPoint2D fishPosition=aiStatistics.getNearestResourcePointForPlayer(point,FISH,playerId,fishDistance);
      if (fishPosition != null) {
        fishDistance=aiStatistics.getDistance(point,fishPosition);
        scoredConstructionPositions.add(new ScoredConstructionPosition(point,fishDistance));
      }
    }
  }
  return ScoredConstructionPosition.detectPositionWithLowestScore(scoredConstructionPositions);
}
Program: 56053
Project: 56053
Buggy source:
private ImportantResource detectMostImportantResourcePoints(AiStatistics aiStatistics,byte playerId,ShortPoint2D referencePoint){
  List<ShortPoint2D> trees=aiStatistics.getTreesForPlayer(playerId);
  List<ShortPoint2D> stones=aiStatistics.getStonesForPlayer(playerId);
  List<ShortPoint2D> rivers=aiStatistics.getRiversForPlayer(playerId);
  if (trees.size() < 30) {
    return ImportantResource.TREES;
  }
  if (stones.size() < 7) {
    return ImportantResource.STONES;
  }
  if (rivers.size() < 15) {
    return ImportantResource.RIVER;
  }
  if (aiStatistics.getNearestResourcePointForPlayer(referencePoint,EResourceType.COAL,playerId) == null) {
    return ImportantResource.COAL;
  }
  if (aiStatistics.getNearestResourcePointForPlayer(referencePoint,EResourceType.IRON,playerId) == null) {
    return ImportantResource.IRON;
  }
  if (aiStatistics.getNearestResourcePointForPlayer(referencePoint,EResourceType.FISH,playerId) == null) {
    return ImportantResource.FISH;
  }
  if (aiStatistics.getNearestResourcePointForPlayer(referencePoint,EResourceType.GOLD,playerId) == null) {
    return ImportantResource.GOLD;
  }
  return ImportantResource.COAL;
}

Fixed version (ground truth):
private ImportantResource detectMostImportantResourcePoints(AiStatistics aiStatistics,byte playerId,ShortPoint2D referencePoint){
  List<ShortPoint2D> trees=aiStatistics.getTreesForPlayer(playerId);
  List<ShortPoint2D> stones=aiStatistics.getStonesForPlayer(playerId);
  List<ShortPoint2D> rivers=aiStatistics.getRiversForPlayer(playerId);
  if (trees.size() < 30) {
    return ImportantResource.TREES;
  }
  if (stones.size() < 7) {
    return ImportantResource.STONES;
  }
  if (rivers.size() < 15) {
    return ImportantResource.RIVER;
  }
  if (aiStatistics.getNearestResourcePointForPlayer(referencePoint,EResourceType.COAL,playerId,Double.MAX_VALUE) == null) {
    return ImportantResource.COAL;
  }
  if (aiStatistics.getNearestResourcePointForPlayer(referencePoint,EResourceType.IRON,playerId,Double.MAX_VALUE) == null) {
    return ImportantResource.IRON;
  }
  if (aiStatistics.getNearestResourcePointForPlayer(referencePoint,EResourceType.FISH,playerId,Double.MAX_VALUE) == null) {
    return ImportantResource.FISH;
  }
  if (aiStatistics.getNearestResourcePointForPlayer(referencePoint,EResourceType.GOLD,playerId,Double.MAX_VALUE) == null) {
    return ImportantResource.GOLD;
  }
  return ImportantResource.COAL;
}
Program: 56055
Project: 56055
Buggy source:
public ShortPoint2D getNearestResourcePointForPlayer(ShortPoint2D point,EResourceType resourceType,byte playerId){
  Map<Integer,List<Integer>> sortedResourcePoints=landscapeGrid.getSortedMapForResourceType(resourceType);
  return getNearestPointInDefaultPartitionOutOfSortedMap(point,sortedResourcePoints,playerId);
}

Fixed version (ground truth):
public ShortPoint2D getNearestResourcePointForPlayer(ShortPoint2D point,EResourceType resourceType,byte playerId,double currentNearestPointDistance){
  Map<Integer,List<Integer>> sortedResourcePoints=landscapeGrid.getSortedMapForResourceType(resourceType);
  return getNearestPointInDefaultPartitionOutOfSortedMap(point,sortedResourcePoints,playerId,currentNearestPointDistance);
}
Program: 56056
Project: 56056
Buggy source:
public void updateStatistics(){
  long startTime=System.currentTimeMillis();
  updateBuildingStatistics();
  updateMapStatistics();
  System.out.println(this.getClass().getSimpleName() + "String_Node_Str" + Thread.currentThread().getStackTrace()[1].getMethodName()+ "String_Node_Str"+ (System.currentTimeMillis() - startTime)+ "String_Node_Str");
}

Fixed version (ground truth):
public void updateStatistics(){
  updateBuildingStatistics();
  updateMapStatistics();
}
Program: 56057
Project: 56057
Buggy source:
public ShortPoint2D getNearestRiverPointInDefaultPartitionFor(ShortPoint2D referencePoint){
  return getNearestPointInDefaultPartitionOutOfSortedMap(referencePoint,sortedRiversInDefaultPartition,(byte)-1);
}

Fixed version (ground truth):
public ShortPoint2D getNearestRiverPointInDefaultPartitionFor(ShortPoint2D referencePoint,double currentNearestPointDistance){
  return getNearestPointInDefaultPartitionOutOfSortedMap(referencePoint,sortedRiversInDefaultPartition,(byte)-1,currentNearestPointDistance);
}
Program: 56058
Project: 56058
Buggy source:
public ShortPoint2D getNearestCuttableObjectPointInDefaultPartitionFor(ShortPoint2D point,EMapObjectType cuttableObject){
  Map<Integer,List<Integer>> sortedResourcePoints=sortedCuttableObjectsInDefaultPartition.get(cuttableObject);
  return getNearestPointInDefaultPartitionOutOfSortedMap(point,sortedResourcePoints,(byte)-1);
}

Fixed version (ground truth):
public ShortPoint2D getNearestCuttableObjectPointInDefaultPartitionFor(ShortPoint2D point,EMapObjectType cuttableObject,double currentNearestPointDistance){
  Map<Integer,List<Integer>> sortedResourcePoints=sortedCuttableObjectsInDefaultPartition.get(cuttableObject);
  return getNearestPointInDefaultPartitionOutOfSortedMap(point,sortedResourcePoints,(byte)-1,currentNearestPointDistance);
}
Program: 56059
Project: 56059
Buggy source:
@Override protected boolean checkPathStepPreconditions(ShortPoint2D pathTarget,int step){
  boolean result=!((state == ESoldierState.SEARCH_FOR_ENEMIES || state == ESoldierState.HITTING) && step >= 2);
  if (!result && oldPathTarget == null) {
    oldPathTarget=pathTarget;
  }
  if (state == ESoldierState.GOING_TO_TOWER && (!building.isNotDestroyed() || building.getPlayer() != super.getPlayer())) {
    result=false;
  }
  return result;
}

Fixed version (ground truth):
@Override protected boolean checkPathStepPreconditions(ShortPoint2D pathTarget,int step){
  boolean result=!((state == ESoldierState.SEARCH_FOR_ENEMIES || state == ESoldierState.HITTING) && step >= 2);
  if (!result && oldPathTarget == null) {
    oldPathTarget=pathTarget;
  }
  if (state == ESoldierState.GOING_TO_TOWER && (!building.isNotDestroyed() || building.getPlayer() != super.getPlayer())) {
    result=false;
  }
  if (enemy != null && state == ESoldierState.SEARCH_FOR_ENEMIES && isEnemyAttackable(enemy,false)) {
    result=false;
  }
  return result;
}
Program: 56061
Project: 56061
Buggy source:
public AiExecutor(List<Byte> aiPlayers,MainGrid mainGrid,ITaskScheduler taskScheduler){
  shutdownRequested=false;
  aiStatistics=new AiStatistics(mainGrid);
  this.whatToDoAis=new ArrayList<IWhatToDoAi>();
  nextExecutionTime=0;
  for (  byte playerId : aiPlayers) {
    whatToDoAis.add(new RomanWhatToDoAi(playerId,aiStatistics,mainGrid,taskScheduler));
  }
}

Fixed version (ground truth):
public AiExecutor(List<Byte> aiPlayers,MainGrid mainGrid,ITaskScheduler taskScheduler){
  aiStatistics=new AiStatistics(mainGrid);
  this.whatToDoAis=new ArrayList<IWhatToDoAi>();
  nextExecutionTime=0;
  for (  byte playerId : aiPlayers) {
    whatToDoAis.add(new RomanWhatToDoAi(playerId,aiStatistics,mainGrid,taskScheduler));
  }
}
Program: 56062
Project: 56062
Buggy source:
private ShortPoint2D getNearestPointInDefaultPartitionOutOfSortedMap(ShortPoint2D point,Map<Integer,List<Integer>> sortedPoints,byte playerId){
  ShortPoint2D result=null;
  double currentNearestPointDistance=Double.MAX_VALUE;
  ShortPoint2D nearestRightPoint=getNearestPoinInDefaultPartionOutOfSortedMapInXDirection(point,sortedPoints,currentNearestPointDistance,new Integer(point.x),1,new Integer(mainGrid.getWidth() + 1),playerId);
  if (nearestRightPoint != null) {
    currentNearestPointDistance=getDistance(point,nearestRightPoint);
    result=nearestRightPoint;
  }
  ShortPoint2D nearestLeftPoint=getNearestPoinInDefaultPartionOutOfSortedMapInXDirection(point,sortedPoints,currentNearestPointDistance,new Integer(point.x - 1),-1,-1,playerId);
  if (nearestLeftPoint != null) {
    result=nearestLeftPoint;
  }
  return result;
}

Fixed version (ground truth):
private ShortPoint2D getNearestPointInDefaultPartitionOutOfSortedMap(ShortPoint2D point,Map<Integer,List<Integer>> sortedPoints,byte playerId,double currentNearestPointDistance){
  ShortPoint2D result=null;
  ShortPoint2D nearestRightPoint=getNearestPoinInDefaultPartionOutOfSortedMapInXDirection(point,sortedPoints,currentNearestPointDistance,new Integer(point.x),1,new Integer(mainGrid.getWidth() + 1),playerId);
  if (nearestRightPoint != null) {
    currentNearestPointDistance=getDistance(point,nearestRightPoint);
    result=nearestRightPoint;
  }
  ShortPoint2D nearestLeftPoint=getNearestPoinInDefaultPartionOutOfSortedMapInXDirection(point,sortedPoints,currentNearestPointDistance,new Integer(point.x - 1),-1,-1,playerId);
  if (nearestLeftPoint != null) {
    result=nearestLeftPoint;
  }
  return result;
}
Program: 56063
Project: 56063
Buggy source:
public void updateStatistics(){
  updateBuildingStatistics();
  updateMapStatistics();
}

Fixed version (ground truth):
public void updateStatistics(){
  long startTime=System.currentTimeMillis();
  updateBuildingStatistics();
  updateMapStatistics();
  System.out.println(this.getClass().getSimpleName() + "String_Node_Str" + Thread.currentThread().getStackTrace()[1].getMethodName()+ "String_Node_Str"+ (System.currentTimeMillis() - startTime)+ "String_Node_Str");
}
Program: 56064
Project: 56064
Buggy source:
public ShortPoint2D getNearestResourcePointInDefaultPartitionFor(ShortPoint2D point,EResourceType resourceType){
  Map<Integer,List<Integer>> sortedResourcePoints=landscapeGrid.getSortedMapForResourceType(resourceType);
  return getNearestPointInDefaultPartitionOutOfSortedMap(point,sortedResourcePoints,(byte)-1);
}

Fixed version (ground truth):
public ShortPoint2D getNearestResourcePointInDefaultPartitionFor(ShortPoint2D point,EResourceType resourceType,double currentNearestPointDistance){
  Map<Integer,List<Integer>> sortedResourcePoints=landscapeGrid.getSortedMapForResourceType(resourceType);
  return getNearestPointInDefaultPartitionOutOfSortedMap(point,sortedResourcePoints,(byte)-1,currentNearestPointDistance);
}
Program: 56065
Project: 56065
Buggy source:
public void setActiveItem(T activeItem){
  if (items.contains(activeItem)) {
    this.activeItem=activeItem;
  }
}

Fixed version (ground truth):
public void setActiveItem(T activeItem){
synchronized (itemsMutex) {
    if (items.contains(activeItem)) {
      this.activeItem=activeItem;
    }
  }
}
Program: 56066
Project: 56066
Buggy source:
public void setItems(List<? extends T> list){
synchronized (itemsMutex) {
    this.items=list;
    if (items.size() > 0) {
      activeItem=items.get(0);
    }
 else {
      activeItem=null;
    }
  }
}

Fixed version (ground truth):
public void setItems(List<? extends T> list){
synchronized (itemsMutex) {
    this.items=list;
    if (!items.contains(activeItem)) {
      if (items.size() > 0) {
        activeItem=items.get(0);
      }
 else {
        activeItem=null;
      }
    }
  }
}
Program: 56067
Project: 56067
Buggy source:
/** 
 * Notifies this listener of the current progress of the start. May only be called before   {@link #startFinished(IStartedGame)} is called.
 * @param state
 * @param progress
 */
void startProgressChanged(EProgressState state,float progress);

Fixed version (ground truth):
/** 
 * Notifies this listener of the current progress of the start. May only be called before   {@link #preLoadFinished(IStartedGame)} is called.
 * @param state
 * @param progress
 */
void startProgressChanged(EProgressState state,float progress);
Program: 56068
Project: 56068
Buggy source:
/** 
 * Notifies the listener that a game was started and gives it access to the game data.
 * @param game The game that was just started.
 * @retrun A {@link IMapInterfaceConnector} that can be used to access the game afterwards.
 */
IMapInterfaceConnector startFinished(IStartedGame game);

Fixed version (ground truth):
void startFinished();
Program: 56069
Project: 56069
Buggy source:
@Override public MapInterfaceConnector startFinished(IStartedGame game){
  MapContent content=new MapContent(game,contentSetable.getSoundPlayer());
  contentSetable.setContent(content);
  game.setGameExitListener(new IGameExitListener(){
    @Override public void gameExited(    IStartedGame game){
      contentSetable.goToStartScreen("String_Node_Str");
    }
  }
);
  return content.getInterfaceConnector();
}

Fixed version (ground truth):
@Override public void startFinished(){
}
Program: 56071
Project: 56071
Buggy source:
@Override public IMapInterfaceConnector startFinished(IStartedGame game){
  startedGame=game;
synchronized (waitMutex) {
    waitMutex.notifyAll();
  }
  return new DummyMapInterfaceConnector();
}

Fixed version (ground truth):
@Override public void startFinished(){
synchronized (waitMutex) {
    waitMutex.notifyAll();
  }
}
Program: 56072
Project: 56072
Buggy source:
@Override public MapInterfaceConnector startFinished(IStartedGame game){
  return getJsettlersActivity().showGameMap(game);
}

Fixed version (ground truth):
@Override public void startFinished(){
}
Program: 56073
Project: 56073
Buggy source:
private String getLockstepText(int lockstep){
  int hours=time / (1000 * 60 * 60);
  int minutes=(time / (1000 * 60)) % 60;
  int seconds=(time / 1000) % 60;
  int millis=time % 1000;
  return String.format("String_Node_Str",lockstep,time,hours,minutes,seconds,millis);
}

Fixed version (ground truth):
private String getLockstepText(int lockstep){
  int time=lockstep * NetworkConstants.Client.LOCKSTEP_PERIOD;
  int hours=time / (1000 * 60 * 60);
  int minutes=(time / (1000 * 60)) % 60;
  int seconds=(time / 1000) % 60;
  int millis=time % 1000;
  return String.format("String_Node_Str",lockstep,time,hours,minutes,seconds,millis);
}
Program: 56075
Project: 56075
Buggy source:
private void pathingAction(){
  if (!path.hasNextStep() || !strategy.checkPathStepPreconditions(path.getTargetPos(),path.getStep())) {
    setState(EMovableState.DOING_NOTHING);
    movableAction=EAction.NO_ACTION;
    path=null;
    checkPlayerOfCurrentPosition();
    return;
  }
  direction=EDirection.getDirection(position.x,position.y,path.nextX(),path.nextY());
  if (grid.hasNoMovableAt(path.nextX(),path.nextY())) {
    if (!grid.isValidNextPathPosition(this,path.getNextPos(),path.getTargetPos())) {
      Path newPath=grid.calculatePathTo(this,path.getTargetPos());
      if (newPath == null) {
        setState(EMovableState.DOING_NOTHING);
        movableAction=EAction.NO_ACTION;
        strategy.pathAborted(path.getTargetPos());
        path=null;
        return;
      }
 else {
        this.path=newPath;
      }
    }
    goSinglePathStep();
  }
 else {
    movableAction=EAction.NO_ACTION;
    boolean pushedSuccessful=grid.getMovableAt(path.nextX(),path.nextY()).push(this);
    if (!pushedSuccessful) {
      path=strategy.findWayAroundObstacle(direction,position,path);
      animationDuration=Constants.MOVABLE_INTERRUPT_PERIOD;
    }
  }
}

Fixed version (ground truth):
private void pathingAction(){
  if (!path.hasNextStep() || !strategy.checkPathStepPreconditions(path.getTargetPos(),path.getStep())) {
    setState(EMovableState.DOING_NOTHING);
    movableAction=EAction.NO_ACTION;
    path=null;
    checkPlayerOfCurrentPosition();
    return;
  }
  direction=EDirection.getDirection(position.x,position.y,path.nextX(),path.nextY());
  if (grid.hasNoMovableAt(path.nextX(),path.nextY())) {
    if (!grid.isValidNextPathPosition(this,path.getNextPos(),path.getTargetPos())) {
      Path newPath=grid.calculatePathTo(this,path.getTargetPos());
      if (newPath == null) {
        setState(EMovableState.DOING_NOTHING);
        movableAction=EAction.NO_ACTION;
        strategy.pathAborted(path.getTargetPos());
        path=null;
        return;
      }
 else {
        this.path=newPath;
      }
    }
    goSinglePathStep();
  }
 else {
    movableAction=EAction.NO_ACTION;
    boolean pushedSuccessful=grid.getMovableAt(path.nextX(),path.nextY()).push(this);
    if (!pushedSuccessful) {
      path=strategy.findWayAroundObstacle(direction,position,path);
    }
 else     if (movableAction == EAction.NO_ACTION) {
      animationDuration=Constants.MOVABLE_INTERRUPT_PERIOD;
    }
  }
}
Program: 56076
Project: 56076
Buggy source:
@Override public Path searchDijkstra(IPathCalculatable pathCalculateable,short centerX,short centerY,short radius,ESearchType searchType){
  return dijkstra.find(pathCalculateable,centerX,centerY,(short)1,radius,searchType);
}

Fixed version (ground truth):
@Override public Path searchDijkstra(IPathCalculatable pathCalculateable,short centerX,short centerY,short radius,ESearchType searchType){
  return dijkstra.find(pathCalculateable,centerX,centerY,(short)0,radius,searchType);
}
Program: 56077
Project: 56077
Buggy source:
private void pathingAction(){
  if (!path.hasNextStep() || !strategy.checkPathStepPreconditions(path.getTargetPos(),path.getStep())) {
    setState(EMovableState.DOING_NOTHING);
    movableAction=EAction.NO_ACTION;
    path=null;
    checkPlayerOfCurrentPosition();
    return;
  }
  direction=EDirection.getDirection(position.x,position.y,path.nextX(),path.nextY());
  if (grid.hasNoMovableAt(path.nextX(),path.nextY())) {
    if (!grid.isValidNextPathPosition(this,path.getNextPos(),path.getTargetPos())) {
      Path newPath=grid.calculatePathTo(this,path.getTargetPos());
      if (newPath == null) {
        setState(EMovableState.DOING_NOTHING);
        movableAction=EAction.NO_ACTION;
        strategy.pathAborted(path.getTargetPos());
        path=null;
        return;
      }
 else {
        this.path=newPath;
      }
    }
    goSinglePathStep();
  }
 else {
    movableAction=EAction.NO_ACTION;
    boolean pushedSuccessful=grid.getMovableAt(path.nextX(),path.nextY()).push(this);
    if (!pushedSuccessful) {
      path=strategy.findWayAroundObstacle(direction,position,path);
    }
  }
}

Fixed version (ground truth):
private void pathingAction(){
  if (!path.hasNextStep() || !strategy.checkPathStepPreconditions(path.getTargetPos(),path.getStep())) {
    setState(EMovableState.DOING_NOTHING);
    movableAction=EAction.NO_ACTION;
    path=null;
    checkPlayerOfCurrentPosition();
    return;
  }
  direction=EDirection.getDirection(position.x,position.y,path.nextX(),path.nextY());
  if (grid.hasNoMovableAt(path.nextX(),path.nextY())) {
    if (!grid.isValidNextPathPosition(this,path.getNextPos(),path.getTargetPos())) {
      Path newPath=grid.calculatePathTo(this,path.getTargetPos());
      if (newPath == null) {
        setState(EMovableState.DOING_NOTHING);
        movableAction=EAction.NO_ACTION;
        strategy.pathAborted(path.getTargetPos());
        path=null;
        return;
      }
 else {
        this.path=newPath;
      }
    }
    goSinglePathStep();
  }
 else {
    movableAction=EAction.NO_ACTION;
    boolean pushedSuccessful=grid.getMovableAt(path.nextX(),path.nextY()).push(this);
    if (!pushedSuccessful) {
      path=strategy.findWayAroundObstacle(direction,position,path);
      animationDuration=Constants.MOVABLE_INTERRUPT_PERIOD;
    }
  }
}
Program: 56078
Project: 56078
Buggy source:
@Override public final void debug(){
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
@Override public final void debug(){
  System.out.println("String_Node_Str" + this);
}
Program: 56079
Project: 56079
Buggy source:
protected void play(){
  try {
    File temp=File.createTempFile("String_Node_Str","String_Node_Str");
    data.doPreSaveActions();
    MapSaver.saveMap(generateMapHeader(),data,new FileOutputStream(temp));
    String[] args=new String[]{"String_Node_Str","String_Node_Str",System.getProperty("String_Node_Str"),SwingManagedJSettlers.class.getName(),"String_Node_Str" + temp.getAbsolutePath()};
    System.out.println("String_Node_Str");
    for (    String arg : args) {
      System.out.print(arg + "String_Node_Str");
    }
    System.out.println();
    File working=new File("String_Node_Str").getAbsoluteFile();
    System.out.println("String_Node_Str" + working);
    ProcessBuilder builder=new ProcessBuilder(args);
    builder.directory(working);
    builder.redirectErrorStream(true);
    final Process process=builder.start();
    new Thread(new Runnable(){
      @Override public void run(){
        BufferedReader reader=new BufferedReader(new InputStreamReader(process.getInputStream()));
        while (true) {
          String line;
          try {
            line=reader.readLine();
          }
 catch (          IOException e) {
            break;
          }
          if (line == null) {
            break;
          }
          System.out.println("String_Node_Str" + line);
        }
      }
    }
,"String_Node_Str");
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
protected void play(){
  try {
    File temp=File.createTempFile("String_Node_Str","String_Node_Str");
    data.doPreSaveActions();
    MapSaver.saveMap(generateMapHeader(),data,new FileOutputStream(temp));
    String[] args=new String[]{"String_Node_Str","String_Node_Str",System.getProperty("String_Node_Str"),SwingManagedJSettlers.class.getName(),"String_Node_Str" + temp.getAbsolutePath()};
    System.out.println("String_Node_Str");
    for (    String arg : args) {
      System.out.print(arg + "String_Node_Str");
    }
    System.out.println();
    ProcessBuilder builder=new ProcessBuilder(args);
    builder.redirectErrorStream(true);
    final Process process=builder.start();
    new Thread(new Runnable(){
      @Override public void run(){
        BufferedReader reader=new BufferedReader(new InputStreamReader(process.getInputStream()));
        while (true) {
          String line;
          try {
            line=reader.readLine();
          }
 catch (          IOException e) {
            break;
          }
          if (line == null) {
            break;
          }
          System.out.println("String_Node_Str" + line);
        }
      }
    }
,"String_Node_Str");
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 56080
Project: 56080
Buggy source:
public String[] getSndFolders(){
  return getFolders("String_Node_Str");
}

Fixed version (ground truth):
public String[] getSndFolders(){
  return getFolders("String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 56081
Project: 56081
Buggy source:
private String[] getFolders(String string){
  String[] result=properties.getProperty("String_Node_Str").split(SPLIT_CHARACTER);
  for (int i=0; i < result.length; i++) {
    result[i]=result[i].replaceFirst("String_Node_Str","String_Node_Str" + string);
  }
  return result;
}

Fixed version (ground truth):
private String[] getFolders(String... subfolders){
  String[] settlersFolder=properties.getProperty("String_Node_Str").split(SPLIT_CHARACTER);
  String[] result=new String[settlersFolder.length * subfolders.length];
  int resultIdx=0;
  for (int subfolderIdx=0; subfolderIdx < subfolders.length; subfolderIdx++) {
    for (int folderIdx=0; folderIdx < settlersFolder.length; folderIdx++) {
      result[resultIdx++]=settlersFolder[folderIdx].replaceFirst("String_Node_Str","String_Node_Str" + subfolders[subfolderIdx]);
    }
  }
  return result;
}
Program: 56082
Project: 56082
Buggy source:
public String[] getGfxFolders(){
  return getFolders("String_Node_Str");
}

Fixed version (ground truth):
public String[] getGfxFolders(){
  return getFolders("String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 56083
Project: 56083
Buggy source:
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);
    }
  }
}

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     if (!bricklayerRequest.isCreationRequested()) {
      createNewToolUserIfLimitNotExceeded(EMovableType.BRICKLAYER,bricklayerRequest.getPos());
      bricklayerRequest.creationRequested();
      bricklayerRequests.offerLast(bricklayerRequest);
    }
 else {
      bricklayerRequests.offerLast(bricklayerRequest);
    }
  }
}
Program: 56084
Project: 56084
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(protectedArea,newBuilding);
      return true;
    }
 else {
      return false;
    }
  }
 else {
    return false;
  }
}
Program: 56085
Project: 56085
Buggy source:
@Override public final void removeBuildingAt(ShortPoint2D pos){
  IBuilding building=(IBuilding)objectsGrid.getMapObjectAt(pos.x,pos.y,EMapObjectType.BUILDING);
  mapObjectsManager.removeMapObjectType(pos.x,pos.y,EMapObjectType.BUILDING);
  FreeMapArea area=new FreeMapArea(pos,building.getBuildingType().getProtectedTiles());
  objectsGrid.setBuildingArea(area,null);
  for (  ShortPoint2D curr : area) {
    short x=curr.x;
    short y=curr.y;
    if (isInBounds(x,y)) {
      flagsGrid.setBlockedAndProtected(x,y,false);
    }
  }
}

Fixed version (ground truth):
@Override public final void removeBuildingAt(ShortPoint2D pos){
  IBuilding building=(IBuilding)objectsGrid.getMapObjectAt(pos.x,pos.y,EMapObjectType.BUILDING);
  mapObjectsManager.removeMapObjectType(pos.x,pos.y,EMapObjectType.BUILDING);
  FreeMapArea area=new FreeMapArea(pos,building.getBuildingType().getProtectedTiles());
  objectsGrid.setBuildingArea(area,null);
  for (  ShortPoint2D curr : area) {
    short x=curr.x;
    short y=curr.y;
    if (isInBounds(x,y)) {
      StackMapObject stack=(StackMapObject)objectsGrid.getMapObjectAt(x,y,EMapObjectType.STACK_OBJECT);
      flagsGrid.setBlockedAndProtected(x,y,false,stack != null);
    }
  }
}
Program: 56086
Project: 56086
Buggy source:
/** 
 * sets this position blocked and protected.
 * @param x x coordinate
 * @param y y coordinate
 * @param blocked the position will be set to blocked and protected if blocked == true<br> otherwise it will be set to unblocked and unprotected.
 */
public void setBlockedAndProtected(int x,int y,boolean blocked){
  final int idx=x + y * width;
  this.blockedGrid.set(idx,blocked);
  this.protectedGrid.set(idx,blocked);
  if (blockingChangedListener != null) {
    this.blockingChangedListener.blockingChanged(x,y,blocked);
  }
  if (protectedChangedListener != null) {
    this.protectedChangedListener.protectedChanged(x,y,blocked);
  }
}

Fixed version (ground truth):
/** 
 * Sets this position's blocked and protected.
 * @param x x coordinate
 * @param y y coordinate
 * @param blocked new blocked value of this position
 * @param newProtected new protected value of this position
 */
public void setBlockedAndProtected(int x,int y,boolean blocked,boolean newProtected){
  final int idx=x + y * width;
  this.blockedGrid.set(idx,blocked);
  this.protectedGrid.set(idx,newProtected);
  if (blockingChangedListener != null) {
    this.blockingChangedListener.blockingChanged(x,y,blocked);
  }
  if (protectedChangedListener != null) {
    this.protectedChangedListener.protectedChanged(x,y,newProtected);
  }
}
Program: 56087
Project: 56087
Buggy source:
private final void removeStackObject(short x,short y,StackMapObject stackObject){
  removeMapObject(x,y,stackObject);
  if (grid.getMapObject(x,y,EMapObjectType.STACK_OBJECT) == null) {
    grid.setProtected(x,y,false);
  }
}

Fixed version (ground truth):
private final void removeStackObject(short x,short y,StackMapObject stackObject){
  removeMapObject(x,y,stackObject);
  if (!grid.isBuildingAreaAt(x,y) && grid.getMapObject(x,y,EMapObjectType.STACK_OBJECT) == null) {
    grid.setProtected(x,y,false);
  }
}
Program: 56088
Project: 56088
Buggy source:
private void reoffer(){
  super.getStrategyGrid().takeMaterial(offer,materialType);
  super.getStrategyGrid().dropMaterial(offer,materialType,true);
}

Fixed version (ground truth):
private void reoffer(){
  if (super.getStrategyGrid().takeMaterial(offer,materialType)) {
    super.getStrategyGrid().dropMaterial(offer,materialType,true);
  }
}
Program: 56089
Project: 56089
Buggy source:
/** 
 * Schedules the given   {@link IScheduledTimerable} in max delay milliseconds.
 * @param t
 * @param delay
 */
public static void add(IScheduledTimerable t,int delay){
  get().add_(t,delay);
}

Fixed version (ground truth):
/** 
 * Schedules the given   {@link IScheduledTimerable} in max delay milliseconds.
 * @param t
 * @param delay
 */
public static void add(IScheduledTimerable t,int delay){
  get().addTimerable(t,delay);
}
Program: 56090
Project: 56090
Buggy source:
@Override public void timerEvent(){
  ArrayList<IScheduledTimerable> queue=timerables[currTimeSlot];
  for (  IScheduledTimerable curr : queue) {
    try {
      int delay=curr.timerEvent();
      add_(curr,delay);
    }
 catch (    Throwable t) {
      System.err.println("String_Node_Str");
      t.printStackTrace();
      try {
        curr.kill();
      }
 catch (      Throwable t2) {
        System.err.println("String_Node_Str");
        t2.printStackTrace();
      }
    }
  }
  queue.clear();
  currTimeSlot=(currTimeSlot + 1) % TIME_SLOTS;
}

Fixed version (ground truth):
@Override public void timerEvent(){
  ArrayList<IScheduledTimerable> queue=timerables[currTimeSlot];
  for (  IScheduledTimerable curr : queue) {
    try {
      int delay=curr.timerEvent();
      addTimerable(curr,delay);
    }
 catch (    Throwable t) {
      System.err.println("String_Node_Str");
      t.printStackTrace();
      try {
        curr.kill();
      }
 catch (      Throwable t2) {
        System.err.println("String_Node_Str");
        t2.printStackTrace();
      }
    }
  }
  queue.clear();
  currTimeSlot=(currTimeSlot + 1) % TIME_SLOTS;
}
Program: 56091
Project: 56091
Buggy source:
public Thread startPreloading(){
  Thread thread=new Thread(new ImagePreloadTask(),"String_Node_Str");
  thread.start();
  return thread;
}

Fixed version (ground truth):
/** 
 * Starts preloading the images, if lookup paths have been set.
 * @return
 */
public Thread startPreloading(){
  if (!lookupPaths.isEmpty()) {
    Thread thread=new Thread(new ImagePreloadTask(),"String_Node_Str");
    thread.start();
    return thread;
  }
 else {
    return null;
  }
}
Program: 56094
Project: 56094
Buggy source:
/** 
 * Draws a given map content.
 * @param context The context to draw at.
 * @param screen2
 */
public void drawMapContent(MapDrawContext context,FloatRectangle screen){
  GLDrawContext gl=context.getGl();
  MapRectangle screenArea=context.getConverter().getMapForScreen(screen);
  if (!gl.isGeometryValid(geometryindex) || screenArea.getLineLength() + 1 != bufferwidth || screenArea.getLines() != bufferheight) {
    regenerateGeometry(gl,screenArea);
    oldBufferPosition=null;
  }
  GLBuffer boundbuffer=gl.startWriteGeometry(geometryindex);
  reloadGeometry(boundbuffer,screenArea,context);
  gl.endWriteGeometry(geometryindex);
  gl.glPushMatrix();
  gl.glTranslatef(0,0,-.1f);
  gl.glScalef(1,1,0);
  gl.glMultMatrixf(context.getConverter().getMatrixWithHeight(),0);
  gl.color(1,1,1,1);
  gl.drawTrianglesWithTextureColored(getTexture(context.getGl()),geometryindex,geometrytirs);
  gl.glPopMatrix();
}

Fixed version (ground truth):
/** 
 * Draws a given map content.
 * @param context The context to draw at.
 * @param screen2
 */
public void drawMapContent(MapDrawContext context,FloatRectangle screen){
  GLDrawContext gl=context.getGl();
  MapRectangle screenArea=context.getConverter().getMapForScreen(screen);
  if (!gl.isGeometryValid(geometryindex) || screenArea.getLineLength() + 1 != bufferwidth || screenArea.getLines() != bufferheight) {
    regenerateGeometry(gl,screenArea);
  }
  GLBuffer boundbuffer=gl.startWriteGeometry(geometryindex);
  reloadGeometry(boundbuffer,screenArea,context);
  gl.endWriteGeometry(geometryindex);
  gl.glPushMatrix();
  gl.glTranslatef(0,0,-.1f);
  gl.glScalef(1,1,0);
  gl.glMultMatrixf(context.getConverter().getMatrixWithHeight(),0);
  gl.color(1,1,1,1);
  gl.drawTrianglesWithTextureColored(getTexture(context.getGl()),geometryindex,geometrytirs);
  gl.glPopMatrix();
}
Program: 56095
Project: 56095
Buggy source:
/** 
 * Sets up the   {@link ResourceManager} by using a configuration file. <br>First it is checked, if the given argsMap contains a "configFile" parameter. If so, the path specified for this parameter is used to get the file. <br> If the parameter is not given, the defaultConfigFile is used.
 * @param argsMap
 * @param defaultConfigFileName
 * @throws FileNotFoundException
 * @throws IOException
 */
public static void setupResourceManagers(HashMap<String,String> argsMap,String defaultConfigFileName) throws FileNotFoundException, IOException {
  File configFile=getConfigFile(argsMap,defaultConfigFileName);
  SwingResourceLoader.setupResourcesManagerByConfigFile(configFile);
}

Fixed version (ground truth):
/** 
 * Sets up the   {@link ResourceManager} by using a configuration file. <br>First it is checked, if the given argsMap contains a "configFile" parameter. If so, the path specified for this parameter is used to get the file. <br> If the parameter is not given, the defaultConfigFile is used.
 * @param argsMap
 * @param defaultConfigFileName
 * @throws FileNotFoundException
 * @throws IOException
 */
public static void setupResourceManagers(HashMap<String,String> argsMap,String defaultConfigFileName) throws FileNotFoundException, IOException {
  File configFile=getConfigFile(argsMap,defaultConfigFileName);
  SwingResourceLoader.setupSwingResourcesByConfigFile(configFile);
}
Program: 56096
Project: 56096
Buggy source:
public void execute() throws IOException {
  if (destinationDirectory == null) {
    throw new RuntimeException("String_Node_Str");
  }
  if (configFile == null) {
    throw new RuntimeException("String_Node_Str");
  }
  SwingResourceLoader.setupResourcesManagerByConfigFile(configFile);
  String listOutputPackage=listOutputClass.replaceAll("String_Node_Str","String_Node_Str");
  File listOutputDir=new File(listOutputDirectory.getAbsolutePath() + "String_Node_Str" + listOutputPackage.replaceAll("String_Node_Str","String_Node_Str"));
  listOutputDir.mkdirs();
  PrintWriter listOutput=new PrintWriter(listOutputDirectory.getAbsolutePath() + "String_Node_Str" + listOutputClass.replaceAll("String_Node_Str","String_Node_Str")+ "String_Node_Str");
  listOutput.println("String_Node_Str" + listOutputPackage + "String_Node_Str");
  listOutput.println("String_Node_Str");
  listOutput.println("String_Node_Str" + listOutputClass.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str");
  exportBuildingImages(listOutput);
  exportMaterialImages(listOutput);
  listOutput.println("String_Node_Str");
  listOutput.close();
}

Fixed version (ground truth):
public void execute() throws IOException {
  if (destinationDirectory == null) {
    throw new RuntimeException("String_Node_Str");
  }
  if (configFile == null) {
    throw new RuntimeException("String_Node_Str");
  }
  SwingResourceLoader.setupSwingResourcesByConfigFile(configFile);
  String listOutputPackage=listOutputClass.replaceAll("String_Node_Str","String_Node_Str");
  File listOutputDir=new File(listOutputDirectory.getAbsolutePath() + "String_Node_Str" + listOutputPackage.replaceAll("String_Node_Str","String_Node_Str"));
  listOutputDir.mkdirs();
  PrintWriter listOutput=new PrintWriter(listOutputDirectory.getAbsolutePath() + "String_Node_Str" + listOutputClass.replaceAll("String_Node_Str","String_Node_Str")+ "String_Node_Str");
  listOutput.println("String_Node_Str" + listOutputPackage + "String_Node_Str");
  listOutput.println("String_Node_Str");
  listOutput.println("String_Node_Str" + listOutputClass.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str");
  exportBuildingImages(listOutput);
  exportMaterialImages(listOutput);
  listOutput.println("String_Node_Str");
  listOutput.close();
}
Program: 56097
Project: 56097
Buggy source:
@Override public String toString(){
  return file.getFileName();
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + file.getFileName() + "String_Node_Str"+ getMapID();
}
Program: 56099
Project: 56099
Buggy source:
/** 
 * loads the list of double random numbers with the given seed.
 */
public static void load(long seed){
  uniIns=new RandomSingleton(seed);
}

Fixed version (ground truth):
/** 
 * loads the list of double random numbers with the given seed.
 */
public static void load(long seed){
  uniIns=new RandomSingleton(seed);
  System.out.println("String_Node_Str" + nextD() + "String_Node_Str"+ nextD()+ "String_Node_Str"+ nextD()+ "String_Node_Str"+ nextD());
}
Program: 56100
Project: 56100
Buggy source:
public void execute() throws IOException {
  if (destinationDirectory == null) {
    throw new RuntimeException("String_Node_Str");
  }
  if (configFile == null) {
    throw new RuntimeException("String_Node_Str");
  }
  SwingResourceLoader.setupResourceManagersByConfigFile(configFile);
  String listOutputPackage=listOutputClass.replaceAll("String_Node_Str","String_Node_Str");
  File listOutputDir=new File(listOutputDirectory.getAbsolutePath() + "String_Node_Str" + listOutputPackage.replaceAll("String_Node_Str","String_Node_Str"));
  listOutputDir.mkdirs();
  PrintWriter listOutput=new PrintWriter(listOutputDirectory.getAbsolutePath() + "String_Node_Str" + listOutputClass.replaceAll("String_Node_Str","String_Node_Str")+ "String_Node_Str");
  listOutput.println("String_Node_Str" + listOutputPackage + "String_Node_Str");
  listOutput.println("String_Node_Str");
  listOutput.println("String_Node_Str" + listOutputClass.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str");
  exportBuildingImages(listOutput);
  exportMaterialImages(listOutput);
  listOutput.println("String_Node_Str");
  listOutput.close();
}

Fixed version (ground truth):
public void execute() throws IOException {
  if (destinationDirectory == null) {
    throw new RuntimeException("String_Node_Str");
  }
  if (configFile == null) {
    throw new RuntimeException("String_Node_Str");
  }
  SwingResourceLoader.setupResourcesManagerByConfigFile(configFile);
  String listOutputPackage=listOutputClass.replaceAll("String_Node_Str","String_Node_Str");
  File listOutputDir=new File(listOutputDirectory.getAbsolutePath() + "String_Node_Str" + listOutputPackage.replaceAll("String_Node_Str","String_Node_Str"));
  listOutputDir.mkdirs();
  PrintWriter listOutput=new PrintWriter(listOutputDirectory.getAbsolutePath() + "String_Node_Str" + listOutputClass.replaceAll("String_Node_Str","String_Node_Str")+ "String_Node_Str");
  listOutput.println("String_Node_Str" + listOutputPackage + "String_Node_Str");
  listOutput.println("String_Node_Str");
  listOutput.println("String_Node_Str" + listOutputClass.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str");
  exportBuildingImages(listOutput);
  exportMaterialImages(listOutput);
  listOutput.println("String_Node_Str");
  listOutput.close();
}
Program: 56101
Project: 56101
Buggy source:
private void loadFileList(){
  freshMaps.clear();
  savedMaps.clear();
  addFilesToLists(mapsDir);
  addFilesToLists(saveDir);
  Collections.sort(freshMaps);
  Collections.sort(savedMaps);
}

Fixed version (ground truth):
private void loadFileList(){
  freshMaps.clear();
  savedMaps.clear();
  addFilesToLists(mapsDir);
  saveDir.mkdirs();
  addFilesToLists(saveDir);
  Collections.sort(freshMaps);
  Collections.sort(savedMaps);
}
Program: 56102
Project: 56102
Buggy source:
private boolean isInBounds(int x,int y){
  return 0 <= x && x < width && 0 <= y && y < height;
}

Fixed version (ground truth):
@Override public boolean isInBounds(int x,int y){
  return 0 <= x && x < width && 0 <= y && y < height;
}
Program: 56105
Project: 56105
Buggy source:
protected void editSettings(){
  final JDialog dialog=new JDialog(window,EditorLabels.getLabel("String_Node_Str"),true);
  final MapHeaderEditor headerEditor=new MapHeaderEditor(header,true);
  JPanel box=new JPanel();
  box.setLayout(new BoxLayout(box,BoxLayout.PAGE_AXIS));
  box.add(headerEditor);
  JButton okButton=new JButton("String_Node_Str");
  okButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      MapFileHeader nheader=headerEditor.getHeader();
      if (nheader.getWidth() != header.getWidth() || nheader.getHeight() != header.getHeight()) {
        JOptionPane.showMessageDialog(window,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
        return;
      }
      header=nheader;
      data.setMaxPlayers(header.getMaxPlayer());
      dataTester.retest();
      dialog.setVisible(false);
    }
  }
);
  box.add(okButton);
  dialog.add(box);
  dialog.pack();
  dialog.setVisible(true);
}

Fixed version (ground truth):
protected void editSettings(){
  final JDialog dialog=new JDialog(window,EditorLabels.getLabel("String_Node_Str"),true);
  final MapHeaderEditor headerEditor=new MapHeaderEditor(header,true);
  JPanel box=new JPanel();
  box.setLayout(new BoxLayout(box,BoxLayout.PAGE_AXIS));
  box.add(headerEditor);
  JButton okButton=new JButton("String_Node_Str");
  okButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      MapFileHeader nheader=headerEditor.getHeader();
      if (nheader.getWidth() != header.getWidth() || nheader.getHeight() != header.getHeight()) {
        JOptionPane.showMessageDialog(window,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
        return;
      }
      header=nheader;
      data.setMaxPlayers(header.getMaxPlayer());
      dataTester.retest();
      dialog.setVisible(false);
    }
  }
);
  box.add(okButton);
  dialog.add(box);
  dialog.setLocationRelativeTo(null);
  dialog.pack();
  dialog.setVisible(true);
}
Program: 56107
Project: 56107
Buggy source:
private void setState(AsyncNetworkClientFactoryState state){
  if (this.state == AsyncNetworkClientFactoryState.CLOSED) {
    networkClient.close();
  }
 else {
    this.state=state;
  }
synchronized (lock) {
    lock.notifyAll();
  }
}

Fixed version (ground truth):
private void setState(AsyncNetworkClientFactoryState state){
  if (this.state == AsyncNetworkClientFactoryState.CLOSED) {
    close();
  }
 else {
    this.state=state;
  }
synchronized (lock) {
    lock.notifyAll();
  }
}
Program: 56108
Project: 56108
Buggy source:
public void close(){
  setState(AsyncNetworkClientFactoryState.CLOSED);
  if (state != AsyncNetworkClientFactoryState.CONNECTING_TO_SERVER) {
    networkClient.close();
  }
}

Fixed version (ground truth):
public synchronized void close(){
  if (networkClient != null) {
    networkClient.close();
    networkClient=null;
  }
}
Program: 56109
Project: 56109
Buggy source:
public BuildingAreaBitSet(RelativePoint[] protectedTiles){
  short minX=protectedTiles[0].getDx();
  short maxX=protectedTiles[0].getDx();
  short minY=protectedTiles[0].getDy();
  short maxY=protectedTiles[0].getDy();
  for (int i=0; i < protectedTiles.length; i++) {
    minX=min(minX,protectedTiles[i].getDx());
    maxX=max(maxX,protectedTiles[i].getDx());
    minY=min(minY,protectedTiles[i].getDy());
    maxY=max(maxY,protectedTiles[i].getDy());
  }
  this.numberOfPositions=protectedTiles.length;
  this.minX=minX;
  this.minY=minY;
  this.maxX=maxX;
  this.maxY=maxY;
  this.width=(short)(maxX - minX + 1);
  this.height=(short)(maxY - minY + 1);
  this.bitSet=new BitSet(width * height);
  for (int i=0; i < protectedTiles.length; i++) {
    set(protectedTiles[i].getDx(),protectedTiles[i].getDy());
  }
  this.xJumps=new short[width * height];
  calculateXJumps();
  this.yJumps=new short[width * height];
  calculateYJumps();
}

Fixed version (ground truth):
public BuildingAreaBitSet(RelativePoint[] protectedTiles){
  short minX=protectedTiles[0].getDx();
  short maxX=protectedTiles[0].getDx();
  short minY=protectedTiles[0].getDy();
  short maxY=protectedTiles[0].getDy();
  for (int i=0; i < protectedTiles.length; i++) {
    minX=min(minX,protectedTiles[i].getDx());
    maxX=max(maxX,protectedTiles[i].getDx());
    minY=min(minY,protectedTiles[i].getDy());
    maxY=max(maxY,protectedTiles[i].getDy());
  }
  this.aPosition=protectedTiles[0];
  this.numberOfPositions=protectedTiles.length;
  this.minX=minX;
  this.minY=minY;
  this.maxX=maxX;
  this.maxY=maxY;
  this.width=(short)(maxX - minX + 1);
  this.height=(short)(maxY - minY + 1);
  this.bitSet=new BitSet(width * height);
  for (int i=0; i < protectedTiles.length; i++) {
    set(protectedTiles[i].getDx(),protectedTiles[i].getDy());
  }
  this.xJumps=new short[width * height];
  calculateXJumps();
  this.yJumps=new short[width * height];
  calculateYJumps();
}