nus-yam/ex-repair huggingface dataset:
Program: 55846
Project: 55846
Buggy source:
public void leavePosition(){
  if (!enableNothingToDo) {
    return;
  }
  int offset=MatchConstants.random().nextInt(EDirection.NUMBER_OF_DIRECTIONS);
  for (int i=0; i < EDirection.NUMBER_OF_DIRECTIONS; i++) {
    EDirection currDir=EDirection.VALUES[(i + offset) % EDirection.NUMBER_OF_DIRECTIONS];
    if (goInDirection(currDir,EGoInDirectionMode.GO_IF_ALLOWED_AND_FREE)) {
      break;
    }
 else {
      Movable movableAtPos=grid.getMovableAt(currDir.getNextTileX(position.x),currDir.getNextTileY(position.y));
      if (movableAtPos != null) {
        movableAtPos.push(this);
      }
    }
  }
}

Fixed version (ground truth):
public void leavePosition(){
  if (state != EMovableState.DOING_NOTHING || !enableNothingToDo) {
    return;
  }
  int offset=MatchConstants.random().nextInt(EDirection.NUMBER_OF_DIRECTIONS);
  for (int i=0; i < EDirection.NUMBER_OF_DIRECTIONS; i++) {
    EDirection currDir=EDirection.VALUES[(i + offset) % EDirection.NUMBER_OF_DIRECTIONS];
    if (goInDirection(currDir,EGoInDirectionMode.GO_IF_ALLOWED_AND_FREE)) {
      break;
    }
 else {
      Movable movableAtPos=grid.getMovableAt(currDir.getNextTileX(position.x),currDir.getNextTileY(position.y));
      if (movableAtPos != null) {
        movableAtPos.push(this);
      }
    }
  }
}
Program: 55847
Project: 55847
Buggy source:
private void stopOrStartWorking(List<Integer> selectedMovables,boolean stop){
  for (  Integer currID : selectedMovables) {
    Movable.getMovableByID(currID).stopOrStartWorking(stop);
  }
}

Fixed version (ground truth):
private void stopOrStartWorking(List<Integer> selectedMovables,boolean stop){
  for (  Integer currID : selectedMovables) {
    Movable movable=Movable.getMovableByID(currID);
    if (movable != null) {
      movable.stopOrStartWorking(stop);
    }
  }
}
Program: 55848
Project: 55848
Buggy source:
private void killSelectedMovables(List<Integer> selectedMovables){
  for (  Integer currID : selectedMovables) {
    Movable curr=Movable.getMovableByID(currID);
    if (curr != null)     curr.kill();
  }
}

