nus-yam/ex-repair huggingface dataset:
Program: 93322
Project: 93322
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);
      }
    }
  }
}
Program: 93325
Project: 93325
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;
        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);
  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;
}
Program: 93327
Project: 93327
Buggy source:
@Override protected void onDestroy(){
  super.onDestroy();
  destroyTileCaches();
  destroyMapViewPositions();
  destroyMapViews();
  this.sharedPreferences.unregisterOnSharedPreferenceChangeListener(this);
  org.mapsforge.map.android.graphics.AndroidResourceBitmap.clearResourceBitmaps();
}

Fixed version (ground truth):
@Override protected void onDestroy(){
  super.onDestroy();
  destroyControls();
  destroyTileCaches();
  destroyMapViewPositions();
  destroyMapViews();
  this.sharedPreferences.unregisterOnSharedPreferenceChangeListener(this);
  org.mapsforge.map.android.graphics.AndroidResourceBitmap.clearResourceBitmaps();
}
Program: 93328
Project: 93328
Buggy source:
@Override protected void createLayers(){
  tileRendererLayer=Utils.createTileRendererLayer(this.tileCaches.get(0),this.mapViewPositions.get(0),getMapFile(),getRenderTheme(),false,true);
  this.layerManagers.get(0).getLayers().add(tileRendererLayer);
  this.changerThread=new ChangerThread();
  this.changerThread.start();
}

Fixed version (ground truth):
@Override protected void createLayers(){
  tileRendererLayer=Utils.createTileRendererLayer(this.tileCaches.get(0),this.mapViewPositions.get(0),getMapFile(),getRenderTheme(),false,true);
  this.layerManagers.get(0).getLayers().add(tileRendererLayer);
}
Program: 93329
Project: 93329
Buggy source:
@Override protected void doWork() throws InterruptedException {
  TileSizeChanger.this.changeTileSize();
  sleep(ROTATION_TIME);
}

Fixed version (ground truth):
@Override protected void doWork() throws InterruptedException {
  sleep(ROTATION_TIME);
  TileSizeChanger.this.changeTileSize();
}
Program: 93330
Project: 93330
Buggy source:
void changeTileSize(){
  Integer[] tileSizes={256,120,0,120};
  if (tileSizes.length > 0) {
    int tileSize=tileSizes[iteration % tileSizes.length];
    this.mapViews.get(0).getModel().displayModel.setFixedTileSize(tileSize);
    iteration+=1;
    destroyTileCaches();
    createTileCaches();
    this.mapViews.get(0).getMapScaleBar().redrawScaleBar();
    layerManagers.get(0).redrawLayers();
  }
}

Fixed version (ground truth):
void changeTileSize(){
  Integer[] tileSizes={256,120,0,120};
  if (tileSizes.length > 0) {
    iteration+=1;
    destroyLayers();
    destroyTileCaches();
    int tileSize=tileSizes[iteration % tileSizes.length];
    this.mapViews.get(0).getModel().displayModel.setFixedTileSize(tileSize);
    createTileCaches();
    createLayers();
    this.mapViews.get(0).getMapScaleBar().redrawScaleBar();
    layerManagers.get(0).redrawLayers();
  }
}
Program: 93331
Project: 93331
Buggy source:
synchronized void onSizeChanged(){
  this.destroy();
  this.mapViewCanvas=new Canvas();
  this.width=this.mapView.getWidth();
  this.height=this.mapView.getHeight();
  this.mapViewBitmap1=Bitmap.createBitmap(this.width,this.height,Bitmap.Config.RGB_565);
  this.mapViewBitmap2=Bitmap.createBitmap(this.width,this.height,Bitmap.Config.RGB_565);
  clear();
  this.mapViewCanvas.setBitmap(this.mapViewBitmap1);
}

Fixed version (ground truth):
synchronized void onSizeChanged(){
  this.width=this.mapView.getWidth();
  this.height=this.mapView.getHeight();
  this.mapViewBitmap1=Bitmap.createBitmap(this.width,this.height,Bitmap.Config.RGB_565);
  this.mapViewBitmap2=Bitmap.createBitmap(this.width,this.height,Bitmap.Config.RGB_565);
  clear();
  this.mapViewCanvas.setBitmap(this.mapViewBitmap1);
}
Program: 93332
Project: 93332
Buggy source:
synchronized void destroy(){
  if (this.mapViewBitmap1 != null) {
    this.mapViewBitmap1.recycle();
  }
  if (this.mapViewBitmap2 != null) {
    this.mapViewBitmap2.recycle();
  }
  this.mapViewCanvas=null;
}

Fixed version (ground truth):
synchronized void destroy(){
  if (this.mapViewBitmap1 != null) {
    this.mapViewBitmap1.recycle();
  }
  if (this.mapViewBitmap2 != null) {
    this.mapViewBitmap2.recycle();
  }
}
Program: 93333
Project: 93333
Buggy source:
void destroy(){
  this.overlayController.interrupt();
  this.mapMover.interrupt();
  this.mapWorker.interrupt();
  this.zoomAnimator.interrupt();
  try {
    this.mapWorker.join();
  }
 catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
  }
  this.frameBuffer.destroy();
  this.mapScaleBar.destroy();
  this.inMemoryTileCache.destroy();
  this.fileSystemTileCache.destroy();
  this.databaseRenderer.destroy();
  this.mapDatabase.closeFile();
}

Fixed version (ground truth):
void destroy(){
  this.overlayController.interrupt();
  this.mapMover.interrupt();
  this.mapWorker.interrupt();
  this.zoomAnimator.interrupt();
  try {
    this.mapWorker.join();
  }
 catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
  }
  this.frameBuffer.destroy();
  this.mapScaleBar.destroy();
  this.inMemoryTileCache.destroy();
  this.fileSystemTileCache.destroy();
  this.mapDatabase.closeFile();
}
Program: 93335
Project: 93335
Buggy source:
private boolean checkSize(){
  this.sizeChange.writeLock().lock();
  try {
    if (this.changeSizeNeeded) {
      return changeSize();
    }
    return true;
  }
  finally {
    this.sizeChange.writeLock().unlock();
  }
}

Fixed version (ground truth):
private boolean checkSize(){
  if (this.changeSizeNeeded) {
    return changeSize();
  }
  return true;
}
Program: 93336
Project: 93336
Buggy source:
private void recycleBitmaps(){
  if (this.bitmap1 != null) {
    this.bitmap1.recycle();
    this.bitmap1=null;
  }
  if (this.bitmap2 != null) {
    this.bitmap2.recycle();
    this.bitmap2=null;
  }
  this.overlayCanvas=null;
}

