nus-yam/ex-repair huggingface dataset:
Program: 93283
Project: 93283
Buggy source:
/** 
 * @return All child categories of the category or null if this category has no children.
 */
Collection<PoiCategory> getChildren();

Fixed version (ground truth):
/** 
 * @return All child categories of the category.
 */
Collection<PoiCategory> getChildren();
Program: 93284
Project: 93284
Buggy source:
public static String getSQLSelectString(PoiCategoryFilter filter){
  return SELECT_STATEMENT + getSQLWhereClauseString(filter) + ' '+ "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Gets the SQL query that looks up POI entries.
 * @param filter The filter object for determining all wanted categories.
 * @return The SQL query.
 */
public static String getSQLSelectString(PoiCategoryFilter filter){
  return SELECT_STATEMENT + getSQLWhereClauseString(filter) + "String_Node_Str";
}
Program: 93285
Project: 93285
Buggy source:
/** 
 * Gets the WHERE clause for the SQL query that looks up POI entries.
 * @param filter The filter object for determining all wanted categories.
 * @return A string like <code>WHERE id BETWEEN 2 AND 5 OR BETWEEN 10 AND 12</code>.
 */
private static String getSQLWhereClauseString(PoiCategoryFilter filter){
  int[] intervals=getCategoryIDIntervals(filter);
  if (intervals.length == 0) {
    return "String_Node_Str";
  }
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  for (int i=0; i < intervals.length; i+=2) {
    sb.append("String_Node_Str").append(intervals[i]).append("String_Node_Str").append(intervals[i + 1]);
    if (i != intervals.length - 2) {
      sb.append("String_Node_Str");
    }
  }
  sb.append(')');
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * Gets the WHERE clause for the SQL query that looks up POI entries.
 * @param filter The filter object for determining all wanted categories.
 * @return The WHERE clause.
 */
private static String getSQLWhereClauseString(PoiCategoryFilter filter){
  Collection<PoiCategory> superCategories=filter.getAcceptedSuperCategories();
  if (superCategories.isEmpty()) {
    return "String_Node_Str";
  }
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  for (Iterator<PoiCategory> superCatIter=superCategories.iterator(); superCatIter.hasNext(); ) {
    PoiCategory superCat=superCatIter.next();
    Collection<PoiCategory> categories=superCat.deepChildren();
    categories.add(superCat);
    sb.append("String_Node_Str");
    for (Iterator<PoiCategory> catIter=categories.iterator(); catIter.hasNext(); ) {
      PoiCategory cat=catIter.next();
      sb.append(cat.getID());
      if (catIter.hasNext()) {
        sb.append("String_Node_Str");
      }
    }
    sb.append("String_Node_Str");
    if (superCatIter.hasNext()) {
      sb.append("String_Node_Str");
    }
  }
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 93286
Project: 93286
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
 else   if (!(obj instanceof Way)) {
    return false;
  }
  Way other=(Way)obj;
  if (this.layer != other.layer) {
    return false;
  }
 else   if (!this.tags.equals(other.tags)) {
    return false;
  }
 else   if (this.labelPosition == null && other.labelPosition != null) {
    return false;
  }
 else   if (this.labelPosition != null && this.labelPosition.equals(other.labelPosition)) {
    return false;
  }
 else   if (this.latLongs.length != other.latLongs.length) {
    return false;
  }
 else {
    for (int i=0; i < this.latLongs.length; i++) {
      if (this.latLongs[i].length != other.latLongs[i].length) {
        return false;
      }
 else {
        for (int j=0; j < this.latLongs[i].length; j++) {
          if (!latLongs[i][j].equals(other.latLongs[i][j])) {
            return false;
          }
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
 else   if (!(obj instanceof Way)) {
    return false;
  }
  Way other=(Way)obj;
  if (this.layer != other.layer) {
    return false;
  }
 else   if (!this.tags.equals(other.tags)) {
    return false;
  }
 else   if (this.labelPosition == null && other.labelPosition != null) {
    return false;
  }
 else   if (this.labelPosition != null && !this.labelPosition.equals(other.labelPosition)) {
    return false;
  }
 else   if (this.latLongs.length != other.latLongs.length) {
    return false;
  }
 else {
    for (int i=0; i < this.latLongs.length; i++) {
      if (this.latLongs[i].length != other.latLongs[i].length) {
        return false;
      }
 else {
        for (int j=0; j < this.latLongs[i].length; j++) {
          if (!latLongs[i][j].equals(other.latLongs[i][j])) {
            return false;
          }
        }
      }
    }
  }
  return true;
}
Program: 93287
Project: 93287
Buggy source:
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + layer;
  result=prime * result + tags.hashCode();
  result=prime * result + latLongs.hashCode();
  if (labelPosition != null) {
    result=prime * result + labelPosition.hashCode();
  }
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + layer;
  result=prime * result + tags.hashCode();
  result=prime * result + Arrays.deepHashCode(latLongs);
  if (labelPosition != null) {
    result=prime * result + labelPosition.hashCode();
  }
  return result;
}
Program: 93288
Project: 93288
Buggy source:
private static BoundingBox addLayers(MapView mapView,List<File> mapFiles,TileCache tileCache){
  Layers layers=mapView.getLayerManager().getLayers();
  BoundingBox result=null;
  for (  File mapFile : mapFiles) {
    TileRendererLayer tileRendererLayer=createTileRendererLayer(tileCache,mapView.getModel().mapViewPosition,true,true,mapFile);
    BoundingBox boundingBox=tileRendererLayer.getMapDataStore().boundingBox();
    result=result == null ? boundingBox : result.extend(boundingBox);
    layers.add(tileRendererLayer);
  }
  if (SHOW_DEBUG_LAYERS) {
    layers.add(new TileGridLayer(GRAPHIC_FACTORY,mapView.getModel().displayModel));
    layers.add(new TileCoordinatesLayer(GRAPHIC_FACTORY,mapView.getModel().displayModel));
  }
  return result;
}

Fixed version (ground truth):
private static BoundingBox addLayers(MapView mapView,List<File> mapFiles,TileCache[] tileCaches){
  Layers layers=mapView.getLayerManager().getLayers();
  BoundingBox result=null;
  for (int i=0; i < mapFiles.size(); i++) {
    File mapFile=mapFiles.get(i);
    tileCaches[i]=createTileCache(i);
    TileRendererLayer tileRendererLayer=createTileRendererLayer(tileCaches[i],mapView.getModel().mapViewPosition,true,true,mapFile);
    BoundingBox boundingBox=tileRendererLayer.getMapDataStore().boundingBox();
    result=result == null ? boundingBox : result.extend(boundingBox);
    layers.add(tileRendererLayer);
  }
  if (SHOW_DEBUG_LAYERS) {
    layers.add(new TileGridLayer(GRAPHIC_FACTORY,mapView.getModel().displayModel));
    layers.add(new TileCoordinatesLayer(GRAPHIC_FACTORY,mapView.getModel().displayModel));
  }
  return result;
}
Program: 93289
Project: 93289
Buggy source:
private static TileCache createTileCache(){
  TileCache firstLevelTileCache=new InMemoryTileCache(128);
  File cacheDirectory=new File(System.getProperty("String_Node_Str"),"String_Node_Str");
  TileCache secondLevelTileCache=new FileSystemTileCache(1024,cacheDirectory,GRAPHIC_FACTORY);
  return new TwoLevelTileCache(firstLevelTileCache,secondLevelTileCache);
}

Fixed version (ground truth):
private static TileCache createTileCache(int index){
  TileCache firstLevelTileCache=new InMemoryTileCache(128);
  File cacheDirectory=new File(System.getProperty("String_Node_Str"),"String_Node_Str" + index);
  TileCache secondLevelTileCache=new FileSystemTileCache(1024,cacheDirectory,GRAPHIC_FACTORY);
  return new TwoLevelTileCache(firstLevelTileCache,secondLevelTileCache);
}
Program: 93290
Project: 93290
Buggy source:
/** 
 * Starts the   {@code MapViewer}.
 * @param args command line args: expects the map files as multiple parameters.
 */
public static void main(String[] args){
  List<File> mapFiles=getMapFiles(args);
  MapView mapView=createMapView();
  TileCache tileCache=createTileCache();
  final BoundingBox boundingBox=addLayers(mapView,mapFiles,tileCache);
  PreferencesFacade preferencesFacade=new JavaUtilPreferences(Preferences.userNodeForPackage(MapViewer.class));
  final Model model=mapView.getModel();
  model.init(preferencesFacade);
  MainFrame mainFrame=new MainFrame();
  mainFrame.add(mapView);
  mainFrame.addWindowListener(new WindowCloseDialog(mainFrame,mapView,preferencesFacade,tileCache));
  mainFrame.setVisible(true);
  mainFrame.addWindowListener(new WindowAdapter(){
    @Override public void windowOpened(    WindowEvent e){
      byte zoomLevel=LatLongUtils.zoomForBounds(model.mapViewDimension.getDimension(),boundingBox,model.displayModel.getTileSize());
      model.mapViewPosition.setMapPosition(new MapPosition(boundingBox.getCenterPoint(),zoomLevel));
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Starts the   {@code MapViewer}.
 * @param args command line args: expects the map files as multiple parameters.
 */
public static void main(String[] args){
  List<File> mapFiles=getMapFiles(args);
  MapView mapView=createMapView();
  TileCache[] tileCaches=new TileCache[mapFiles.size()];
  final BoundingBox boundingBox=addLayers(mapView,mapFiles,tileCaches);
  PreferencesFacade preferencesFacade=new JavaUtilPreferences(Preferences.userNodeForPackage(MapViewer.class));
  final Model model=mapView.getModel();
  model.init(preferencesFacade);
  MainFrame mainFrame=new MainFrame();
  mainFrame.add(mapView);
  mainFrame.addWindowListener(new WindowCloseDialog(mainFrame,mapView,preferencesFacade,tileCaches));
  mainFrame.setVisible(true);
  mainFrame.addWindowListener(new WindowAdapter(){
    @Override public void windowOpened(    WindowEvent e){
      byte zoomLevel=LatLongUtils.zoomForBounds(model.mapViewDimension.getDimension(),boundingBox,model.displayModel.getTileSize());
      model.mapViewPosition.setMapPosition(new MapPosition(boundingBox.getCenterPoint(),zoomLevel));
    }
  }
);
}
Program: 93291
Project: 93291
Buggy source:
@Override public void windowClosing(WindowEvent windowEvent){
  int result=JOptionPane.showConfirmDialog(this.jFrame,MESSAGE,TITLE,JOptionPane.YES_NO_OPTION);
  if (result == JOptionPane.YES_OPTION) {
    this.mapView.getModel().save(this.preferencesFacade);
    this.tileCache.destroy();
    this.mapView.destroy();
    this.jFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  }
}

Fixed version (ground truth):
@Override public void windowClosing(WindowEvent windowEvent){
  int result=JOptionPane.showConfirmDialog(this.jFrame,MESSAGE,TITLE,JOptionPane.YES_NO_OPTION);
  if (result == JOptionPane.YES_OPTION) {
    this.mapView.getModel().save(this.preferencesFacade);
    for (    TileCache tileCache : tileCaches) {
      tileCache.destroy();
    }
    this.mapView.destroy();
    this.jFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  }
}
Program: 93292
Project: 93292
Buggy source:
public WindowCloseDialog(JFrame jFrame,MapView mapView,PreferencesFacade preferencesFacade,TileCache tileCache){
  super();
  this.jFrame=jFrame;
  this.mapView=mapView;
  this.preferencesFacade=preferencesFacade;
  this.tileCache=tileCache;
  jFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
}

Fixed version (ground truth):
public WindowCloseDialog(JFrame jFrame,MapView mapView,PreferencesFacade preferencesFacade,TileCache[] tileCaches){
  super();
  this.jFrame=jFrame;
  this.mapView=mapView;
  this.preferencesFacade=preferencesFacade;
  this.tileCaches=tileCaches;
  jFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
}
Program: 93293
Project: 93293
Buggy source:
private static android.graphics.Bitmap getTileBitmapFromReusableSet(int tileSize,boolean isTransparent){
  int hash=composeHash(tileSize,isTransparent);
  Set<SoftReference<Bitmap>> subSet=reusableTileBitmaps.get(hash);
  if (subSet == null) {
    return null;
  }
  android.graphics.Bitmap bitmap=null;
synchronized (subSet) {
    final Iterator<SoftReference<android.graphics.Bitmap>> iterator=subSet.iterator();
    android.graphics.Bitmap candidate;
    while (iterator.hasNext()) {
      candidate=iterator.next().get();
      if (null != candidate && candidate.isMutable()) {
        bitmap=candidate;
        if (isTransparent) {
          bitmap.eraseColor(android.graphics.Color.TRANSPARENT);
        }
        iterator.remove();
        break;
      }
 else {
        iterator.remove();
      }
    }
  }
  return bitmap;
}

Fixed version (ground truth):
private static android.graphics.Bitmap getTileBitmapFromReusableSet(int tileSize,boolean isTransparent){
  int hash=composeHash(tileSize,isTransparent);
synchronized (reusableTileBitmaps) {
    Set<SoftReference<Bitmap>> subSet=reusableTileBitmaps.get(hash);
    if (subSet == null) {
      return null;
    }
    android.graphics.Bitmap bitmap=null;
    final Iterator<SoftReference<android.graphics.Bitmap>> iterator=subSet.iterator();
    android.graphics.Bitmap candidate;
    while (iterator.hasNext()) {
      candidate=iterator.next().get();
      if (null != candidate && candidate.isMutable()) {
        bitmap=candidate;
        if (isTransparent) {
          bitmap.eraseColor(android.graphics.Color.TRANSPARENT);
        }
        iterator.remove();
        break;
      }
 else {
        iterator.remove();
      }
    }
    return bitmap;
  }
}
Program: 93294
Project: 93294
Buggy source:
@Override protected void destroyBitmap(){
  if (this.bitmap != null) {
    if (AndroidUtil.HONEYCOMB_PLUS) {
      final int tileSize=this.getHeight();
synchronized (reusableTileBitmaps) {
        int hash=composeHash(tileSize,this.bitmap.hasAlpha());
        if (!reusableTileBitmaps.containsKey(hash)) {
          reusableTileBitmaps.put(hash,new HashSet<SoftReference<Bitmap>>());
        }
        Set<SoftReference<Bitmap>> sizeSpecificSet=reusableTileBitmaps.get(hash);
synchronized (sizeSpecificSet) {
          sizeSpecificSet.add(new SoftReference<Bitmap>(this.bitmap));
        }
      }
    }
 else {
      this.bitmap.recycle();
    }
    this.bitmap=null;
  }
}

Fixed version (ground truth):
@Override protected void destroyBitmap(){
  if (this.bitmap != null) {
    if (AndroidUtil.HONEYCOMB_PLUS) {
      final int tileSize=this.getHeight();
synchronized (reusableTileBitmaps) {
        int hash=composeHash(tileSize,this.bitmap.hasAlpha());
        if (!reusableTileBitmaps.containsKey(hash)) {
          reusableTileBitmaps.put(hash,new HashSet<SoftReference<Bitmap>>());
        }
        Set<SoftReference<Bitmap>> sizeSpecificSet=reusableTileBitmaps.get(hash);
        sizeSpecificSet.add(new SoftReference<Bitmap>(this.bitmap));
      }
    }
 else {
      this.bitmap.recycle();
    }
    this.bitmap=null;
  }
}
Program: 93295
Project: 93295
Buggy source:
public synchronized void add(T job){
  if (!this.assignedJobs.contains(job)) {
    QueueItem<T> queueItem=new QueueItem<T>(job);
    if (!this.queueItems.contains(queueItem)) {
      this.queueItems.add(queueItem);
      this.scheduleNeeded=true;
    }
  }
}

Fixed version (ground truth):
public synchronized void add(T job){
  if (!this.assignedJobs.contains(job)) {
    QueueItem<T> queueItem=new QueueItem<T>(job);
    if (!this.queueItems.contains(queueItem)) {
      this.queueItems.add(queueItem);
      this.scheduleNeeded=true;
      this.notifyWorkers();
    }
  }
}
Program: 93296
Project: 93296
Buggy source:
/** 
 * Returns the most important entry from this queue. The method blocks while this queue is empty or while there are already a certain number of jobs assigned.
 * @param maxAssigned the maximum number of jobs that should be assigned at any one point. If thereare already so many jobs assigned, the queue will block. This is to ensure that the scheduling will continue to work.
 */
public synchronized T get(int maxAssigned) throws InterruptedException {
  while (this.queueItems.isEmpty() || this.assignedJobs.size() >= maxAssigned) {
    this.wait();
  }
  if (this.scheduleNeeded) {
    this.scheduleNeeded=false;
    schedule(displayModel.getTileSize());
  }
  T job=this.queueItems.remove(0).object;
  this.assignedJobs.add(job);
  return job;
}

Fixed version (ground truth):
/** 
 * Returns the most important entry from this queue. The method blocks while this queue is empty or while there are already a certain number of jobs assigned.
 * @param maxAssigned the maximum number of jobs that should be assigned at any one point. If thereare already so many jobs assigned, the queue will block. This is to ensure that the scheduling will continue to work.
 */
public synchronized T get(int maxAssigned) throws InterruptedException {
  while (this.queueItems.isEmpty() || this.assignedJobs.size() >= maxAssigned) {
    this.wait(200);
  }
  if (this.scheduleNeeded) {
    this.scheduleNeeded=false;
    schedule(displayModel.getTileSize());
  }
  T job=this.queueItems.remove(0).object;
  this.assignedJobs.add(job);
  return job;
}
Program: 93297
Project: 93297
Buggy source:
/** 
 * Determines whether a File instance refers to a valid cache directory. <p> This method checks that   {@code file} refers to a directory to which the current process has read and writeaccess. If the directory does not exist, it will be created.
 * @param file The File instance to examine. This can be null, which will cause the method to return  {@code false}.
 */
private static boolean isValidCacheDirectory(File file){
  if ((file == null) || (!file.exists() && !file.mkdirs()) || !file.isDirectory()|| !file.canRead()|| !file.canWrite()) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Determines whether a File instance refers to a valid cache directory. <p> This method checks that   {@code file} refers to a directory to which the current process has read and writeaccess. If the directory does not exist, it will be created.
 * @param file The File instance to examine. This can be null, which will cause the method to return  {@code false}.
 */
private static boolean isValidCacheDirectory(File file){
  return !((file == null) || (!file.exists() && !file.mkdirs()) || !file.isDirectory()|| !file.canRead()|| !file.canWrite());
}
Program: 93298
Project: 93298
Buggy source:
protected File findFile(Job key){
  File l1=new File(this.rootDirectory,Byte.toString(key.tile.zoomLevel));
  if (l1 == null || !l1.isDirectory() || !l1.canRead()) {
    LOGGER.info("String_Node_Str" + l1.getAbsolutePath());
    return null;
  }
  File l2=new File(l1,Long.toString(key.tile.tileX));
  if (l2 == null || !l2.isDirectory() || !l2.canRead()) {
    LOGGER.info("String_Node_Str" + l2.getAbsolutePath());
    return null;
  }
  File l3=new File(l2,Long.toString(key.tile.tileY) + this.suffix);
  if (l3 == null || !l3.isFile() || !l3.canRead()) {
    LOGGER.info("String_Node_Str" + l3.getAbsolutePath());
    return null;
  }
  LOGGER.info("String_Node_Str" + l3.getAbsolutePath());
  return l3;
}

Fixed version (ground truth):
File findFile(Job key){
  File l1=new File(this.rootDirectory,Byte.toString(key.tile.zoomLevel));
  if (!l1.isDirectory() || !l1.canRead()) {
    LOGGER.info("String_Node_Str" + l1.getAbsolutePath());
    return null;
  }
  File l2=new File(l1,Long.toString(key.tile.tileX));
  if (!l2.isDirectory() || !l2.canRead()) {
    LOGGER.info("String_Node_Str" + l2.getAbsolutePath());
    return null;
  }
  File l3=new File(l2,Long.toString(key.tile.tileY) + this.suffix);
  if (!l3.isFile() || !l3.canRead()) {
    LOGGER.info("String_Node_Str" + l3.getAbsolutePath());
    return null;
  }
  LOGGER.info("String_Node_Str" + l3.getAbsolutePath());
  return l3;
}
Program: 93299
Project: 93299
Buggy source:
@Override public boolean containsKey(Job key){
  if (this.firstLevelTileCache.containsKey(key)) {
    return true;
  }
  return this.secondLevelTileCache.containsKey(key);
}

Fixed version (ground truth):
@Override public boolean containsKey(Job key){
  return this.firstLevelTileCache.containsKey(key) || this.secondLevelTileCache.containsKey(key);
}
Program: 93300
Project: 93300
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
 else   if (!super.equals(obj)) {
    return false;
  }
 else   if (!(obj instanceof DownloadJob)) {
    return false;
  }
  DownloadJob other=(DownloadJob)obj;
  if (!this.tileSource.equals(other.tileSource)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
 else   if (!super.equals(obj)) {
    return false;
  }
 else   if (!(obj instanceof DownloadJob)) {
    return false;
  }
  DownloadJob other=(DownloadJob)obj;
  return this.tileSource.equals(other.tileSource);
}
Program: 93301
Project: 93301
Buggy source:
@Override public synchronized void setDisplayModel(DisplayModel displayModel){
  super.setDisplayModel(displayModel);
  int numberOfDownloadThreads=Math.min(tileSource.getParallelRequestsLimit(),DOWNLOAD_THREADS_MAX);
  if (this.displayModel != null) {
    this.tileDownloadThreads=new TileDownloadThread[numberOfDownloadThreads];
    for (int i=0; i < numberOfDownloadThreads; ++i) {
      this.tileDownloadThreads[i]=new TileDownloadThread(this.tileCache,this.jobQueue,this,this.graphicFactory,this.displayModel);
    }
  }
 else {
    if (this.tileDownloadThreads != null) {
      for (int i=0; i < tileDownloadThreads.length; ++i) {
        this.tileDownloadThreads[i].interrupt();
      }
    }
  }
}

Fixed version (ground truth):
@Override public synchronized void setDisplayModel(DisplayModel displayModel){
  super.setDisplayModel(displayModel);
  int numberOfDownloadThreads=Math.min(tileSource.getParallelRequestsLimit(),DOWNLOAD_THREADS_MAX);
  if (this.displayModel != null) {
    this.tileDownloadThreads=new TileDownloadThread[numberOfDownloadThreads];
    for (int i=0; i < numberOfDownloadThreads; ++i) {
      this.tileDownloadThreads[i]=new TileDownloadThread(this.tileCache,this.jobQueue,this,this.graphicFactory,this.displayModel);
    }
  }
 else {
    if (this.tileDownloadThreads != null) {
      for (      final TileDownloadThread tileDownloadThread : tileDownloadThreads) {
        tileDownloadThread.interrupt();
      }
    }
  }
}
Program: 93303
Project: 93303
Buggy source:
@Override public URL getTileUrl(Tile tile) throws MalformedURLException {
  StringBuilder stringBuilder=new StringBuilder(32);
  stringBuilder.append("String_Node_Str");
  stringBuilder.append(tile.zoomLevel);
  stringBuilder.append('/');
  stringBuilder.append(tile.tileX);
  stringBuilder.append('/');
  stringBuilder.append(tile.tileY);
  stringBuilder.append("String_Node_Str");
  return new URL(PROTOCOL,getHostName(),this.port,stringBuilder.toString());
}

Fixed version (ground truth):
@Override public URL getTileUrl(Tile tile) throws MalformedURLException {
  return new URL(PROTOCOL,getHostName(),this.port,"String_Node_Str" + tile.zoomLevel + '/'+ tile.tileX+ '/'+ tile.tileY+ "String_Node_Str");
}
Program: 93304
Project: 93304
Buggy source:
@Override public URL getTileUrl(Tile tile) throws MalformedURLException {
  StringBuilder stringBuilder=new StringBuilder(32);
  stringBuilder.append('/');
  stringBuilder.append(tile.zoomLevel);
  stringBuilder.append('/');
  stringBuilder.append(tile.tileX);
  stringBuilder.append('/');
  stringBuilder.append(tile.tileY);
  stringBuilder.append("String_Node_Str");
  return new URL(PROTOCOL,getHostName(),this.port,stringBuilder.toString());
}

Fixed version (ground truth):
@Override public URL getTileUrl(Tile tile) throws MalformedURLException {
  return new URL(PROTOCOL,getHostName(),this.port,"String_Node_Str" + tile.zoomLevel + '/'+ tile.tileX+ '/'+ tile.tileY+ "String_Node_Str");
}
Program: 93305
Project: 93305
Buggy source:
/** 
 * Returns a version number, which changes every time an update is made to the LabelStore.
 * @return
 */
abstract int getVersion();

Fixed version (ground truth):
/** 
 * Returns a version number, which changes every time an update is made to the LabelStore.
 * @return the version number
 */
abstract int getVersion();
Program: 93306
Project: 93306
Buggy source:
/** 
 * Returns if a tile is in the current tile set and no data is stored for this tile.
 * @param tile the tile
 * @return
 */
public synchronized boolean requiresTile(Tile tile){
  return this.lastVisibleTileSet.contains(tile) && !this.containsKey(tile);
}

Fixed version (ground truth):
/** 
 * Returns if a tile is in the current tile set and no data is stored for this tile.
 * @param tile the tile
 * @return true if the tile is in the current tile set, but no data is stored for it.
 */
public synchronized boolean requiresTile(Tile tile){
  return this.lastVisibleTileSet.contains(tile) && !this.containsKey(tile);
}
Program: 93307
Project: 93307
Buggy source:
public static String composeKey(String z,String x,String y){
  return new StringBuilder().append(z).append(File.separatorChar).append(x).append(File.separatorChar).append(y).toString();
}

Fixed version (ground truth):
public static String composeKey(String z,String x,String y){
  return z + File.separatorChar + x+ File.separatorChar+ y;
}
Program: 93308
Project: 93308
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
 else   if (!(obj instanceof Job)) {
    return false;
  }
  Job other=(Job)obj;
  if (this.hasAlpha != other.hasAlpha) {
    return false;
  }
  return this.tile.equals(other.tile);
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
 else   if (!(obj instanceof Job)) {
    return false;
  }
  Job other=(Job)obj;
  return this.hasAlpha == other.hasAlpha && this.tile.equals(other.tile);
}
Program: 93309
Project: 93309
Buggy source:
private void drawShapePaintContainer(ShapePaintContainer shapePaintContainer,Tile tile){
  ShapeType shapeType=shapePaintContainer.shapeContainer.getShapeType();
switch (shapeType) {
case CIRCLE:
    drawCircleContainer(shapePaintContainer);
  return;
case POLYLINE:
PolylineContainer polylineContainer=(PolylineContainer)shapePaintContainer.shapeContainer;
drawPath(shapePaintContainer,polylineContainer.getCoordinatesRelativeToTile(),shapePaintContainer.dy);
return;
}
}

Fixed version (ground truth):
private void drawShapePaintContainer(ShapePaintContainer shapePaintContainer){
  ShapeType shapeType=shapePaintContainer.shapeContainer.getShapeType();
switch (shapeType) {
case CIRCLE:
    drawCircleContainer(shapePaintContainer);
  return;
case POLYLINE:
PolylineContainer polylineContainer=(PolylineContainer)shapePaintContainer.shapeContainer;
drawPath(shapePaintContainer,polylineContainer.getCoordinatesRelativeToTile(),shapePaintContainer.dy);
return;
}
}
Program: 93310
Project: 93310
Buggy source:
void drawWays(List<List<List<ShapePaintContainer>>> drawWays,Tile tile){
  int levelsPerLayer=drawWays.get(0).size();
  for (int layer=0, layers=drawWays.size(); layer < layers; ++layer) {
    List<List<ShapePaintContainer>> shapePaintContainers=drawWays.get(layer);
    for (int level=0; level < levelsPerLayer; ++level) {
      List<ShapePaintContainer> wayList=shapePaintContainers.get(level);
      for (int index=wayList.size() - 1; index >= 0; --index) {
        drawShapePaintContainer(wayList.get(index),tile);
      }
    }
  }
}

Fixed version (ground truth):
void drawWays(List<List<List<ShapePaintContainer>>> drawWays,Tile tile){
  int levelsPerLayer=drawWays.get(0).size();
  for (int layer=0, layers=drawWays.size(); layer < layers; ++layer) {
    List<List<ShapePaintContainer>> shapePaintContainers=drawWays.get(layer);
    for (int level=0; level < levelsPerLayer; ++level) {
      List<ShapePaintContainer> wayList=shapePaintContainers.get(level);
      for (int index=wayList.size() - 1; index >= 0; --index) {
        drawShapePaintContainer(wayList.get(index));
      }
    }
  }
}
Program: 93311
Project: 93311
Buggy source:
protected boolean renderBitmap(RenderContext renderContext){
  return !renderContext.renderTheme.hasMapBackgroundOutside() || this.mapDatabase.supportsTile(renderContext.rendererJob.tile);
}

Fixed version (ground truth):
boolean renderBitmap(RenderContext renderContext){
  return !renderContext.renderTheme.hasMapBackgroundOutside() || this.mapDatabase.supportsTile(renderContext.rendererJob.tile);
}
Program: 93312
Project: 93312
Buggy source:
/** 
 * Calculates the center of the minimum bounding rectangle for the given coordinates.
 * @param coordinates the coordinates for which calculation should be done.
 * @return the center coordinates of the minimum bounding rectangle.
 */
static LatLong calculateCenterOfBoundingBox(LatLong[] coordinates){
  double pointXMin=coordinates[0].longitude;
  double pointXMax=coordinates[0].longitude;
  double pointYMin=coordinates[0].latitude;
  double pointYMax=coordinates[0].latitude;
  for (int i=1; i < coordinates.length; ++i) {
    LatLong immutablePoint=coordinates[i];
    if (immutablePoint.longitude < pointXMin) {
      pointXMin=immutablePoint.longitude;
    }
 else     if (immutablePoint.longitude > pointXMax) {
      pointXMax=immutablePoint.longitude;
    }
    if (immutablePoint.latitude < pointYMin) {
      pointYMin=immutablePoint.latitude;
    }
 else     if (immutablePoint.latitude > pointYMax) {
      pointYMax=immutablePoint.latitude;
    }
  }
  return new LatLong((pointXMin + pointXMax) / 2,(pointYMax + pointYMin) / 2,true);
}

Fixed version (ground truth):
/** 
 * Calculates the center of the minimum bounding rectangle for the given coordinates.
 * @param coordinates the coordinates for which calculation should be done.
 * @return the center coordinates of the minimum bounding rectangle.
 */
static Point calculateCenterOfBoundingBox(Point[] coordinates){
  double pointXMin=coordinates[0].x;
  double pointXMax=coordinates[0].x;
  double pointYMin=coordinates[0].y;
  double pointYMax=coordinates[0].y;
  for (  Point immutablePoint : coordinates) {
    if (immutablePoint.x < pointXMin) {
      pointXMin=immutablePoint.x;
    }
 else     if (immutablePoint.x > pointXMax) {
      pointXMax=immutablePoint.x;
    }
    if (immutablePoint.y < pointYMin) {
      pointYMin=immutablePoint.y;
    }
 else     if (immutablePoint.y > pointYMax) {
      pointYMax=immutablePoint.y;
    }
  }
  return new Point((pointXMin + pointXMax) / 2,(pointYMax + pointYMin) / 2);
}
Program: 93313
Project: 93313
Buggy source:
/** 
 * Heuristic to determine from attributes if a way is likely to be an area. Determining what is an area is neigh impossible in OSM, this method inspects tag elements to give a likely answer. See http://wiki.openstreetmap.org/wiki/The_Future_of_Areas and http://wiki.openstreetmap.org/wiki/Way
 * @param way the way (which is assumed to be closed and have enough nodes to be an area)
 * @return true if tags indicate this is an area, otherwise false.
 */
public static boolean isArea(Way way){
  boolean result=true;
  if (way.getTags() != null) {
    for (    Tag tag : way.getTags()) {
      String key=tag.getKey().toLowerCase(Locale.ENGLISH);
      String value=tag.getValue().toLowerCase(Locale.ENGLISH);
      if ("String_Node_Str".equals(key)) {
        if (("String_Node_Str").equals(value) || ("String_Node_Str").equals(value) || ("String_Node_Str").equals(value)) {
          return true;
        }
        if (("String_Node_Str").equals(value) || ("String_Node_Str").equals(value) || ("String_Node_Str").equals(value)) {
          return false;
        }
      }
      if ("String_Node_Str".equals(key) || "String_Node_Str".equals(key) || "String_Node_Str".equals(key)) {
        result=false;
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Heuristic to determine from attributes if a way is likely to be an area. Precondition for this call is that the first and last node of a way are the same, so that this method should only return false if it is known that the feature should not be an area even if the geometry is a polygon.  Determining what is an area is neigh impossible in OSM, this method inspects tag elements to give a likely answer. See http://wiki.openstreetmap.org/wiki/The_Future_of_Areas and http://wiki.openstreetmap.org/wiki/Way
 * @param way the way (which is assumed to be closed and have enough nodes to be an area)
 * @return true if tags indicate this is an area, otherwise false.
 */
public static boolean isArea(Way way){
  boolean result=true;
  if (way.getTags() != null) {
    for (    Tag tag : way.getTags()) {
      String key=tag.getKey().toLowerCase(Locale.ENGLISH);
      String value=tag.getValue().toLowerCase(Locale.ENGLISH);
      if ("String_Node_Str".equals(key)) {
        if (("String_Node_Str").equals(value) || ("String_Node_Str").equals(value) || ("String_Node_Str").equals(value)) {
          return true;
        }
        if (("String_Node_Str").equals(value) || ("String_Node_Str").equals(value) || ("String_Node_Str").equals(value)) {
          return false;
        }
      }
      if ("String_Node_Str".equals(key) || "String_Node_Str".equals(key)) {
        result=false;
      }
      if ("String_Node_Str".equals(key)) {
        if ("String_Node_Str".equals(value) || "String_Node_Str".equals(value) || "String_Node_Str".equals(value)|| "String_Node_Str".equals(value)|| "String_Node_Str".equals(value)|| "String_Node_Str".equals(value)|| "String_Node_Str".equals(value)|| "String_Node_Str".equals(value)) {
          return false;
        }
        return true;
      }
    }
  }
  return result;
}
Program: 93314
Project: 93314
Buggy source:
/** 
 * Creates a new TDWay from an osmosis way entity using the given NodeResolver.
 * @param way the way
 * @param resolver the resolver
 * @param preferredLanguage the preferred language or null if no preference
 * @return a new TDWay if it is valid, null otherwise
 */
public static TDWay fromWay(Way way,NodeResolver resolver,String preferredLanguage){
  if (way == null)   return null;
  SpecialTagExtractionResult ster=OSMUtils.extractSpecialFields(way,preferredLanguage);
  short[] knownWayTags=OSMUtils.extractKnownWayTags(way);
  if (way.getWayNodes().size() >= 2) {
    boolean validWay=true;
    TDNode[] waynodes=new TDNode[way.getWayNodes().size()];
    int i=0;
    for (    WayNode waynode : way.getWayNodes()) {
      waynodes[i]=resolver.getNode(waynode.getNodeId());
      if (waynodes[i] == null) {
        validWay=false;
        LOGGER.finer("String_Node_Str" + waynode.getNodeId() + "String_Node_Str"+ way.getId());
      }
      i++;
    }
    if (validWay) {
      byte shape=LINE;
      if (waynodes[0].getId() == waynodes[waynodes.length - 1].getId()) {
        if (waynodes.length >= GeoUtils.MIN_NODES_POLYGON && OSMUtils.isArea(way)) {
          shape=SIMPLE_POLYGON;
        }
 else {
          LOGGER.finer("String_Node_Str" + way.getId());
          return null;
        }
      }
      return new TDWay(way.getId(),ster.getLayer(),ster.getName(),ster.getHousenumber(),ster.getRef(),knownWayTags,shape,waynodes);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Creates a new TDWay from an osmosis way entity using the given NodeResolver.
 * @param way the way
 * @param resolver the resolver
 * @param preferredLanguage the preferred language or null if no preference
 * @return a new TDWay if it is valid, null otherwise
 */
public static TDWay fromWay(Way way,NodeResolver resolver,String preferredLanguage){
  if (way == null)   return null;
  SpecialTagExtractionResult ster=OSMUtils.extractSpecialFields(way,preferredLanguage);
  short[] knownWayTags=OSMUtils.extractKnownWayTags(way);
  if (way.getWayNodes().size() >= 2) {
    boolean validWay=true;
    TDNode[] waynodes=new TDNode[way.getWayNodes().size()];
    int i=0;
    for (    WayNode waynode : way.getWayNodes()) {
      waynodes[i]=resolver.getNode(waynode.getNodeId());
      if (waynodes[i] == null) {
        validWay=false;
        LOGGER.finer("String_Node_Str" + waynode.getNodeId() + "String_Node_Str"+ way.getId());
      }
      i++;
    }
    if (validWay) {
      byte shape=LINE;
      if (waynodes[0].getId() == waynodes[waynodes.length - 1].getId()) {
        if (waynodes.length >= GeoUtils.MIN_NODES_POLYGON) {
          if (OSMUtils.isArea(way)) {
            shape=SIMPLE_POLYGON;
          }
        }
 else {
          LOGGER.finer("String_Node_Str" + way.getId());
          return null;
        }
      }
      return new TDWay(way.getId(),ster.getLayer(),ster.getName(),ster.getHousenumber(),ster.getRef(),knownWayTags,shape,waynodes);
    }
  }
  return null;
}
Program: 93316
Project: 93316
Buggy source:
/** 
 * Heuristic to determine from attributes if a way is likely to be an area. Determining what is an area is neigh impossible in OSM, this method inspects tag elements to give a likely answer. See http://wiki.openstreetmap.org/wiki/The_Future_of_Areas and http://wiki.openstreetmap.org/wiki/Way
 * @param way the way (which is assumed to be closed and have enough nodes to be an area)
 * @return true if tags indicate this is an area, otherwise false.
 */
public static boolean isArea(Way way){
  boolean result=true;
  if (way.getTags() != null) {
    for (    Tag tag : way.getTags()) {
      String key=tag.getKey().toLowerCase(Locale.ENGLISH);
      String value=tag.getValue().toLowerCase(Locale.ENGLISH);
      if ("String_Node_Str".equals(key)) {
        if (("String_Node_Str").equals(value) || ("String_Node_Str").equals(value) || ("String_Node_Str").equals(value)) {
          return true;
        }
        if (("String_Node_Str").equals(value) || ("String_Node_Str").equals(value) || ("String_Node_Str").equals(value)) {
          return false;
        }
      }
      if ("String_Node_Str".equals(key) || "String_Node_Str".equals(key) || "String_Node_Str".equals(key)) {
        result=false;
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Heuristic to determine from attributes if a way is likely to be an area. Precondition for this call is that the first and last node of a way are the same, so that this method should only return false if it is known that the feature should not be an area even if the geometry is a polygon.  Determining what is an area is neigh impossible in OSM, this method inspects tag elements to give a likely answer. See http://wiki.openstreetmap.org/wiki/The_Future_of_Areas and http://wiki.openstreetmap.org/wiki/Way
 * @param way the way (which is assumed to be closed and have enough nodes to be an area)
 * @return true if tags indicate this is an area, otherwise false.
 */
public static boolean isArea(Way way){
  boolean result=true;
  if (way.getTags() != null) {
    for (    Tag tag : way.getTags()) {
      String key=tag.getKey().toLowerCase(Locale.ENGLISH);
      String value=tag.getValue().toLowerCase(Locale.ENGLISH);
      if ("String_Node_Str".equals(key)) {
        if (("String_Node_Str").equals(value) || ("String_Node_Str").equals(value) || ("String_Node_Str").equals(value)) {
          return true;
        }
        if (("String_Node_Str").equals(value) || ("String_Node_Str").equals(value) || ("String_Node_Str").equals(value)) {
          return false;
        }
      }
      if ("String_Node_Str".equals(key) || "String_Node_Str".equals(key)) {
        result=false;
      }
      if ("String_Node_Str".equals(key)) {
        if ("String_Node_Str".equals(value) || "String_Node_Str".equals(value) || "String_Node_Str".equals(value)|| "String_Node_Str".equals(value)|| "String_Node_Str".equals(value)|| "String_Node_Str".equals(value)|| "String_Node_Str".equals(value)|| "String_Node_Str".equals(value)) {
          return false;
        }
        return true;
      }
    }
  }
  return result;
}
Program: 93317
Project: 93317
Buggy source:
/** 
 * Creates a new TDWay from an osmosis way entity using the given NodeResolver.
 * @param way the way
 * @param resolver the resolver
 * @param preferredLanguage the preferred language or null if no preference
 * @return a new TDWay if it is valid, null otherwise
 */
public static TDWay fromWay(Way way,NodeResolver resolver,String preferredLanguage){
  if (way == null)   return null;
  SpecialTagExtractionResult ster=OSMUtils.extractSpecialFields(way,preferredLanguage);
  short[] knownWayTags=OSMUtils.extractKnownWayTags(way);
  if (way.getWayNodes().size() >= 2) {
    boolean validWay=true;
    TDNode[] waynodes=new TDNode[way.getWayNodes().size()];
    int i=0;
    for (    WayNode waynode : way.getWayNodes()) {
      waynodes[i]=resolver.getNode(waynode.getNodeId());
      if (waynodes[i] == null) {
        validWay=false;
        LOGGER.finer("String_Node_Str" + waynode.getNodeId() + "String_Node_Str"+ way.getId());
      }
      i++;
    }
    if (validWay) {
      byte shape=LINE;
      if (waynodes[0].getId() == waynodes[waynodes.length - 1].getId()) {
        if (waynodes.length >= GeoUtils.MIN_NODES_POLYGON && OSMUtils.isArea(way)) {
          shape=SIMPLE_POLYGON;
        }
 else {
          LOGGER.finer("String_Node_Str" + way.getId());
          return null;
        }
      }
      return new TDWay(way.getId(),ster.getLayer(),ster.getName(),ster.getHousenumber(),ster.getRef(),knownWayTags,shape,waynodes);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Creates a new TDWay from an osmosis way entity using the given NodeResolver.
 * @param way the way
 * @param resolver the resolver
 * @param preferredLanguage the preferred language or null if no preference
 * @return a new TDWay if it is valid, null otherwise
 */
public static TDWay fromWay(Way way,NodeResolver resolver,String preferredLanguage){
  if (way == null)   return null;
  SpecialTagExtractionResult ster=OSMUtils.extractSpecialFields(way,preferredLanguage);
  short[] knownWayTags=OSMUtils.extractKnownWayTags(way);
  if (way.getWayNodes().size() >= 2) {
    boolean validWay=true;
    TDNode[] waynodes=new TDNode[way.getWayNodes().size()];
    int i=0;
    for (    WayNode waynode : way.getWayNodes()) {
      waynodes[i]=resolver.getNode(waynode.getNodeId());
      if (waynodes[i] == null) {
        validWay=false;
        LOGGER.finer("String_Node_Str" + waynode.getNodeId() + "String_Node_Str"+ way.getId());
      }
      i++;
    }
    if (validWay) {
      byte shape=LINE;
      if (waynodes[0].getId() == waynodes[waynodes.length - 1].getId()) {
        if (waynodes.length >= GeoUtils.MIN_NODES_POLYGON) {
          if (OSMUtils.isArea(way)) {
            shape=SIMPLE_POLYGON;
          }
        }
 else {
          LOGGER.finer("String_Node_Str" + way.getId());
          return null;
        }
      }
      return new TDWay(way.getId(),ster.getLayer(),ster.getName(),ster.getHousenumber(),ster.getRef(),knownWayTags,shape,waynodes);
    }
  }
  return null;
}
Program: 93319
Project: 93319
Buggy source:
/** 
 * Intersection of this LineSegment with the Rectangle as another LineSegment. Algorithm is Cohen-Sutherland, see https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm .
 * @param r the rectangle to clip to.
 * @return the LineSegment that falls into the Rectangle, null if there is no intersection.
 */
public LineSegment clipToRectangle(Rectangle r){
  Point a=this.start;
  Point b=this.end;
  int codeStart=code(r,a);
  int codeEnd=code(r,b);
  while (true) {
    if (0 == (codeStart | codeEnd)) {
      return new LineSegment(a,b);
    }
 else     if (0 != (codeStart & codeEnd)) {
      return null;
    }
 else {
      double newX;
      double newY;
      int outsideCode=(0 != codeStart) ? codeStart : codeEnd;
      if (0 != (outsideCode & TOP)) {
        newX=a.x + (b.x - a.x) * (r.top - a.y) / (b.y - a.y);
        newY=r.top;
      }
 else       if (0 != (outsideCode & BOTTOM)) {
        newX=a.x + (b.x - a.x) * (r.bottom - a.y) / (b.y - a.y);
        newY=r.bottom;
      }
 else       if (0 != (outsideCode & RIGHT)) {
        newY=a.y + (b.y - a.y) * (r.right - a.x) / (b.x - a.x);
        newX=r.right;
      }
 else       if (0 != (outsideCode & LEFT)) {
        newY=a.y + (b.y - a.y) * (r.left - a.x) / (b.x - a.x);
        newX=r.left;
      }
 else {
        throw new RuntimeException("String_Node_Str");
      }
      if (outsideCode == codeStart) {
        a=new Point(newX,newY);
        codeStart=code(r,a);
      }
 else {
        b=new Point(newX,newY);
        codeEnd=code(r,b);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Intersection of this LineSegment with the Rectangle as another LineSegment. Algorithm is Cohen-Sutherland, see https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm .
 * @param r the rectangle to clip to.
 * @return the LineSegment that falls into the Rectangle, null if there is no intersection.
 */
public LineSegment clipToRectangle(Rectangle r){
  Point a=this.start;
  Point b=this.end;
  int codeStart=code(r,a);
  int codeEnd=code(r,b);
  while (true) {
    if (0 == (codeStart | codeEnd)) {
      return new LineSegment(a,b);
    }
 else     if (0 != (codeStart & codeEnd)) {
      return null;
    }
 else {
      double newX;
      double newY;
      int outsideCode=(0 != codeStart) ? codeStart : codeEnd;
      if (0 != (outsideCode & TOP)) {
        newX=a.x + (b.x - a.x) * (r.top - a.y) / (b.y - a.y);
        newY=r.top;
      }
 else       if (0 != (outsideCode & BOTTOM)) {
        newX=a.x + (b.x - a.x) * (r.bottom - a.y) / (b.y - a.y);
        newY=r.bottom;
      }
 else       if (0 != (outsideCode & RIGHT)) {
        newY=a.y + (b.y - a.y) * (r.right - a.x) / (b.x - a.x);
        newX=r.right;
      }
 else       if (0 != (outsideCode & LEFT)) {
        newY=a.y + (b.y - a.y) * (r.left - a.x) / (b.x - a.x);
        newX=r.left;
      }
 else {
        throw new IllegalStateException("String_Node_Str");
      }
      if (outsideCode == codeStart) {
        a=new Point(newX,newY);
        codeStart=code(r,a);
      }
 else {
        b=new Point(newX,newY);
        codeEnd=code(r,b);
      }
    }
  }
}