Fixed version (ground truth):
private void killSelectedMovables(List<Integer> selectedMovables){
  for (  Integer currID : selectedMovables) {
    Movable curr=Movable.getMovableByID(currID);
    if (curr != null) {
      curr.kill();
    }
  }
}
Program: 55849
Project: 55849
Buggy source:
private boolean goToRandomDirection(Movable pushingMovable){
  int offset=MatchConstants.random().nextInt(EDirection.NUMBER_OF_DIRECTIONS);
  EDirection pushedFromDir=EDirection.getDirection(this.getPos(),pushingMovable.getPos());
  for (int i=0; i < EDirection.NUMBER_OF_DIRECTIONS; i++) {
    EDirection currDir=EDirection.VALUES[(i + offset) % EDirection.NUMBER_OF_DIRECTIONS];
    if (currDir != pushedFromDir && goInDirection(currDir,false)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean goToRandomDirection(Movable pushingMovable){
  int offset=MatchConstants.random().nextInt(EDirection.NUMBER_OF_DIRECTIONS);
  EDirection pushedFromDir=EDirection.getDirection(this.getPos(),pushingMovable.getPos());
  for (int i=0; i < EDirection.NUMBER_OF_DIRECTIONS; i++) {
    EDirection currDir=EDirection.VALUES[(i + offset) % EDirection.NUMBER_OF_DIRECTIONS];
    if (currDir != pushedFromDir && goInDirection(currDir,EGoInDirectionMode.GO_IF_ALLOWED_AND_FREE)) {
      return true;
    }
  }
  return false;
}
Program: 55850
Project: 55850
Buggy source:
/** 
 * Tries to go a step in the given direction.
 * @param direction direction to go
 * @param force If true, the step will be forced and the method will always return true.
 * @return true if the step can and will immediately be executed. <br>false if the target position is generally blocked or a movable occupies that position.
 */
final boolean goInDirection(EDirection direction,boolean force){
  ShortPoint2D targetPosition=direction.getNextHexPoint(position);
  if (force) {
    this.direction=direction;
    setState(EMovableState.PATHING);
    this.followPath(new Path(targetPosition));
    return true;
  }
 else   if ((grid.isValidPosition(this,targetPosition) && grid.hasNoMovableAt(targetPosition.x,targetPosition.y))) {
    initGoingSingleStep(targetPosition);
    setState(EMovableState.GOING_SINGLE_STEP);
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Tries to go a step in the given direction.
 * @param direction direction to go
 * @param mode Use the given mode to go.<br>
 * @return true if the step can and will immediately be executed. <br>false if the target position is generally blocked or a movable occupies that position.
 */
final boolean goInDirection(EDirection direction,EGoInDirectionMode mode){
  ShortPoint2D targetPosition=direction.getNextHexPoint(position);
switch (mode) {
case GO_IF_ALLOWED_WAIT_TILL_FREE:
{
      this.direction=direction;
      setState(EMovableState.PATHING);
      this.followPath(new Path(targetPosition));
      return true;
    }
case GO_IF_ALLOWED_AND_FREE:
  if ((grid.isValidPosition(this,targetPosition) && grid.hasNoMovableAt(targetPosition.x,targetPosition.y))) {
    initGoingSingleStep(targetPosition);
    setState(EMovableState.GOING_SINGLE_STEP);
    return true;
  }
 else {
    break;
  }
case GO_IF_FREE:
if (grid.isFreePosition(targetPosition)) {
  initGoingSingleStep(targetPosition);
  setState(EMovableState.GOING_SINGLE_STEP);
  return true;
}
 else {
  break;
}
}
return false;
}
Program: 55851
Project: 55851
Buggy source:
public void leavePosition(){
  if (!enableNothingToDo) {
    return;
  }
  int offset=MatchConstants.random().nextInt(EDirection.NUMBER_OF_DIRECTIONS);
  for (int i=0; i < EDirection.NUMBER_OF_DIRECTIONS; i++) {
    EDirection currDir=EDirection.VALUES[(i + offset) % EDirection.NUMBER_OF_DIRECTIONS];
    if (goInDirection(currDir,false)) {
      break;
    }
 else {
      Movable movableAtPos=grid.getMovableAt(currDir.getNextTileX(position.x),currDir.getNextTileY(position.y));
      if (movableAtPos != null) {
        movableAtPos.push(this);
      }
    }
  }
}

Fixed version (ground truth):
public void leavePosition(){
  if (!enableNothingToDo) {
    return;
  }
  int offset=MatchConstants.random().nextInt(EDirection.NUMBER_OF_DIRECTIONS);
  for (int i=0; i < EDirection.NUMBER_OF_DIRECTIONS; i++) {
    EDirection currDir=EDirection.VALUES[(i + offset) % EDirection.NUMBER_OF_DIRECTIONS];
    if (goInDirection(currDir,EGoInDirectionMode.GO_IF_ALLOWED_AND_FREE)) {
      break;
    }
 else {
      Movable movableAtPos=grid.getMovableAt(currDir.getNextTileX(position.x),currDir.getNextTileY(position.y));
      if (movableAtPos != null) {
        movableAtPos.push(this);
      }
    }
  }
}
Program: 55852
Project: 55852
Buggy source:
/** 
 * Tries to walk the movable into a position where it has a minimum distance to others.
 * @return true if the movable moves to flock, false if no flocking is required.
 */
private boolean flockToDecentralize(){
  ShortPoint2D decentVector=grid.calcDecentralizeVector(position.x,position.y);
  EDirection randomDirection=direction.getNeighbor(MatchConstants.random().nextInt(-1,1));
  int dx=randomDirection.gridDeltaX + decentVector.x;
  int dy=randomDirection.gridDeltaY + decentVector.y;
  if (ShortPoint2D.getOnGridDist(dx,dy) >= 2) {
    flockDelay=Math.max(flockDelay - 100,500);
    if (this.goInDirection(EDirection.getApproxDirection(0,0,dx,dy),false)) {
      return true;
    }
 else {
      return false;
    }
  }
 else {
    flockDelay=Math.min(flockDelay + 100,1000);
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Tries to walk the movable into a position where it has a minimum distance to others.
 * @return true if the movable moves to flock, false if no flocking is required.
 */
private boolean flockToDecentralize(){
  ShortPoint2D decentVector=grid.calcDecentralizeVector(position.x,position.y);
  EDirection randomDirection=direction.getNeighbor(MatchConstants.random().nextInt(-1,1));
  int dx=randomDirection.gridDeltaX + decentVector.x;
  int dy=randomDirection.gridDeltaY + decentVector.y;
  if (ShortPoint2D.getOnGridDist(dx,dy) >= 2) {
    flockDelay=Math.max(flockDelay - 100,500);
    return this.goInDirection(EDirection.getApproxDirection(0,0,dx,dy),EGoInDirectionMode.GO_IF_ALLOWED_AND_FREE);
  }
 else {
    flockDelay=Math.min(flockDelay + 100,1000);
    return false;
  }
}
Program: 55853
Project: 55853
Buggy source:
/** 
 * @param dijkstra if true, dijkstra algorithm is used<br> if false, in area finder is used.
 * @param centerX
 * @param centerY
 * @param radius
 * @param searchType
 * @return true if a path has been found.
 */
final boolean preSearchPath(boolean dikjstra,short centerX,short centerY,short radius,ESearchType searchType){
}

Fixed version (ground truth):
/** 
 * @param dijkstra if true, dijkstra algorithm is used<br> if false, in area finder is used.
 * @param centerX
 * @param centerY
 * @param radius
 * @param searchType
 * @return true if a path has been found.
 */
final boolean preSearchPath(boolean dijkstra,short centerX,short centerY,short radius,ESearchType searchType){
}
Program: 55854
Project: 55854
Buggy source:
/** 
 * Tries to go a step in the given direction.
 * @param direction direction to go
 * @param force If true, the step will be forced and the method will always return true.
 * @return true if the step can and will immediately be executed. <br>false if the target position is generally blocked or a movable occupies that position.
 */
protected final boolean goInDirection(EDirection direction,boolean force){
  return movable.goInDirection(direction,force);
}

Fixed version (ground truth):
/** 
 * Tries to go a step in the given direction.
 * @param direction direction to go
 * @param mode The mode used for this operation
 * @return true if the step can and will immediately be executed. <br>false if the target position is generally blocked or a movable occupies that position.
 */
protected final boolean goInDirection(EDirection direction,EGoInDirectionMode mode){
  return movable.goInDirection(direction,mode);
}
Program: 55856
Project: 55856
Buggy source:
@Override protected void action(){
  ShortPoint2D position=movable.getPos();
  if (!super.isValidPosition(position)) {
    if (searchesCounter > 120) {
      movable.kill();
      return;
    }
    if (super.preSearchPath(true,position.x,position.y,Constants.MOVABLE_FLEEING_DIJKSTRA_RADIUS,ESearchType.VALID_FREE_POSITION) || super.preSearchPath(false,position.x,position.y,Constants.MOVABLE_FLEEING_MAX_RADIUS,ESearchType.VALID_FREE_POSITION)) {
      lastCheckedPathStep=Integer.MIN_VALUE;
      super.followPresearchedPath();
    }
 else {
      EDirection currentDirection=movable.getDirection();
      EDirection newDirection;
      if (turnNextTime || MatchConstants.random().nextFloat() < 0.10) {
        turnNextTime=false;
        newDirection=currentDirection.getNeighbor(MatchConstants.random().nextInt(-1,1));
      }
 else {
        newDirection=currentDirection;
      }
      ShortPoint2D newPos=newDirection.getNextHexPoint(position);
      if (super.getGrid().isFreePosition(newPos)) {
        super.goInDirection(newDirection,true);
        turnNextTime=MatchConstants.random().nextInt(7) == 0;
      }
 else {
        super.lookInDirection(newDirection);
        turnNextTime=true;
      }
    }
    searchesCounter++;
  }
 else {
    movable.convertTo(movable.getMovableType());
  }
}

Fixed version (ground truth):
@Override protected void action(){
  ShortPoint2D position=movable.getPos();
  if (!super.isValidPosition(position)) {
    if (searchesCounter > 120) {
      movable.kill();
      return;
    }
    if (super.preSearchPath(true,position.x,position.y,Constants.MOVABLE_FLEEING_DIJKSTRA_RADIUS,ESearchType.VALID_FREE_POSITION) || super.preSearchPath(false,position.x,position.y,Constants.MOVABLE_FLEEING_MAX_RADIUS,ESearchType.VALID_FREE_POSITION)) {
      lastCheckedPathStep=Integer.MIN_VALUE;
      super.followPresearchedPath();
    }
 else {
      EDirection currentDirection=movable.getDirection();
      EDirection newDirection;
      if (turnNextTime || MatchConstants.random().nextFloat() < 0.10) {
        turnNextTime=false;
        newDirection=currentDirection.getNeighbor(MatchConstants.random().nextInt(-1,1));
      }
 else {
        newDirection=currentDirection;
      }
      ShortPoint2D newPos=newDirection.getNextHexPoint(position);
      if (super.goInDirection(newDirection,EGoInDirectionMode.GO_IF_FREE)) {
        turnNextTime=MatchConstants.random().nextInt(7) == 0;
      }
 else {
        super.lookInDirection(newDirection);
        turnNextTime=true;
      }
    }
    searchesCounter++;
  }
 else {
    movable.convertTo(movable.getMovableType());
  }
}
Program: 55858
Project: 55858
Buggy source:
private void goToEnemy(IAttackable enemy){
  if (inSaveGotoMode) {
    goToSavely(enemy);
  }
 else {
    ShortPoint2D pos=movable.getPos();
    EDirection dir=EDirection.getApproxDirection(pos,enemy.getPos());
    if (super.goInDirection(dir,false)) {
      return;
    }
 else {
      inSaveGotoMode=true;
      goToSavely(enemy);
    }
  }
}

Fixed version (ground truth):
private void goToEnemy(IAttackable enemy){
  if (inSaveGotoMode) {
    goToSavely(enemy);
  }
 else {
    ShortPoint2D pos=movable.getPos();
    EDirection dir=EDirection.getApproxDirection(pos,enemy.getPos());
    if (super.goInDirection(dir,EGoInDirectionMode.GO_IF_ALLOWED_AND_FREE)) {
      return;
    }
 else {
      inSaveGotoMode=true;
      goToSavely(enemy);
    }
  }
}
Program: 55859
Project: 55859
Buggy source:
@Override public void receiveHit(float strength,ShortPoint2D attackerPos,byte attackingPlayer){
  Movable attacker=grid.getMovable(attackerPos);
  if (attacker != null && attacker.getPlayer() == getPlayer()) {
    return;
  }
  if (doorHealth > 0) {
    doorHealth-=strength / Constants.DOOR_HIT_RESISTENCY_FACTOR;
    if (doorHealth <= 0) {
      doorHealth=0;
      inFight=true;
      OccupyingBuilding.this.grid.getMapObjectsManager().addSelfDeletingMapObject(pos,EMapObjectType.GHOST,Constants.GHOST_PLAY_DURATION,getPlayer());
      pullNewDefender(attackerPos);
    }
  }
 else   if (currDefender != null) {
    IAttackableMovable movable=currDefender.getSoldier().getMovable();
    movable.receiveHit(strength,attackerPos,attackingPlayer);
    if (movable.getHealth() <= 0) {
      emptyPlaces.add(currDefender.place);
      searchedSoldiers.add(getSearchType(currDefender.getSoldier().getMovableType()));
      pullNewDefender(attackerPos);
    }
  }
  OccupyingBuilding.this.getPlayer().showMessage(SimpleMessage.attacked(attackingPlayer,attackerPos));
}

Fixed version (ground truth):
@Override public void receiveHit(float strength,ShortPoint2D attackerPos,byte attackingPlayer){
  Movable attacker=grid.getMovable(attackerPos);
  if (attacker != null && attacker.getPlayer() == getPlayer()) {
    return;
  }
  if (doorHealth > 0) {
    doorHealth-=strength / Constants.DOOR_HIT_RESISTENCY_FACTOR;
    if (doorHealth <= 0) {
      doorHealth=0;
      inFight=true;
      OccupyingBuilding.this.grid.getMapObjectsManager().addSelfDeletingMapObject(getPos(),EMapObjectType.GHOST,Constants.GHOST_PLAY_DURATION,getPlayer());
      pullNewDefender(attackerPos);
    }
  }
 else   if (currDefender != null) {
    IAttackableMovable movable=currDefender.getSoldier().getMovable();
    movable.receiveHit(strength,attackerPos,attackingPlayer);
    if (movable.getHealth() <= 0) {
      emptyPlaces.add(currDefender.place);
      searchedSoldiers.add(getSearchType(currDefender.getSoldier().getMovableType()));
      pullNewDefender(attackerPos);
    }
  }
  OccupyingBuilding.this.getPlayer().showMessage(SimpleMessage.attacked(attackingPlayer,attackerPos));
}
Program: 55860
Project: 55860
Buggy source:
private void pullNewDefender(ShortPoint2D attackerPos){
  if (sortedOccupiers.isEmpty()) {
    currDefender=null;
    changePlayerTo(attackerPos);
  }
 else {
    currDefender=removeSoldier();
    currDefender.getSoldier().setDefendingAt(pos);
  }
}

Fixed version (ground truth):
private void pullNewDefender(ShortPoint2D attackerPos){
  if (sortedOccupiers.isEmpty()) {
    currDefender=null;
    changePlayerTo(attackerPos);
  }
 else {
    currDefender=removeSoldier();
    currDefender.getSoldier().setDefendingAt(getPos());
  }
}
Program: 55861
Project: 55861
Buggy source:
@Override public int compareTo(MapLoader o){
  MapFileHeader myHeader=header;
  MapFileHeader otherHeader=o.header;
  if (myHeader.getType() == MapType.SAVED_SINGLE) {
    return -myHeader.getCreationDate().compareTo(otherHeader.getCreationDate());
  }
 else {
    return myHeader.getName().compareTo(otherHeader.getName());
  }
}

Fixed version (ground truth):
@Override public int compareTo(MapLoader other){
  MapFileHeader myHeader=this.getFileHeader();
  MapFileHeader otherHeader=other.getFileHeader();
  if (myHeader.getType() == otherHeader.getType() && myHeader.getType() == MapType.SAVED_SINGLE) {
    return -this.getCreationDate().compareTo(other.getCreationDate());
  }
 else {
    return this.getMapName().compareToIgnoreCase(other.getMapName());
  }
}
Program: 55862
Project: 55862
Buggy source:
public MainMenuPanel(JSettlersFrame settlersFrame,IMultiplayerConnector multiPlayerConnector){
  this.settlersFrame=settlersFrame;
  openSinglePlayerPanel=new OpenPanel(MapList.getDefaultList().getFreshMaps().getItems(),this::showdNewSingleplayerGamePanel);
  openSaveGamePanel=new OpenPanel(transformRemakeMapLoadersToMapLoaders(MapList.getDefaultList().getSavedMaps().getItems()),this::loadSavegame);
  newMultiPlayerGamePanel=new OpenPanel(MapList.getDefaultList().getFreshMaps().getItems(),this::showNewMultiplayerGamePanel);
  joinMultiPlayerGamePanel=new OpenPanel(new Vector<MapLoader>(),this::showJoinMultiplayerGamePanel);
  settingsPanel=new SettingsMenuPanel(this);
  createStructure();
  setStyle();
  localize();
  addListener(multiPlayerConnector);
}

Fixed version (ground truth):
public MainMenuPanel(JSettlersFrame settlersFrame,IMultiplayerConnector multiPlayerConnector){
  this.settlersFrame=settlersFrame;
  openSinglePlayerPanel=new OpenPanel(MapList.getDefaultList().getFreshMaps().getItems(),this::showdNewSingleplayerGamePanel);
  openSaveGamePanel=new OpenPanel(MapList.getDefaultList().getSavedMaps(),this::loadSavegame);
  newMultiPlayerGamePanel=new OpenPanel(MapList.getDefaultList().getFreshMaps().getItems(),this::showNewMultiplayerGamePanel);
  joinMultiPlayerGamePanel=new OpenPanel(new Vector<MapLoader>(),this::showJoinMultiplayerGamePanel);
  settingsPanel=new SettingsMenuPanel(this);
  createStructure();
  setStyle();
  localize();
  addListener(multiPlayerConnector);
}
Program: 55863
Project: 55863
Buggy source:
public void setMapLoaders(final List<MapLoader> maps){
  setMapLoadersWithoutSearchChanged(maps);
  searchChanged();
}

Fixed version (ground truth):
public void setMapLoaders(final List<? extends MapLoader> maps){
  setMapLoadersWithoutSearchChanged(maps);
  searchChanged();
}
Program: 55864
Project: 55864
Buggy source:
/** 
 * @return true if there are no maps in the list
 */
public boolean isEmpty(){
  return maps.isEmpty();
}

Fixed version (ground truth):
/** 
 * @return true if there are no maps in the list
 */
public boolean isEmpty(){
  return availableMaps.length == 0;
}
Program: 55865
Project: 55865
Buggy source:
private void setMapLoadersWithoutSearchChanged(final List<MapLoader> maps){
  this.maps=maps;
  this.mapsAvailable=maps.toArray(new MapLoader[maps.size()]);
  sortMaps();
}

Fixed version (ground truth):
private void setMapLoadersWithoutSearchChanged(final List<? extends MapLoader> maps){
  availableMaps=maps.toArray(new MapLoader[maps.size()]);
  Arrays.sort(availableMaps);
}
Program: 55866
Project: 55866
Buggy source:
/** 
 * Search has changed, update the list
 */
protected void searchChanged(){
  String search=searchTextField.getText().toLowerCase();
  listModelFiltered.clear();
  for (  MapLoader m : mapsAvailable) {
    if (matchesSearch(m,search) && currentFilter.filter(m)) {
      listModelFiltered.addElement(m);
    }
  }
}

Fixed version (ground truth):
/** 
 * Search has changed, update the list
 */
protected void searchChanged(){
  String search=searchTextField.getText().toLowerCase();
  listModelFiltered.clear();
  Arrays.stream(availableMaps).filter(currentFilter::filter).filter(mapLoader -> matchesSearch(mapLoader,search)).forEach(listModelFiltered::addElement);
}
Program: 55867
Project: 55867
Buggy source:
/** 
 * Constructor
 * @param maps Maps to display
 * @param doubleclickListener Gets called when an entry is double clicked, can be <code>null</code>
 * @param cellRenderer Cell renderer to use
 */
public OpenPanel(final List<MapLoader> maps,final IMapSelectedListener mapSelectedListener,final ListCellRenderer<MapLoader> cellRenderer){
  setMapLoadersWithoutSearchChanged(maps);
  setLayout(new BorderLayout());
  initFilter();
  this.searchTextField=new SearchTextField();
  searchTextField.putClientProperty(ELFStyle.KEY,ELFStyle.TEXT_DEFAULT);
  Box box=Box.createVerticalBox();
  box.add(filterPanel);
  box.add(searchTextField);
  add(box,BorderLayout.NORTH);
  searchTextField.getDocument().addDocumentListener(new DocumentListener(){
    @Override public void removeUpdate(    DocumentEvent e){
      searchChanged();
    }
    @Override public void insertUpdate(    DocumentEvent e){
      searchChanged();
    }
    @Override public void changedUpdate(    DocumentEvent e){
      searchChanged();
    }
  }
);
  this.mapList=new JList<MapLoader>(listModelFiltered);
  mapList.setCellRenderer(cellRenderer);
  mapList.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (e.getClickCount() == 2) {
        if (mapSelectedListener != null) {
          mapSelectedListener.mapSelected(getSelectedMap());
        }
      }
    }
  }
);
  mapList.setOpaque(false);
  add(new JScrollPane(mapList),BorderLayout.CENTER);
  searchChanged();
  if (maps.size() > 0) {
    mapList.setSelectedIndex(0);
  }
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param maps Maps to display
 * @param doubleclickListener Gets called when an entry is double clicked, can be <code>null</code>
 * @param cellRenderer Cell renderer to use
 */
public OpenPanel(final List<? extends MapLoader> maps,final IMapSelectedListener mapSelectedListener,final ListCellRenderer<MapLoader> cellRenderer){
  setMapLoadersWithoutSearchChanged(maps);
  setLayout(new BorderLayout());
  initFilter();
  searchTextField=new SearchTextField();
  searchTextField.putClientProperty(ELFStyle.KEY,ELFStyle.TEXT_DEFAULT);
  Box box=Box.createVerticalBox();
  box.add(filterPanel);
  box.add(searchTextField);
  add(box,BorderLayout.NORTH);
  searchTextField.getDocument().addDocumentListener(new DocumentListener(){
    @Override public void removeUpdate(    DocumentEvent e){
      searchChanged();
    }
    @Override public void insertUpdate(    DocumentEvent e){
      searchChanged();
    }
    @Override public void changedUpdate(    DocumentEvent e){
      searchChanged();
    }
  }
);
  mapList=new JList<MapLoader>(listModelFiltered);
  mapList.setCellRenderer(cellRenderer);
  mapList.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (e.getClickCount() == 2) {
        if (mapSelectedListener != null) {
          mapSelectedListener.mapSelected(getSelectedMap());
        }
      }
    }
  }
);
  mapList.setOpaque(false);
  add(new JScrollPane(mapList),BorderLayout.CENTER);
  searchChanged();
  if (maps.size() > 0) {
    mapList.setSelectedIndex(0);
  }
}
Program: 55868
Project: 55868
Buggy source:
@Override public synchronized void drawAt(GLDrawContext gl){
  super.drawAt(gl);
  TextDrawer drawer=gl.getTextDrawer(size);
  if (Double.isNaN(spaceWidth)) {
    spaceWidth=drawer.getWidth("String_Node_Str");
    lineHeight=drawer.getHeight("String_Node_Str");
    lineBottom=drawer.getHeight("String_Node_Str");
  }
  double maxwidth=getPosition().getWidth();
  StringBuilder lineText=new StringBuilder();
  double linewidth=-spaceWidth;
  ArrayList<Line> lines=new ArrayList<>();
  boolean firstWord=true;
  for (  Word word : words) {
    double newlinewidth=linewidth + spaceWidth + word.getWidth(drawer);
    if (!firstWord && (word.lineBreakBefore || newlinewidth > maxwidth)) {
      lines.add(new Line(lineText.toString(),linewidth));
      lineText=new StringBuilder(word.word);
      linewidth=word.getWidth(drawer);
    }
 else {
      if (!firstWord) {
        lineText.append("String_Node_Str");
      }
      lineText.append(word.word);
      linewidth=newlinewidth;
    }
    firstWord=false;
  }
  lines.add(new Line(lineText.toString(),linewidth));
  double totalHeight=lines.size() * lineHeight;
  float y;
  y=getTextBoxTop(totalHeight);
  y-=lineBottom;
  for (  Line line : lines) {
    drawLine(drawer,line,y);
    y-=lineHeight;
  }
}

Fixed version (ground truth):
@Override public synchronized void drawAt(GLDrawContext gl){
  super.drawAt(gl);
  TextDrawer drawer=gl.getTextDrawer(size);
  drawer.setColor(1,1,1,1);
  if (Double.isNaN(spaceWidth)) {
    spaceWidth=drawer.getWidth("String_Node_Str");
    lineHeight=drawer.getHeight("String_Node_Str");
    lineBottom=drawer.getHeight("String_Node_Str");
  }
  double maxwidth=getPosition().getWidth();
  StringBuilder lineText=new StringBuilder();
  double linewidth=-spaceWidth;
  ArrayList<Line> lines=new ArrayList<>();
  boolean firstWord=true;
  for (  Word word : words) {
    double newlinewidth=linewidth + spaceWidth + word.getWidth(drawer);
    if (!firstWord && (word.lineBreakBefore || newlinewidth > maxwidth)) {
      lines.add(new Line(lineText.toString(),linewidth));
      lineText=new StringBuilder(word.word);
      linewidth=word.getWidth(drawer);
    }
 else {
      if (!firstWord) {
        lineText.append("String_Node_Str");
      }
      lineText.append(word.word);
      linewidth=newlinewidth;
    }
    firstWord=false;
  }
  lines.add(new Line(lineText.toString(),linewidth));
  double totalHeight=lines.size() * lineHeight;
  float y;
  y=getTextBoxTop(totalHeight);
  y-=lineBottom;
  for (  Line line : lines) {
    drawLine(drawer,line,y);
    y-=lineHeight;
  }
}
Program: 55869
Project: 55869
Buggy source:
@Override public ShortPoint2D next(){
  return waypoints[i++];
}

Fixed version (ground truth):
@Override public ShortPoint2D next(){
  return hasNext() ? waypoints[i++] : null;
}
Program: 55870
Project: 55870
Buggy source:
private String getKeyName(KeyEvent e){
  String text=KeyEvent.getKeyText(e.getKeyCode());
  if (text == null || text.length() != 1) {
switch (e.getKeyCode()) {
case KeyEvent.VK_LEFT:
      text="String_Node_Str";
    break;
case KeyEvent.VK_RIGHT:
  text="String_Node_Str";
break;
case KeyEvent.VK_DOWN:
text="String_Node_Str";
break;
case KeyEvent.VK_UP:
text="String_Node_Str";
break;
case KeyEvent.VK_PAUSE:
text="String_Node_Str";
break;
case KeyEvent.VK_F1:
text="String_Node_Str";
break;
case KeyEvent.VK_F2:
text="String_Node_Str";
break;
case KeyEvent.VK_F3:
text="String_Node_Str";
break;
case KeyEvent.VK_F4:
text="String_Node_Str";
break;
case KeyEvent.VK_F5:
text="String_Node_Str";
break;
case KeyEvent.VK_F6:
text="String_Node_Str";
break;
case KeyEvent.VK_F7:
text="String_Node_Str";
break;
case KeyEvent.VK_F8:
text="String_Node_Str";
break;
case KeyEvent.VK_F9:
text="String_Node_Str";
break;
case KeyEvent.VK_F10:
text="String_Node_Str";
break;
case KeyEvent.VK_F11:
text="String_Node_Str";
break;
case KeyEvent.VK_F12:
text="String_Node_Str";
break;
case KeyEvent.VK_PLUS:
text="String_Node_Str";
break;
case KeyEvent.VK_MINUS:
text="String_Node_Str";
break;
case KeyEvent.VK_DELETE:
text="String_Node_Str";
break;
case KeyEvent.VK_SPACE:
text="String_Node_Str";
break;
case KeyEvent.VK_ESCAPE:
text="String_Node_Str";
break;
case KeyEvent.VK_BACK_SPACE:
text="String_Node_Str";
break;
default :
text="String_Node_Str";
}
}
return text;
}

Fixed version (ground truth):
private String getKeyName(KeyEvent e){
  String text=KeyEvent.getKeyText(e.getKeyCode());
  if (text == null || text.length() != 1) {
switch (e.getKeyCode()) {
case KeyEvent.VK_LEFT:
      text="String_Node_Str";
    break;
case KeyEvent.VK_RIGHT:
  text="String_Node_Str";
break;
case KeyEvent.VK_DOWN:
text="String_Node_Str";
break;
case KeyEvent.VK_UP:
text="String_Node_Str";
break;
case KeyEvent.VK_PAUSE:
text="String_Node_Str";
break;
case KeyEvent.VK_F1:
text="String_Node_Str";
break;
case KeyEvent.VK_F2:
text="String_Node_Str";
break;
case KeyEvent.VK_F3:
text="String_Node_Str";
break;
case KeyEvent.VK_F4:
text="String_Node_Str";
break;
case KeyEvent.VK_F5:
text="String_Node_Str";
break;
case KeyEvent.VK_F6:
text="String_Node_Str";
break;
case KeyEvent.VK_F7:
text="String_Node_Str";
break;
case KeyEvent.VK_F8:
text="String_Node_Str";
break;
case KeyEvent.VK_F9:
text="String_Node_Str";
break;
case KeyEvent.VK_F10:
text="String_Node_Str";
break;
case KeyEvent.VK_F11:
text="String_Node_Str";
break;
case KeyEvent.VK_F12:
text="String_Node_Str";
break;
case KeyEvent.VK_PLUS:
text="String_Node_Str";
break;
case KeyEvent.VK_MINUS:
text="String_Node_Str";
break;
case KeyEvent.VK_DELETE:
text="String_Node_Str";
break;
case KeyEvent.VK_SPACE:
text="String_Node_Str";
break;
case KeyEvent.VK_ESCAPE:
text="String_Node_Str";
break;
case KeyEvent.VK_BACK_SPACE:
text="String_Node_Str";
break;
default :
text="String_Node_Str" + e.getKeyChar();
}
}
return text;
}
Program: 55871
Project: 55871
Buggy source:
@Override public void drawAt(GLDrawContext gl){
  super.drawAt(gl);
  TextDrawer drawer=gl.getTextDrawer(size);
  drawer.renderCentered(getPosition().getCenterX(),getPosition().getCenterY(),text);
}

Fixed version (ground truth):
@Override public void drawAt(GLDrawContext gl){
  super.drawAt(gl);
  TextDrawer drawer=gl.getTextDrawer(size);
  drawer.setColor(1,1,1,1);
  drawer.renderCentered(getPosition().getCenterX(),getPosition().getCenterY(),text);
}
Program: 55872
Project: 55872
Buggy source:
@Override public PlayerSlot createPlayerSlot(byte slot,MapLoader mapLoader){
  PlayerSlot playerSlot=new PlayerSlot();
  if (slot == 0) {
    SettingsManager settingsManager=SettingsManager.getInstance();
    playerSlot.setPlayerName(settingsManager.getPlayer().getName());
    playerSlot.setPossibleTypes(new EPlayerType[]{EPlayerType.HUMAN});
    playerSlot.setReadyButtonEnabled(true);
  }
 else {
    playerSlot.setPossibleTypes(new EPlayerType[]{EPlayerType.HUMAN,EPlayerType.AI_VERY_HARD});
    playerSlot.setTypeComboBox(EPlayerType.AI_VERY_HARD);
    playerSlot.setReadyButtonEnabled(false);
  }
  playerSlot.setReady(false);
  playerSlot.setSlotAndTeams((byte)mapLoader.getMaxPlayers());
  playerSlot.disableAllInputs();
  return playerSlot;
}

Fixed version (ground truth):
@Override public PlayerSlot createPlayerSlot(byte slot,MapLoader mapLoader){
  PlayerSlot playerSlot=new PlayerSlot();
  if (slot == 0) {
    SettingsManager settingsManager=SettingsManager.getInstance();
    playerSlot.setPlayerName(settingsManager.getPlayer().getName());
    playerSlot.setPossibleTypes(new EPlayerType[]{EPlayerType.HUMAN});
    playerSlot.setReadyButtonEnabled(true);
    playerSlot.setReady(false);
  }
 else {
    playerSlot.setPossibleTypes(new EPlayerType[]{EPlayerType.HUMAN,EPlayerType.AI_VERY_HARD});
    playerSlot.setPlayerType(EPlayerType.AI_VERY_HARD);
    playerSlot.setReadyButtonEnabled(false);
    playerSlot.setReady(true);
  }
  playerSlot.setSlotAndTeams((byte)mapLoader.getMaxPlayers());
  playerSlot.disableAllInputs();
  return playerSlot;
}
Program: 55873
Project: 55873
Buggy source:
private void onPlayersChanges(ChangingList<? extends IMultiplayerPlayer> changingPlayers,IJoinPhaseMultiplayerGameConnector joinMultiPlayerMap){
  SwingUtilities.invokeLater(() -> {
    List<? extends IMultiplayerPlayer> players=changingPlayers.getItems();
    String myId=SettingsManager.getInstance().get(SettingsManager.SETTING_UUID);
    for (int i=0; i < players.size(); i++) {
      PlayerSlot playerSlot=playerSlots.get(i);
      IMultiplayerPlayer player=players.get(i);
      playerSlot.setPlayerName(player.getName());
      playerSlot.setReady(player.isReady());
      if (player.getId().equals(myId)) {
        playerSlot.setReadyButtonEnabled(true);
        playerSlot.informGameAboutReady(joinMultiPlayerMap);
      }
 else {
        playerSlot.setReadyButtonEnabled(false);
      }
    }
    for (int i=players.size(); i < playerSlots.size(); i++) {
      playerSlots.get(i).setTypeComboBox(EPlayerType.AI_VERY_HARD);
    }
    setCancelButtonActionListener(e -> {
      joinMultiPlayerMap.abort();
      settlersFrame.showMainMenu();
    }
);
  }
);
}

Fixed version (ground truth):
private void onPlayersChanges(ChangingList<? extends IMultiplayerPlayer> changingPlayers,IJoinPhaseMultiplayerGameConnector joinMultiPlayerMap){
  SwingUtilities.invokeLater(() -> {
    List<? extends IMultiplayerPlayer> players=changingPlayers.getItems();
    String myId=SettingsManager.getInstance().get(SettingsManager.SETTING_UUID);
    for (int i=0; i < players.size(); i++) {
      PlayerSlot playerSlot=playerSlots.get(i);
      IMultiplayerPlayer player=players.get(i);
      playerSlot.setPlayerName(player.getName());
      playerSlot.setReady(player.isReady());
      if (player.getId().equals(myId)) {
        playerSlot.setReadyButtonEnabled(true);
        playerSlot.informGameAboutReady(joinMultiPlayerMap);
      }
 else {
        playerSlot.setReadyButtonEnabled(false);
      }
    }
    for (int i=players.size(); i < playerSlots.size(); i++) {
      playerSlots.get(i).setPlayerType(EPlayerType.AI_VERY_HARD);
    }
    setCancelButtonActionListener(e -> {
      joinMultiPlayerMap.abort();
      settlersFrame.showMainMenu();
    }
);
  }
);
}
Program: 55874
Project: 55874
Buggy source:
@Override public void gameJoined(IJoinPhaseMultiplayerGameConnector connector){
  SwingUtilities.invokeLater(() -> {
    initializeChatFor(connector);
    setStartButtonActionListener(e -> {
      connector.startGame();
    }
);
    connector.getPlayers().setListener(changingPlayers -> onPlayersChanges(changingPlayers,connector));
    connector.setMultiplayerListener(new IMultiplayerListener(){
      @Override public void gameIsStarting(      IStartingGame game){
        settlersFrame.showStartingGamePanel(game);
      }
      @Override public void gameAborted(){
        settlersFrame.showMainMenu();
      }
    }
);
  }
);
}

Fixed version (ground truth):
@Override public void gameJoined(IJoinPhaseMultiplayerGameConnector connector){
  SwingUtilities.invokeLater(() -> {
    initializeChatFor(connector);
    setStartButtonActionListener(e -> {
      connector.startGame();
    }
);
    connector.getPlayers().setListener(changingPlayers -> onPlayersChanges(changingPlayers,connector));
    connector.setMultiplayerListener(new IMultiplayerListener(){
      @Override public void gameIsStarting(      IStartingGame game){
        settlersFrame.showStartingGamePanel(game);
      }
      @Override public void gameAborted(){
        settlersFrame.showMainMenu();
      }
    }
);
    onPlayersChanges(connector.getPlayers(),connector);
  }
);
}
Program: 55876
Project: 55876
Buggy source:
private void updateAiPlayerName(){
  if (typeComboBox.getSelectedItem() == null || civilisationComboBox.getSelectedItem() == null) {
    return;
  }
  if (!EPlayerType.HUMAN.equals(((PlayerTypeUiWrapper)typeComboBox.getSelectedItem()).getPlayerType())) {
    setPlayerName(Labels.getString("String_Node_Str" + getCivilisation().name() + "String_Node_Str"+ ((PlayerTypeUiWrapper)typeComboBox.getSelectedItem()).getPlayerType().name()));
  }
}

Fixed version (ground truth):
private void updateAiPlayerName(){
  if (typeComboBox.getSelectedItem() == null || civilisationComboBox.getSelectedItem() == null) {
    return;
  }
  if (EPlayerType.HUMAN != (((PlayerTypeUiWrapper)typeComboBox.getSelectedItem()).getPlayerType())) {
    setPlayerName(Labels.getString("String_Node_Str" + getCivilisation().name() + "String_Node_Str"+ ((PlayerTypeUiWrapper)typeComboBox.getSelectedItem()).getPlayerType().name()));
    setReady(true);
  }
 else {
    setReady(false);
  }
}
Program: 55877
Project: 55877
Buggy source:
@Override public EMaterialType tryToTakeDonkeyMaterial(){
  if (!isTargetSet()) {
    return null;
  }
  IRequestStack stack=super.getStackWithMaterial();
  if (stack != null && stack.pop()) {
    return stack.getMaterialType();
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public EMaterialType tryToTakeDonkeyMaterial(){
  if (!isTargetSet()) {
    return null;
  }
  IRequestStack stack=super.getStackWithMaterial();
  if (stack != null) {
    EMaterialType materialType=stack.getMaterialType();
    if (stack.pop()) {
      return materialType;
    }
  }
  return null;
}
Program: 55878
Project: 55878
Buggy source:
@Override public boolean beforeDroppingMaterial(){
  if (request != null && request.isActive() && request.getPos().equals(super.getPos())) {
    request.deliveryFulfilled();
    return false;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
@Override public boolean beforeDroppingMaterial(){
  if (request != null) {
    if (request.isActive() && request.getPos().equals(super.getPos())) {
      request.deliveryFulfilled();
      return false;
    }
 else {
      request.deliveryAborted();
      request=null;
    }
  }
  return true;
}
Program: 55880
Project: 55880
Buggy source:
@Test public void verHardShouldProduceCertainAmountOfSoldiersWithin75Minutes(){
  PlayerSetting[] playerSettings=new PlayerSetting[4];
  playerSettings[0]=new PlayerSetting(true,EPlayerType.AI_VERY_HARD);
  playerSettings[1]=new PlayerSetting(false);
  playerSettings[2]=new PlayerSetting(false);
  playerSettings[3]=new PlayerSetting(false);
  JSettlersGame.GameRunner startingGame=createStartingGame(playerSettings);
  IStartedGame startedGame=ReplayUtils.waitForGameStartup(startingGame);
  MatchConstants.clock().fastForwardTo(75 * MINUTES);
  ReplayUtils.awaitShutdown(startedGame);
  short expectedMinimalProducedSoldiers=250;
  short producedSoldiers=startingGame.getMainGrid().getPartitionsGrid().getPlayer(0).getEndgameStatistic().getAmountOfProducedSoldiers();
  if (producedSoldiers < expectedMinimalProducedSoldiers) {
    fail("String_Node_Str" + expectedMinimalProducedSoldiers + "String_Node_Str"+ producedSoldiers+ "String_Node_Str"+ "String_Node_Str");
  }
  ensureRuntimePerformance("String_Node_Str",startingGame.getAiExecutor().getApplyRulesStopWatch(),50,2500);
  ensureRuntimePerformance("String_Node_Str",startingGame.getAiExecutor().getUpdateStatisticsStopWatch(),50,2500);
}

Fixed version (ground truth):
@Test public void verHardShouldProduceCertainAmountOfSoldiersWithin75Minutes(){
  PlayerSetting[] playerSettings=new PlayerSetting[4];
  playerSettings[0]=new PlayerSetting(true,EPlayerType.AI_VERY_HARD,ECivilisation.ROMAN,(byte)0);
  playerSettings[1]=new PlayerSetting(false,(byte)-1);
  playerSettings[2]=new PlayerSetting(false,(byte)-1);
  playerSettings[3]=new PlayerSetting(false,(byte)-1);
  JSettlersGame.GameRunner startingGame=createStartingGame(playerSettings);
  IStartedGame startedGame=ReplayUtils.waitForGameStartup(startingGame);
  MatchConstants.clock().fastForwardTo(75 * MINUTES);
  ReplayUtils.awaitShutdown(startedGame);
  short expectedMinimalProducedSoldiers=250;
  short producedSoldiers=startingGame.getMainGrid().getPartitionsGrid().getPlayer(0).getEndgameStatistic().getAmountOfProducedSoldiers();
  if (producedSoldiers < expectedMinimalProducedSoldiers) {
    fail("String_Node_Str" + expectedMinimalProducedSoldiers + "String_Node_Str"+ producedSoldiers+ "String_Node_Str"+ "String_Node_Str");
  }
  ensureRuntimePerformance("String_Node_Str",startingGame.getAiExecutor().getApplyRulesStopWatch(),50,2500);
  ensureRuntimePerformance("String_Node_Str",startingGame.getAiExecutor().getUpdateStatisticsStopWatch(),50,2500);
}
Program: 55882
Project: 55882
Buggy source:
private PartitionsGridTestingWnd(){
  this.grid=new PartitionsGrid(WIDTH,HEIGHT,(byte)10,new IPartitionsGridBlockingProvider(){
    @Override public boolean isBlocked(    int x,    int y){
      return blockedGrid.get(x + y * WIDTH);
    }
    @Override public void registerBlockingChangedListener(    IBlockingChangedListener listener){
    }
  }
);
}

Fixed version (ground truth):
private PartitionsGridTestingWnd(){
  this.grid=new PartitionsGrid(WIDTH,HEIGHT,PlayerSetting.createDefaultSettings((byte)0,(byte)10),new IPartitionsGridBlockingProvider(){
    @Override public boolean isBlocked(    int x,    int y){
      return blockedGrid.get(x + y * WIDTH);
    }
    @Override public void registerBlockingChangedListener(    IBlockingChangedListener listener){
    }
  }
);
}
Program: 55883
Project: 55883
Buggy source:
@Override public void run(){
  tree.setCellRenderer(new FileTreeCellRenderer());
}

Fixed version (ground truth):
@Override public void run(){
  initHeader();
  initTree();
  add(new JScrollPane(tree),BorderLayout.CENTER);
  add(foundPanel,BorderLayout.SOUTH);
  setSize(750,640);
  setLocationRelativeTo(null);
}
Program: 55884
Project: 55884
Buggy source:
/** 
 * Constructor
 */
public SelectSettlersFolderDialog(){
  setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  setTitle(Labels.getString("String_Node_Str"));
  setLayout(new BorderLayout());
  addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent e){
synchronized (syncObject) {
        syncObject.notifyAll();
      }
    }
  }
);
  initHeader();
  initTree();
  add(new JScrollPane(tree),BorderLayout.CENTER);
  add(foundPanel,BorderLayout.SOUTH);
  setSize(750,640);
  setLocationRelativeTo(null);
}

Fixed version (ground truth):
/** 
 * Constructor
 */
public SelectSettlersFolderDialog(){
  setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  setTitle(Labels.getString("String_Node_Str"));
  setLayout(new BorderLayout());
  addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent e){
synchronized (syncObject) {
        syncObject.notifyAll();
      }
    }
  }
);
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      initHeader();
      initTree();
      add(new JScrollPane(tree),BorderLayout.CENTER);
      add(foundPanel,BorderLayout.SOUTH);
      setSize(750,640);
      setLocationRelativeTo(null);
    }
  }
);
}
Program: 55885
Project: 55885
Buggy source:
/** 
 * Initialize the Tree with the filesystem
 */