Fixed version (ground truth):
private void recycleBitmaps(){
  recycleBitmap(this.bitmap1);
  recycleBitmap(this.bitmap2);
}
Program: 93337
Project: 93337
Buggy source:
@Override protected void afterRun(){
  this.recycleBitmaps();
}

Fixed version (ground truth):
@Override protected void afterRun(){
  recycleBitmaps();
}
Program: 93338
Project: 93338
Buggy source:
private void redraw(){
  if (this.overlayCanvas == null) {
    this.overlayCanvas=new Canvas();
  }
  this.bitmap2.eraseColor(Color.TRANSPARENT);
  this.overlayCanvas.setBitmap(this.bitmap2);
  MapPosition mapPositionBefore=this.mapView.getMapViewPosition().getMapPosition();
  BoundingBox boundingBox=this.mapView.getMapViewPosition().getBoundingBox();
  List<Overlay> overlays=this.mapView.getOverlays();
synchronized (overlays) {
    for (    Overlay overlay : overlays) {
      overlay.draw(boundingBox,mapPositionBefore.zoomLevel,this.overlayCanvas);
    }
  }
  MapPosition mapPositionAfter=this.mapView.getMapViewPosition().getMapPosition();
synchronized (this.matrix) {
    adjustMatrix(mapPositionBefore,mapPositionAfter);
    swapBitmaps();
  }
  this.mapView.postInvalidate();
}

Fixed version (ground truth):
private void redraw(){
  this.bitmap2.eraseColor(Color.TRANSPARENT);
  this.overlayCanvas.setBitmap(this.bitmap2);
  MapPosition mapPositionBefore=this.mapView.getMapViewPosition().getMapPosition();
  BoundingBox boundingBox=this.mapView.getMapViewPosition().getBoundingBox();
  List<Overlay> overlays=this.mapView.getOverlays();
synchronized (overlays) {
    for (    Overlay overlay : overlays) {
      overlay.draw(boundingBox,mapPositionBefore.zoomLevel,this.overlayCanvas);
    }
  }
  MapPosition mapPositionAfter=this.mapView.getMapViewPosition().getMapPosition();
synchronized (this.matrix) {
    adjustMatrix(mapPositionBefore,mapPositionAfter);
    swapBitmaps();
  }
  this.mapView.postInvalidate();
}
Program: 93339
Project: 93339
Buggy source:
public OverlayController(MapView mapView){
  super();
  this.mapView=mapView;
  this.matrix=new Matrix();
  this.changeSizeNeeded=true;
}

