Program: 94401
Project: 94401
Buggy source:
public MrGeoRaster getRaster(final TileBounds tileBounds) throws MrGeoRaster.MrGeoRasterException {
  getMetadata();
  final int tilesize=metadata.getTilesize();
  final Bounds imageBounds=TMSUtils.tileToBounds(tileBounds,zoomlevel,tilesize);
  final Pixel ul=TMSUtils.latLonToPixelsUL(imageBounds.n,imageBounds.w,zoomlevel,tilesize);
  final Pixel lr=TMSUtils.latLonToPixelsUL(imageBounds.s,imageBounds.e,zoomlevel,tilesize);
  MrGeoRaster merged=MrGeoRaster.createEmptyRaster((int)(lr.px - ul.px),(int)(lr.py - ul.py),metadata.getBands(),metadata.getTileType());
  merged.fill(metadata.getDefaultValuesDouble());
  log.debug("String_Node_Str",zoomlevel,tileBounds.w,tileBounds.s,TMSUtils.tileid(tileBounds.w,tileBounds.s,zoomlevel),tileBounds.e,tileBounds.n,TMSUtils.tileid(tileBounds.e,tileBounds.n,zoomlevel));
  for (long row=tileBounds.s; row <= tileBounds.n; row++) {
    final TileIdWritable rowStart=new TileIdWritable(TMSUtils.tileid(tileBounds.w,row,zoomlevel));
    final TileIdWritable rowEnd=new TileIdWritable(TMSUtils.tileid(tileBounds.e,row,zoomlevel));
    final KVIterator<TileIdWritable,MrGeoRaster> iter=getTiles(rowStart,rowEnd);
    while (iter.hasNext()) {
      final MrGeoRaster source=iter.currentValue();
      if (source != null) {
        final Tile tile=TMSUtils.tileid(iter.currentKey().get(),zoomlevel);
        final Bounds bounds=TMSUtils.tileBounds(tile.tx,tile.ty,zoomlevel,tilesize);
        final Pixel start=TMSUtils.latLonToPixelsUL(bounds.n,bounds.w,zoomlevel,tilesize);
        log.debug("String_Node_Str",tile.tx,tile.ty,bounds.w,bounds.s,bounds.e,bounds.n,start.px - ul.px,start.py - ul.py);
        merged.copyFrom(0,0,source.width(),source.height(),source,(int)(start.px - ul.px),(int)(start.py - ul.py));
      }
    }
    if (iter instanceof CloseableKVIterator) {
      try {
        ((CloseableKVIterator)iter).close();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  return merged;
}

Fixed version (ground truth):
public MrGeoRaster getRaster(final TileBounds tileBounds) throws MrGeoRaster.MrGeoRasterException {
  getMetadata();
  final int tilesize=metadata.getTilesize();
  int zoomlevel=getZoomlevel();
  final Bounds imageBounds=TMSUtils.tileToBounds(tileBounds,zoomlevel,tilesize);
  final Pixel ul=TMSUtils.latLonToPixelsUL(imageBounds.n,imageBounds.w,zoomlevel,tilesize);
  final Pixel lr=TMSUtils.latLonToPixelsUL(imageBounds.s,imageBounds.e,zoomlevel,tilesize);
  MrGeoRaster merged=MrGeoRaster.createEmptyRaster((int)(lr.px - ul.px),(int)(lr.py - ul.py),metadata.getBands(),metadata.getTileType());
  merged.fill(metadata.getDefaultValuesDouble());
  log.debug("String_Node_Str",zoomlevel,tileBounds.w,tileBounds.s,TMSUtils.tileid(tileBounds.w,tileBounds.s,zoomlevel),tileBounds.e,tileBounds.n,TMSUtils.tileid(tileBounds.e,tileBounds.n,zoomlevel));
  for (long row=tileBounds.s; row <= tileBounds.n; row++) {
    final TileIdWritable rowStart=new TileIdWritable(TMSUtils.tileid(tileBounds.w,row,zoomlevel));
    final TileIdWritable rowEnd=new TileIdWritable(TMSUtils.tileid(tileBounds.e,row,zoomlevel));
    final KVIterator<TileIdWritable,MrGeoRaster> iter=getTiles(rowStart,rowEnd);
    while (iter.hasNext()) {
      final MrGeoRaster source=iter.currentValue();
      if (source != null) {
        final Tile tile=TMSUtils.tileid(iter.currentKey().get(),zoomlevel);
        final Bounds bounds=TMSUtils.tileBounds(tile.tx,tile.ty,zoomlevel,tilesize);
        final Pixel start=TMSUtils.latLonToPixelsUL(bounds.n,bounds.w,zoomlevel,tilesize);
        log.debug("String_Node_Str",tile.tx,tile.ty,bounds.w,bounds.s,bounds.e,bounds.n,start.px - ul.px,start.py - ul.py);
        merged.copyFrom(0,0,source.width(),source.height(),source,(int)(start.px - ul.px),(int)(start.py - ul.py));
      }
    }
    if (iter instanceof CloseableKVIterator) {
      try {
        ((CloseableKVIterator)iter).close();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  return merged;
}