private void initTree(){
  RootTreeNode root=new RootTreeNode(executorService);
  for (  File f : File.listRoots()) {
    root.add(new FilesystemTreeNode(f));
  }
  model=new DefaultTreeModel(root);
  root.setModel(model);
  tree=new JTree(model);
  tree.addTreeSelectionListener(selectionListener);
  tree.addTreeExpansionListener(expansionListener);
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  tree.expandRow(0);
  tree.setRootVisible(false);
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      tree.setCellRenderer(new FileTreeCellRenderer());
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Initialize the Tree with the filesystem
 */
private void initTree(){
  RootTreeNode root=new RootTreeNode(executorService);
  for (  File f : File.listRoots()) {
    root.add(new FilesystemTreeNode(f));
  }
  model=new DefaultTreeModel(root);
  root.setModel(model);
  tree=new JTree(model);
  tree.addTreeSelectionListener(selectionListener);
  tree.addTreeExpansionListener(expansionListener);
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  tree.expandRow(0);
  tree.setRootVisible(false);
  tree.setCellRenderer(new FileTreeCellRenderer());
}
Program: 55887
Project: 55887
Buggy source:
@Override public JComponent getTreeCellRendererComponent(JTree tree,Object value,boolean selected,boolean expanded,boolean leaf,int row,boolean hasFocus){
  super.getTreeCellRendererComponent(tree,value,selected,expanded,leaf,row,hasFocus);
  if (value instanceof FilesystemTreeNode) {
    FilesystemTreeNode node=(FilesystemTreeNode)value;
    File file=node.getFile();
    if (file == null) {
      return this;
    }
    setIcon(fileSystemView.getSystemIcon(file));
    setText(fileSystemView.getSystemDisplayName(file));
    setToolTipText(file.getPath());
    if (node.isSettlerFolder()) {
      setIcon(SETTLER_FOLDER_ICON);
    }
  }
  return this;
}

Fixed version (ground truth):
@Override public Component getTreeCellRendererComponent(JTree tree,Object value,boolean selected,boolean expanded,boolean leaf,int row,boolean hasFocus){
  Component superResult=super.getTreeCellRendererComponent(tree,value,selected,expanded,leaf,row,hasFocus);
  if (value instanceof FilesystemTreeNode) {
    FilesystemTreeNode node=(FilesystemTreeNode)value;
    File file=node.getFile();
    if (file == null) {
      return superResult;
    }
    setIcon(fileSystemView.getSystemIcon(file));
    setText(fileSystemView.getSystemDisplayName(file));
    setToolTipText(file.getPath());
    if (node.isSettlerFolder()) {
      setIcon(SETTLER_FOLDER_ICON);
    }
    return this;
  }
  return superResult;
}
Program: 55888
Project: 55888
Buggy source:
/** 
 * Constructor
 * @param listener Listener for start
 */
public FolderFoundPanel(final ActionListener listener){
  setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  setLayout(new BorderLayout());
  setOpaque(true);
  add(label,BorderLayout.CENTER);
  this.btContinue=new JButton(Labels.getString("String_Node_Str"));
  btContinue.setEnabled(false);
  btContinue.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      listener.actionPerformed(new ActionEvent(this,0,startFolder));
    }
  }
);
  add(btContinue,BorderLayout.EAST);
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param listener Listener for start
 */