Fixed version (ground truth):
public OverlayController(MapView mapView){
  super();
  this.mapView=mapView;
  this.matrix=new Matrix();
  this.overlayCanvas=new Canvas();
  this.changeSizeNeeded=true;
}
Program: 93340
Project: 93340
Buggy source:
private boolean changeSize(){
  int newWidth=this.mapView.getWidth();
  int newHeight=this.mapView.getHeight();
  if (newWidth > 0 && newHeight > 0) {
    if (this.width == newWidth && this.height == newHeight) {
      this.changeSizeNeeded=false;
      this.redrawNeeded=false;
      return false;
    }
    recycleBitmaps();
    this.width=newWidth;
    this.height=newHeight;
    this.bitmap1=Bitmap.createBitmap(newWidth,newHeight,Bitmap.Config.ARGB_8888);
    this.bitmap2=Bitmap.createBitmap(newWidth,newHeight,Bitmap.Config.ARGB_8888);
    this.changeSizeNeeded=false;
    this.redrawNeeded=true;
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean changeSize(){
  recycleBitmaps();
  int width=this.mapView.getWidth();
  int height=this.mapView.getHeight();
  if (width > 0 && height > 0) {
    this.bitmap1=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
    this.bitmap2=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
    this.changeSizeNeeded=false;
    this.redrawNeeded=true;
    return true;
  }
  return false;
}
Program: 93341
Project: 93341
Buggy source:
private void checkRedraw(){
  this.sizeChange.readLock().lock();
  try {
    if (this.redrawNeeded) {
      this.redrawNeeded=false;
      redraw();
    }
  }
  finally {
    this.sizeChange.readLock().unlock();
  }
}

Fixed version (ground truth):
private void checkRedraw(){
  if (this.redrawNeeded) {
    this.redrawNeeded=false;
    redraw();
  }
}
Program: 93342
Project: 93342
Buggy source:
@Override public void setBitmapShader(org.mapsforge.map.graphics.Bitmap bitmap){
  if (bitmap == null) {
    return;
  }
  this.bitmap=bitmap;
  android.graphics.Bitmap androidBitmap=android.graphics.Bitmap.createBitmap(bitmap.getPixels(),bitmap.getWidth(),bitmap.getHeight(),Config.ARGB_8888);
  Shader shader=new BitmapShader(androidBitmap,TileMode.REPEAT,TileMode.REPEAT);
  this.paint.setShader(shader);
}

Fixed version (ground truth):
@Override public void setBitmapShader(org.mapsforge.map.graphics.Bitmap bitmap){
  if (bitmap == null) {
    return;
  }
  android.graphics.Bitmap androidBitmap=android.graphics.Bitmap.createBitmap(bitmap.getPixels(),bitmap.getWidth(),bitmap.getHeight(),Config.ARGB_8888);
  Shader shader=new BitmapShader(androidBitmap,TileMode.REPEAT,TileMode.REPEAT);
  this.paint.setShader(shader);
}
Program: 93343
Project: 93343
Buggy source:
@Override public void destroy(){
  this.fill.destroy();
  this.stroke.destroy();
}

Fixed version (ground truth):
@Override public void destroy(){
}
Program: 93344
Project: 93344
Buggy source:
@Override public void destroy(){
  this.stroke.destroy();
}

Fixed version (ground truth):
@Override public void destroy(){
}
Program: 93345
Project: 93345
Buggy source:
/** 
 * @param solo
 * @return true if the current activity uses fragments in one screen
 */
static public boolean usesFragments(Solo solo){
  if (solo.getCurrentActivity().findViewById(R.id.item_detail_container) != null) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @param solo
 * @return true if the current activity uses fragments in one screen
 */
public static boolean usesFragments(Solo solo){
  if (solo.getCurrentActivity().findViewById(R.id.item_detail_container) != null) {
    return true;
  }
  return false;
}
Program: 93346
Project: 93346
Buggy source:
public static void testZoomChanges(Solo solo,int iterations) throws Exception {
  MapView mapView=(MapView)solo.getView(R.id.mapView);
  MapViewPosition mapViewPosition=mapView.getModel().mapViewPosition;
  for (int i=0; i < iterations; i++) {
    byte startZoomLevel=mapViewPosition.getZoomLevel();
    mapViewPosition.zoom((byte)-1);
    solo.sleep(delay);
    mapViewPosition.zoom((byte)-6);
    solo.sleep(delay);
    mapViewPosition.zoom((byte)1);
    solo.sleep(delay);
    mapViewPosition.zoom((byte)1);
    solo.sleep(delay);
    mapViewPosition.zoom((byte)-2);
    solo.sleep(delay);
    solo.setActivityOrientation(Solo.LANDSCAPE);
    mapViewPosition.zoom((byte)2);
    solo.sleep(delay);
    mapViewPosition.zoom((byte)-3);
    solo.sleep(delay);
    mapViewPosition.zoom((byte)3);
    solo.drag(210,430,170,220,2);
    solo.sleep(delay);
    solo.drag(212,44,170,220,2);
    solo.sleep(delay);
    solo.drag(237,49,170,220,22);
    solo.sleep(delay);
    solo.drag(10,40,170,220,2);
    solo.sleep(delay);
    solo.drag(22,14,170,220,17);
    solo.sleep(delay);
    solo.drag(27,49,170,220,22);
    solo.sleep(delay);
    solo.drag(20,120,170,220,2);
    solo.sleep(delay);
    mapViewPosition.zoom((byte)-1);
    solo.setActivityOrientation(Solo.PORTRAIT);
    solo.sleep(delay);
    mapViewPosition.zoom((byte)6);
    solo.sleep(delay);
    mapViewPosition.zoom((byte)1);
    solo.sleep(delay);
    mapViewPosition.zoom((byte)-1);
    solo.sleep(delay);
    assert(mapViewPosition.getZoomLevel() == startZoomLevel);
    solo.assertMemoryNotLow();
  }
}

Fixed version (ground truth):
public static void testZoomChanges(Solo solo,int iterations) throws Exception {
}
Program: 93347
Project: 93347
Buggy source:
protected final android.graphics.Bitmap getBitmapFromReusableSet(int width,int height,Config config){
  android.graphics.Bitmap bitmap=null;
  if (reusableBitmaps != null && !reusableBitmaps.isEmpty()) {
synchronized (reusableBitmaps) {
      final Iterator<SoftReference<android.graphics.Bitmap>> iterator=reusableBitmaps.iterator();
      android.graphics.Bitmap candidate;
      while (iterator.hasNext()) {
        candidate=iterator.next().get();
        if (null != candidate && candidate.isMutable()) {
          if (canUseBitmap(candidate,width,height,config)) {
            bitmap=candidate;
            iterator.remove();
            break;
          }
        }
 else {
          iterator.remove();
        }
      }
    }
  }
  return bitmap;
}

Fixed version (ground truth):
protected final android.graphics.Bitmap getBitmapFromReusableSet(int width,int height,Config config){
  android.graphics.Bitmap result=null;
  if (reusableBitmaps != null && !reusableBitmaps.isEmpty()) {
synchronized (reusableBitmaps) {
      final Iterator<SoftReference<android.graphics.Bitmap>> iterator=reusableBitmaps.iterator();
      android.graphics.Bitmap candidate;
      while (iterator.hasNext()) {
        candidate=iterator.next().get();
        if (null != candidate && candidate.isMutable()) {
          if (canUseBitmap(candidate,width,height,config)) {
            result=candidate;
            iterator.remove();
            break;
          }
        }
 else {
          iterator.remove();
        }
      }
    }
  }
  return result;
}
Program: 93348
Project: 93348
Buggy source:
/** 
 * return the byte usage per pixel of a bitmap based on its configuration.
 */
static public int getBytesPerPixel(Config config){
  if (config == Config.ARGB_8888) {
    return 4;
  }
 else   if (config == Config.RGB_565) {
    return 2;
  }
 else   if (config == Config.ARGB_4444) {
    return 2;
  }
 else   if (config == Config.ALPHA_8) {
    return 1;
  }
  return 1;
}

Fixed version (ground truth):
/** 
 * return the byte usage per pixel of a bitmap based on its configuration.
 */
public static int getBytesPerPixel(Config config){
  if (config == Config.ARGB_8888) {
    return 4;
  }
 else   if (config == Config.RGB_565) {
    return 2;
  }
 else   if (config == Config.ARGB_4444) {
    return 2;
  }
 else   if (config == Config.ALPHA_8) {
    return 1;
  }
  return 1;
}
Program: 93349
Project: 93349
Buggy source:
private void setTileSize(){
  if (this.fixedTileSize == 0) {
    float temp=(DEFAULT_TILE_SIZE * deviceScaleFactor * userScaleFactor);
    this.tileSize=Math.max(tileSizeMultiple,(int)(Math.round(temp / this.tileSizeMultiple) * this.tileSizeMultiple));
  }
 else {
    this.tileSize=this.fixedTileSize;
  }
  this.setMaxTextWidth();
}

Fixed version (ground truth):
private void setTileSize(){
  if (this.fixedTileSize == 0) {
    float temp=DEFAULT_TILE_SIZE * deviceScaleFactor * userScaleFactor;
    this.tileSize=Math.max(tileSizeMultiple,(int)(Math.round(temp / this.tileSizeMultiple) * this.tileSizeMultiple));
  }
 else {
    this.tileSize=this.fixedTileSize;
  }
  this.setMaxTextWidth();
}
Program: 93350
Project: 93350
Buggy source:
protected ResourceScaling fromValue(String value){
  if (value.equals(SIZE))   return ResourceScaling.SIZE;
  if (value.equals(TILE))   return ResourceScaling.TILE;
  return ResourceScaling.DEFAULT;
}

Fixed version (ground truth):
protected ResourceScaling fromValue(String value){
  if (value.equals(SIZE)) {
    return ResourceScaling.SIZE;
  }
  if (value.equals(TILE)) {
    return ResourceScaling.TILE;
  }
  return ResourceScaling.DEFAULT;
}
Program: 93351
Project: 93351
Buggy source:
@Override public void endElement(String uri,String localName,String qName){
  this.elementStack.pop();
  if (ELEMENT_NAME_RULE.equals(qName)) {
    this.ruleStack.pop();
    if (this.ruleStack.empty()) {
      if (isVisible((this.currentRule))) {
        this.renderTheme.addRule(this.currentRule);
      }
    }
 else {
      this.currentRule=this.ruleStack.peek();
    }
  }
 else   if ("String_Node_Str".equals(qName)) {
    if (null != this.xmlRenderTheme.getMenuCallback()) {
      this.categories=this.xmlRenderTheme.getMenuCallback().getCategories(this.renderThemeStyleMenu);
    }
    return;
  }
}

Fixed version (ground truth):
@Override public void endElement(String uri,String localName,String qName){
  this.elementStack.pop();
  if (ELEMENT_NAME_RULE.equals(qName)) {
    this.ruleStack.pop();
    if (this.ruleStack.empty()) {
      if (isVisible(this.currentRule)) {
        this.renderTheme.addRule(this.currentRule);
      }
    }
 else {
      this.currentRule=this.ruleStack.peek();
    }
  }
 else   if ("String_Node_Str".equals(qName)) {
    if (null != this.xmlRenderTheme.getMenuCallback()) {
      this.categories=this.xmlRenderTheme.getMenuCallback().getCategories(this.renderThemeStyleMenu);
    }
    return;
  }
}
Program: 93352
Project: 93352
Buggy source:
@Override public synchronized void destroy(){
  if (this.bitmapGet != null) {
    this.bitmapGet.recycle();
  }
  if (this.capacity == 0) {
    return;
  }
  if (!this.persistent || !serializeMap(this.cacheDirectory,this.map)) {
    for (    File file : this.map.values()) {
      if (!file.delete()) {
        file.deleteOnExit();
      }
    }
    this.map.clear();
    if (this.cacheDirectory != null) {
      File[] filesToDelete=this.cacheDirectory.listFiles(ImageFileNameFilter.INSTANCE);
      if (filesToDelete != null) {
        for (        File file : filesToDelete) {
          if (!file.delete()) {
            file.deleteOnExit();
          }
        }
      }
      if (!this.cacheDirectory.delete()) {
        this.cacheDirectory.deleteOnExit();
      }
    }
  }
}

Fixed version (ground truth):
@Override public synchronized void destroy(){
  if (!this.persistent || !serializeMap(this.cacheDirectory,this.map)) {
    for (    File file : this.map.values()) {
      if (!file.delete()) {
        file.deleteOnExit();
      }
    }
    this.map.clear();
    File[] filesToDelete=this.cacheDirectory.listFiles(ImageFileNameFilter.INSTANCE);
    if (filesToDelete != null) {
      for (      File file : filesToDelete) {
        if (!file.delete()) {
          file.deleteOnExit();
        }
      }
    }
    if (!this.cacheDirectory.delete()) {
      this.cacheDirectory.deleteOnExit();
    }
  }
}
Program: 93353
Project: 93353
Buggy source:
@Override public synchronized void put(MapGeneratorJob mapGeneratorJob,Bitmap bitmap){
  if (this.capacity == 0) {
    return;
  }
  FileOutputStream fileOutputStream=null;
  try {
    File outputFile;
    do {
      ++this.cacheId;
      outputFile=new File(this.cacheDirectory,this.cacheId + IMAGE_FILE_NAME_EXTENSION);
    }
 while (outputFile.exists());
    this.byteBuffer.rewind();
    bitmap.copyPixelsToBuffer(this.byteBuffer);
    byte[] array=this.byteBuffer.array();
    fileOutputStream=new FileOutputStream(outputFile);
    fileOutputStream.write(array,0,array.length);
    this.map.put(mapGeneratorJob,outputFile);
  }
 catch (  IOException e) {
    LOGGER.log(Level.SEVERE,"String_Node_Str",e);
    this.capacity=0;
  }
 finally {
    try {
      if (fileOutputStream != null) {
        fileOutputStream.close();
      }
    }
 catch (    IOException e) {
      LOGGER.log(Level.SEVERE,null,e);
    }
  }
}

Fixed version (ground truth):
@Override public synchronized void put(MapGeneratorJob mapGeneratorJob,Bitmap bitmap){
  if (this.capacity == 0) {
    return;
  }
  FileOutputStream fileOutputStream=null;
  try {
    File outputFile;
    do {
      ++this.cacheId;
      outputFile=new File(this.cacheDirectory,this.cacheId + IMAGE_FILE_NAME_EXTENSION);
    }
 while (outputFile.exists());
    this.byteBuffer.rewind();
    bitmap.copyPixelsToBuffer(this.byteBuffer);
    byte[] array=this.byteBuffer.array();
    fileOutputStream=new FileOutputStream(outputFile);
    fileOutputStream.write(array,0,array.length);
    this.map.put(mapGeneratorJob,outputFile);
  }
 catch (  IOException e) {
    LOGGER.log(Level.SEVERE,null,e);
  }
 finally {
    try {
      if (fileOutputStream != null) {
        fileOutputStream.close();
      }
    }
 catch (    IOException e) {
      LOGGER.log(Level.SEVERE,null,e);
    }
  }
}
Program: 93354
Project: 93354
Buggy source:
/** 
 * @param capacity the maximum number of entries in this cache.
 * @param mapViewId the ID of the MapView to separate caches for different MapViews.
 * @throws IllegalArgumentException if the capacity is negative.
 */
public FileSystemTileCache(int capacity,int mapViewId){
  this.mapViewId=mapViewId;
  this.capacity=checkCapacity(capacity);
  if (this.capacity > 0 && this.cacheDirectory != null) {
    Map<MapGeneratorJob,File> deserializedMap=deserializeMap(this.cacheDirectory);
    if (deserializedMap == null) {
      this.map=createMap(this.capacity);
    }
 else {
      this.map=deserializedMap;
    }
    this.byteBuffer=ByteBuffer.allocate(TILE_SIZE_IN_BYTES);
    this.bitmapGet=Bitmap.createBitmap(Tile.TILE_SIZE,Tile.TILE_SIZE,Config.RGB_565);
  }
 else {
    this.byteBuffer=null;
    this.bitmapGet=null;
    this.map=createMap(0);
  }
}

Fixed version (ground truth):
/** 
 * @param capacity the maximum number of entries in this cache.
 * @param mapViewId the ID of the MapView to separate caches for different MapViews.
 * @throws IllegalArgumentException if the capacity is negative.
 */
public FileSystemTileCache(int capacity,int mapViewId){
  this.capacity=getCapacity(capacity);
  String externalStorageDirectory=Environment.getExternalStorageDirectory().getAbsolutePath();
  String cacheDirectoryPath=externalStorageDirectory + CACHE_DIRECTORY + mapViewId;
  this.cacheDirectory=createDirectory(cacheDirectoryPath);
  Map<MapGeneratorJob,File> deserializedMap=deserializeMap(this.cacheDirectory);
  if (deserializedMap == null) {
    this.map=createMap(this.capacity);
  }
 else {
    this.map=deserializedMap;
  }
  this.byteBuffer=ByteBuffer.allocate(TILE_SIZE_IN_BYTES);
  this.bitmapGet=Bitmap.createBitmap(Tile.TILE_SIZE,Tile.TILE_SIZE,Config.RGB_565);
}
Program: 93355
Project: 93355
Buggy source:
@Override public synchronized void setCapacity(int capacity){
  if (this.capacity == capacity) {
    return;
  }
  this.capacity=checkCapacity(capacity);
  if (this.capacity != 0) {
    Map<MapGeneratorJob,File> newMap=createMap(this.capacity);
    if (this.map != null) {
      newMap.putAll(this.map);
    }
    this.map=newMap;
  }
}

Fixed version (ground truth):
@Override public synchronized void setCapacity(int capacity){
  if (this.capacity == capacity) {
    return;
  }
  this.capacity=getCapacity(capacity);
  Map<MapGeneratorJob,File> newMap=createMap(this.capacity);
  newMap.putAll(this.map);
  this.map=newMap;
}
Program: 93357
Project: 93357
Buggy source:
/** 
 * Gets the center point of the dimension.
 * @return the center point
 */
public Point getCenter(){
  return new Point(this.width / 2,this.height / 2);
}

Fixed version (ground truth):
/** 
 * Gets the center point of the dimension.
 * @return the center point
 */
public Point getCenter(){
  return new Point((float)this.width / 2,(float)this.height / 2);
}
Program: 93358
Project: 93358
Buggy source:
/** 
 * Calculates the zoom level that allows to display the   {@link BoundingBox} on aview with the  {@link Dimension} and tile size.
 * @param dimension the {@link Dimension} of the view
 * @param boundingBox the {@link BoundingBox} to display
 * @param tileSize the size of the tiles
 * @return the zoom level that allows to display the {@link BoundingBox} on aview with the  {@link Dimension} and tile size
 */
public static byte zoomForBounds(Dimension dimension,BoundingBox boundingBox,int tileSize){
  double dxMax=MercatorProjection.longitudeToPixelX(boundingBox.maxLongitude,(byte)0,tileSize) / tileSize;
  double dxMin=MercatorProjection.longitudeToPixelX(boundingBox.minLongitude,(byte)0,tileSize) / tileSize;
  double zoomX=Math.floor(-Math.log(3.8) * Math.log(Math.abs(dxMax - dxMin)) + dimension.width / tileSize);
  double dyMax=MercatorProjection.latitudeToPixelY(boundingBox.maxLatitude,(byte)0,tileSize) / tileSize;
  double dyMin=MercatorProjection.latitudeToPixelY(boundingBox.minLatitude,(byte)0,tileSize) / tileSize;
  double zoomY=Math.floor(-Math.log(3.8) * Math.log(Math.abs(dyMax - dyMin)) + dimension.height / tileSize);
  return (byte)Double.valueOf(Math.min(zoomX,zoomY)).intValue();
}

Fixed version (ground truth):
/** 
 * Calculates the zoom level that allows to display the   {@link BoundingBox} on aview with the  {@link Dimension} and tile size.
 * @param dimension the {@link Dimension} of the view
 * @param boundingBox the {@link BoundingBox} to display
 * @param tileSize the size of the tiles
 * @return the zoom level that allows to display the {@link BoundingBox} on aview with the  {@link Dimension} and tile size
 */
public static byte zoomForBounds(Dimension dimension,BoundingBox boundingBox,int tileSize){
  double dxMax=MercatorProjection.longitudeToPixelX(boundingBox.maxLongitude,(byte)0,tileSize) / tileSize;
  double dxMin=MercatorProjection.longitudeToPixelX(boundingBox.minLongitude,(byte)0,tileSize) / tileSize;
  double zoomX=Math.floor(-Math.log(3.8) * Math.log(Math.abs(dxMax - dxMin)) + (float)dimension.width / tileSize);
  double dyMax=MercatorProjection.latitudeToPixelY(boundingBox.maxLatitude,(byte)0,tileSize) / tileSize;
  double dyMin=MercatorProjection.latitudeToPixelY(boundingBox.minLatitude,(byte)0,tileSize) / tileSize;
  double zoomY=Math.floor(-Math.log(3.8) * Math.log(Math.abs(dyMax - dyMin)) + (float)dimension.height / tileSize);
  return (byte)Math.min(zoomX,zoomY);
}
Program: 93359
Project: 93359
Buggy source:
/** 
 * Get LatLong form Pixels.
 * @Author Stephan Brandt <stephan@contagt.com>
 */
public static LatLong fromPixels(double pixelX,double pixelY,byte zoomLevel,int tileSize){
  return new LatLong(pixelYToLatitude(pixelY,zoomLevel,tileSize),pixelXToLongitude(pixelX,zoomLevel,tileSize));
}

Fixed version (ground truth):
/** 
 * Get LatLong form Pixels.
 * @author Stephan Brandt <stephan@contagt.com>
 */
public static LatLong fromPixels(double pixelX,double pixelY,byte zoomLevel,int tileSize){
  return new LatLong(pixelYToLatitude(pixelY,zoomLevel,tileSize),pixelXToLongitude(pixelX,zoomLevel,tileSize));
}
Program: 93360
Project: 93360
Buggy source:
@Test public void latitudeToPixelYTest(){
  for (  int tileSize : TILE_SIZES) {
    for (byte zoomLevel=ZOOM_LEVEL_MIN; zoomLevel <= ZOOM_LEVEL_MAX; ++zoomLevel) {
      double pixelY=MercatorProjection.latitudeToPixelY(MercatorProjection.LATITUDE_MAX,zoomLevel,tileSize);
      Assert.assertEquals(0,pixelY,0);
      long mapSize=MercatorProjection.getMapSize(zoomLevel,tileSize);
      pixelY=MercatorProjection.latitudeToPixelY(0,zoomLevel,tileSize);
      Assert.assertEquals(mapSize / 2,pixelY,0);
      pixelY=MercatorProjection.latitudeToPixelY(MercatorProjection.LATITUDE_MIN,zoomLevel,tileSize);
      Assert.assertEquals(mapSize,pixelY,0);
    }
  }
}

Fixed version (ground truth):
@Test public void latitudeToPixelYTest(){
  for (  int tileSize : TILE_SIZES) {
    for (byte zoomLevel=ZOOM_LEVEL_MIN; zoomLevel <= ZOOM_LEVEL_MAX; ++zoomLevel) {
      double pixelY=MercatorProjection.latitudeToPixelY(MercatorProjection.LATITUDE_MAX,zoomLevel,tileSize);
      Assert.assertEquals(0,pixelY,0);
      long mapSize=MercatorProjection.getMapSize(zoomLevel,tileSize);
      pixelY=MercatorProjection.latitudeToPixelY(0,zoomLevel,tileSize);
      Assert.assertEquals((float)mapSize / 2,pixelY,0);
      pixelY=MercatorProjection.latitudeToPixelY(MercatorProjection.LATITUDE_MIN,zoomLevel,tileSize);
      Assert.assertEquals(mapSize,pixelY,0);
    }
  }
}
Program: 93361
Project: 93361
Buggy source:
@Test public void pixelXToLongitudeTest(){
  for (  int tileSize : TILE_SIZES) {
    for (byte zoomLevel=ZOOM_LEVEL_MIN; zoomLevel <= ZOOM_LEVEL_MAX; ++zoomLevel) {
      double longitude=MercatorProjection.pixelXToLongitude(0,zoomLevel,tileSize);
      Assert.assertEquals(LatLongUtils.LONGITUDE_MIN,longitude,0);
      long mapSize=MercatorProjection.getMapSize(zoomLevel,tileSize);
      longitude=MercatorProjection.pixelXToLongitude(mapSize / 2,zoomLevel,tileSize);
      Assert.assertEquals(0,longitude,0);
      longitude=MercatorProjection.pixelXToLongitude(mapSize,zoomLevel,tileSize);
      Assert.assertEquals(LatLongUtils.LONGITUDE_MAX,longitude,0);
    }
    verifyInvalidPixelXToLongitude(-1,(byte)0,tileSize);
    verifyInvalidPixelXToLongitude(tileSize + 1,(byte)0,tileSize);
  }
}

Fixed version (ground truth):
@Test public void pixelXToLongitudeTest(){
  for (  int tileSize : TILE_SIZES) {
    for (byte zoomLevel=ZOOM_LEVEL_MIN; zoomLevel <= ZOOM_LEVEL_MAX; ++zoomLevel) {
      double longitude=MercatorProjection.pixelXToLongitude(0,zoomLevel,tileSize);
      Assert.assertEquals(LatLongUtils.LONGITUDE_MIN,longitude,0);
      long mapSize=MercatorProjection.getMapSize(zoomLevel,tileSize);
      longitude=MercatorProjection.pixelXToLongitude((float)mapSize / 2,zoomLevel,tileSize);
      Assert.assertEquals(0,longitude,0);
      longitude=MercatorProjection.pixelXToLongitude(mapSize,zoomLevel,tileSize);
      Assert.assertEquals(LatLongUtils.LONGITUDE_MAX,longitude,0);
    }
    verifyInvalidPixelXToLongitude(-1,(byte)0,tileSize);
    verifyInvalidPixelXToLongitude(tileSize + 1,(byte)0,tileSize);
  }
}
Program: 93362
Project: 93362
Buggy source:
@Test public void longitudeToPixelXTest(){
  for (  int tileSize : TILE_SIZES) {
    for (byte zoomLevel=ZOOM_LEVEL_MIN; zoomLevel <= ZOOM_LEVEL_MAX; ++zoomLevel) {
      double pixelX=MercatorProjection.longitudeToPixelX(LatLongUtils.LONGITUDE_MIN,zoomLevel,tileSize);
      Assert.assertEquals(0,pixelX,0);
      long mapSize=MercatorProjection.getMapSize(zoomLevel,tileSize);
      pixelX=MercatorProjection.longitudeToPixelX(0,zoomLevel,tileSize);
      Assert.assertEquals(mapSize / 2,pixelX,0);
      pixelX=MercatorProjection.longitudeToPixelX(LatLongUtils.LONGITUDE_MAX,zoomLevel,tileSize);
      Assert.assertEquals(mapSize,pixelX,0);
    }
  }
}

Fixed version (ground truth):
@Test public void longitudeToPixelXTest(){
  for (  int tileSize : TILE_SIZES) {
    for (byte zoomLevel=ZOOM_LEVEL_MIN; zoomLevel <= ZOOM_LEVEL_MAX; ++zoomLevel) {
      double pixelX=MercatorProjection.longitudeToPixelX(LatLongUtils.LONGITUDE_MIN,zoomLevel,tileSize);
      Assert.assertEquals(0,pixelX,0);
      long mapSize=MercatorProjection.getMapSize(zoomLevel,tileSize);
      pixelX=MercatorProjection.longitudeToPixelX(0,zoomLevel,tileSize);
      Assert.assertEquals((float)mapSize / 2,pixelX,0);
      pixelX=MercatorProjection.longitudeToPixelX(LatLongUtils.LONGITUDE_MAX,zoomLevel,tileSize);
      Assert.assertEquals(mapSize,pixelX,0);
    }
  }
}
Program: 93363
Project: 93363
Buggy source:
@Test public void pixelYToLatitudeTest(){
  for (  int tileSize : TILE_SIZES) {
    for (byte zoomLevel=ZOOM_LEVEL_MIN; zoomLevel <= ZOOM_LEVEL_MAX; ++zoomLevel) {
      double latitude=MercatorProjection.pixelYToLatitude(0,zoomLevel,tileSize);
      Assert.assertEquals(MercatorProjection.LATITUDE_MAX,latitude,0);
      long mapSize=MercatorProjection.getMapSize(zoomLevel,tileSize);
      latitude=MercatorProjection.pixelYToLatitude(mapSize / 2,zoomLevel,tileSize);
      Assert.assertEquals(0,latitude,0);
      latitude=MercatorProjection.pixelYToLatitude(mapSize,zoomLevel,tileSize);
      Assert.assertEquals(MercatorProjection.LATITUDE_MIN,latitude,0);
    }
    verifyInvalidPixelYToLatitude(-1,(byte)0,tileSize);
    verifyInvalidPixelYToLatitude(tileSize + 1,(byte)0,tileSize);
  }
}

Fixed version (ground truth):
@Test public void pixelYToLatitudeTest(){
  for (  int tileSize : TILE_SIZES) {
    for (byte zoomLevel=ZOOM_LEVEL_MIN; zoomLevel <= ZOOM_LEVEL_MAX; ++zoomLevel) {
      double latitude=MercatorProjection.pixelYToLatitude(0,zoomLevel,tileSize);
      Assert.assertEquals(MercatorProjection.LATITUDE_MAX,latitude,0);
      long mapSize=MercatorProjection.getMapSize(zoomLevel,tileSize);
      latitude=MercatorProjection.pixelYToLatitude((float)mapSize / 2,zoomLevel,tileSize);
      Assert.assertEquals(0,latitude,0);
      latitude=MercatorProjection.pixelYToLatitude(mapSize,zoomLevel,tileSize);
      Assert.assertEquals(MercatorProjection.LATITUDE_MIN,latitude,0);
    }
    verifyInvalidPixelYToLatitude(-1,(byte)0,tileSize);
    verifyInvalidPixelYToLatitude(tileSize + 1,(byte)0,tileSize);
  }
}
Program: 93364
Project: 93364
Buggy source:
@Override public void setBitmapShader(org.mapsforge.core.graphics.Bitmap bitmap){
  if (bitmap == null) {
    return;
  }
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
  }
  this.paint.setColor(AndroidGraphicFactory.getColor(Color.WHITE));
  this.paint.setShader(new BitmapShader(AndroidGraphicFactory.getBitmap(bitmap),TileMode.REPEAT,TileMode.REPEAT));
}

Fixed version (ground truth):
@Override public void setBitmapShader(org.mapsforge.core.graphics.Bitmap bitmap){
  if (bitmap == null) {
    return;
  }
  if (!AndroidGraphicFactory.keepResourceBitmaps && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    bitmap.incrementRefCount();
  }
  this.paint.setColor(AndroidGraphicFactory.getColor(Color.WHITE));
  this.paint.setShader(new BitmapShader(AndroidGraphicFactory.getBitmap(bitmap),TileMode.REPEAT,TileMode.REPEAT));
}
Program: 93365
Project: 93365
Buggy source:
/** 
 * Sets the maximum zoom level of the map. <p> The maximum possible zoom level of the MapView depends also on the current   {@link DatabaseRenderer}. For example, downloading map tiles may only be possible up to a certain zoom level. Setting a higher maximum zoom level has no effect in this case.
 * @param zoomLevelMax the maximum zoom level.
 * @throws IllegalArgumentException if the maximum zoom level is smaller than the current minimum zoom level.
 */
public void setZoomLevelMax(byte zoomLevelMax){
  if (zoomLevelMax < this.zoomLevelMin) {
    throw new IllegalArgumentException();
  }
  this.zoomLevelMax=zoomLevelMax;
}

Fixed version (ground truth):
/** 
 * Sets the maximum zoom level of the map. <p> The maximum possible zoom level of the MapView depends also on other elements. For example, downloading map tiles may only be possible up to a certain zoom level. Setting a higher maximum zoom level has no effect in this case.
 * @param zoomLevelMax the maximum zoom level.
 * @throws IllegalArgumentException if the maximum zoom level is smaller than the current minimum zoom level.
 */
public void setZoomLevelMax(byte zoomLevelMax){
  if (zoomLevelMax < this.zoomLevelMin) {
    throw new IllegalArgumentException();
  }
  this.zoomLevelMax=zoomLevelMax;
}
Program: 93367
Project: 93367
Buggy source:
private static Dimension calculateFrameBufferDimension(Dimension mapViewDimension,double overdrawFactor){
  int width=(int)(mapViewDimension.width * overdrawFactor);
  int height=(int)(mapViewDimension.height * overdrawFactor);
  if (useSquareFrameBuffer) {
    float aspectRatio=mapViewDimension.width / mapViewDimension.height;
    if (aspectRatio < maxAspectRatio && aspectRatio > maxAspectRatio / 1) {
      width=Math.max(width,height);
      height=width;
    }
  }
  return new Dimension(width,height);
}

Fixed version (ground truth):
private static Dimension calculateFrameBufferDimension(Dimension mapViewDimension,double overdrawFactor){
  int width=(int)(mapViewDimension.width * overdrawFactor);
  int height=(int)(mapViewDimension.height * overdrawFactor);
  if (useSquareFrameBuffer) {
    float aspectRatio=((float)mapViewDimension.width) / mapViewDimension.height;
    if (aspectRatio < maxAspectRatio && aspectRatio > maxAspectRatio / 1) {
      width=Math.max(width,height);
      height=width;
    }
  }
  return new Dimension(width,height);
}
Program: 93368
Project: 93368
Buggy source:
public TileDownloadLayer(TileCache tileCache,MapViewPosition mapViewPosition,TileSource tileSource,GraphicFactory graphicFactory){
  super(tileCache,mapViewPosition,graphicFactory.createMatrix(),tileSource.hasAlpha());
  if (tileSource == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.tileCache=tileCache;
  this.tileSource=tileSource;
  this.graphicFactory=graphicFactory;
}

Fixed version (ground truth):
public TileDownloadLayer(TileCache tileCache,MapViewPosition mapViewPosition,TileSource tileSource,GraphicFactory graphicFactory){
  super(tileCache,mapViewPosition,graphicFactory.createMatrix(),tileSource.hasAlpha());
  this.tileCache=tileCache;
  this.tileSource=tileSource;
  this.graphicFactory=graphicFactory;
}
Program: 93369
Project: 93369
Buggy source:
@Override public void onDestroy(){
  if (this.bitmap != null) {
    this.bitmap.decrementRefCount();
  }
}

Fixed version (ground truth):
@Override public synchronized void onDestroy(){
  if (this.bitmap != null) {
    this.bitmap.decrementRefCount();
  }
}
Program: 93370
Project: 93370
Buggy source:
public boolean contains(Point center,Point point){
  Rectangle r=new Rectangle(center.x - bitmap.getWidth() / 2 + this.horizontalOffset,center.y - bitmap.getHeight() / 2 + this.verticalOffset,center.x + bitmap.getWidth() / 2 + this.horizontalOffset,center.y + bitmap.getHeight() / 2 + this.verticalOffset);
  return r.contains(point);
}

Fixed version (ground truth):
public synchronized boolean contains(Point center,Point point){
  Rectangle r=new Rectangle(center.x - (float)bitmap.getWidth() / 2 + this.horizontalOffset,center.y - (float)bitmap.getHeight() / 2 + this.verticalOffset,center.x + (float)bitmap.getWidth() / 2 + this.horizontalOffset,center.y + (float)bitmap.getHeight() / 2 + this.verticalOffset);
  return r.contains(point);
}
Program: 93372
Project: 93372
Buggy source:
public MapWorker(TileCache tileCache,JobQueue<RendererJob> jobQueue,DatabaseRenderer databaseRenderer,Layer layer){
  super();
  this.tileCache=tileCache;
  this.jobQueue=jobQueue;
  this.databaseRenderer=databaseRenderer;
  this.layer=layer;
}

Fixed version (ground truth):
public MapWorker(TileCache tileCache,JobQueue<RendererJob> jobQueue,DatabaseRenderer databaseRenderer,Layer layer){
  super();
  if (DEBUG_TIMING) {
    totalTime=new AtomicLong();
    totalExecutions=new AtomicLong();
  }
 else {
    totalTime=null;
    totalExecutions=null;
  }
  this.tileCache=tileCache;
  this.jobQueue=jobQueue;
  this.databaseRenderer=databaseRenderer;
  this.layer=layer;
}
Program: 93373
Project: 93373
Buggy source:
public DisplayModel(){
  this.setTileSize();
}

Fixed version (ground truth):
public DisplayModel(){
  super();
  this.setTileSize();
}
Program: 93374
Project: 93374
Buggy source:
public RenderThemeBuilder(GraphicFactory graphicFactory,DisplayModel displayModel1,String elementName,Attributes attributes) throws SAXException {
  this.baseStrokeWidth=1f;
  this.baseTextSize=1f;
  this.mapBackground=graphicFactory.createColor(Color.WHITE);
  extractValues(graphicFactory,elementName,attributes);
}

Fixed version (ground truth):
public RenderThemeBuilder(GraphicFactory graphicFactory,String elementName,Attributes attributes) throws SAXException {
  this.baseStrokeWidth=1f;
  this.baseTextSize=1f;
  this.mapBackground=graphicFactory.createColor(Color.WHITE);
  extractValues(graphicFactory,elementName,attributes);
}
Program: 93376
Project: 93376
Buggy source:
/** 
 * @see List#add(Object)
 */
public synchronized void add(Layer layer){
  checkIsNull(layer);
  layer.setDisplayModel(this.displayModel);
  this.layersList.add(layer);
  layer.assign(this.redrawer);
}

Fixed version (ground truth):
/** 
 * @see List#add(Object)
 */
public synchronized void add(Layer layer){
  checkIsNull(layer);
  layer.setDisplayModel(this.displayModel);
  this.layersList.add(layer);
  layer.assign(this.redrawer);
  this.redrawer.redrawLayers();
}
Program: 93377
Project: 93377
Buggy source:
/** 
 * @see List#addAll(int,Collection)
 */
public synchronized void addAll(int index,Collection<Layer> layers){
  checkIsNull(layers);
  this.layersList.addAll(index,layers);
  for (  Layer layer : layers) {
    layer.setDisplayModel(this.displayModel);
    layer.assign(this.redrawer);
  }
}

Fixed version (ground truth):
/** 
 * @see List#addAll(int,Collection)
 */
public synchronized void addAll(int index,Collection<Layer> layers){
  checkIsNull(layers);
  this.layersList.addAll(index,layers);
  for (  Layer layer : layers) {
    layer.setDisplayModel(this.displayModel);
    layer.assign(this.redrawer);
  }
  this.redrawer.redrawLayers();
}
Program: 93378
Project: 93378
Buggy source:
/** 
 * @see List#clear()
 */
public synchronized void clear(){
  for (  Layer layer : this.layersList) {
    layer.unassign();
  }
  this.layersList.clear();
}

Fixed version (ground truth):
/** 
 * @see List#clear()
 */
public synchronized void clear(){
  for (  Layer layer : this.layersList) {
    layer.unassign();
  }
  this.layersList.clear();
  this.redrawer.redrawLayers();
}
Program: 93379
Project: 93379
Buggy source:
/** 
 * @see List#remove(Object)
 */
public synchronized boolean remove(Layer layer){
  checkIsNull(layer);
  if (this.layersList.remove(layer)) {
    layer.unassign();
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @see List#remove(Object)
 */
public synchronized boolean remove(Layer layer){
  checkIsNull(layer);
  if (this.layersList.remove(layer)) {
    layer.unassign();
    this.redrawer.redrawLayers();
    return true;
  }
  return false;
}
Program: 93380
Project: 93380
Buggy source:
/** 
 * Get the number of tiles that can be stored on the file system
 * @param directory where the cache will reside
 * @param fileSize average size of tile to be cached
 * @return number of tiles that can be stored without running out of space
 */
@SuppressWarnings("String_Node_Str") @TargetApi(18) public static long getAvailableCacheSlots(String directory,int fileSize){
  StatFs statfs=new StatFs(directory);
  if (android.os.Build.VERSION.SDK_INT >= 18) {
    return statfs.getAvailableBytes() / fileSize;
  }
  int result=statfs.getAvailableBlocks() / (fileSize / statfs.getBlockSize());
  return result;
}

Fixed version (ground truth):
/** 
 * Get the number of tiles that can be stored on the file system
 * @param directory where the cache will reside
 * @param fileSize average size of tile to be cached
 * @return number of tiles that can be stored without running out of space
 */
@SuppressWarnings("String_Node_Str") @TargetApi(18) public static long getAvailableCacheSlots(String directory,int fileSize){
  StatFs statfs=new StatFs(directory);
  if (android.os.Build.VERSION.SDK_INT >= 18) {
    return statfs.getAvailableBytes() / fileSize;
  }
  int blocksPerFile=Math.max(fileSize / statfs.getBlockSize(),1);
  return statfs.getAvailableBlocks() / blocksPerFile;
}