public FolderFoundPanel(final ActionListener listener){
  setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  setLayout(new BorderLayout());
  setOpaque(true);
  add(label,BorderLayout.CENTER);
  this.continueButton=new JButton(Labels.getString("String_Node_Str"));
  continueButton.setEnabled(false);
  continueButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      listener.actionPerformed(new ActionEvent(this,0,startFolder));
    }
  }
);
  add(continueButton,BorderLayout.EAST);
}
Program: 55889
Project: 55889
Buggy source:
@Override public void paintComponent(Graphics g1){
  Graphics2D g=(Graphics2D)g1;
  int w=getWidth();
  int h=getHeight();
  GradientPaint gp=new GradientPaint(0,0,background1,0,h,background2);
  g.setPaint(gp);
  g.fillRect(0,0,w,h);
}

Fixed version (ground truth):
@Override public void paintComponent(Graphics g1){
  Graphics2D g=(Graphics2D)g1;
  int w=getWidth();
  int h=getHeight();
  GradientPaint gp=new GradientPaint(0,0,backgroundTop,0,h,backgroundBottom);
  g.setPaint(gp);
  g.fillRect(0,0,w,h);
}
Program: 55890
Project: 55890
Buggy source:
/** 
 * Set the folder to start with
 * @param folder Absolute path
 */
public void setFolder(String folder){
  background1=new Color(0xA4FF92);
  background2=new Color(0x4CC04E);
  label.setText(folder);
  startFolder=folder;
  btContinue.setEnabled(true);
  repaint();
}

Fixed version (ground truth):
/** 
 * Set the folder to start with
 * @param folder Absolute path
 */
public void setFolder(String folder){
  backgroundTop=FOUND_BACKGROUND_TOP;
  backgroundBottom=FOUND_BACKGROUND_BOTTOM;
  label.setText(folder);
  startFolder=folder;
  continueButton.setEnabled(true);
  repaint();
}