Program: 11198
Project: 11198
Buggy source:
private static void tile(Type type,Dataset dataset,File mapFile,Sector sector,int level,int tilesize,double lzts,String imageFormat,boolean addAlpha,int bufferType,int band,int[] outsideValues,int[] minReplace,int[] maxReplace,Integer[] replace,Integer[] otherwise,File outputDirectory,ProgressReporter progress){
  progress.getLogger().info("String_Node_Str");
  String outputExt=type == Type.Elevations ? "String_Node_Str" : imageFormat;
  double tilesizedegrees=Math.pow(0.5,level) * lzts;
  int minX=GDALUtil.getTileX(sector.getMinLongitude() + 1e-10,level,lzts);
  int maxX=GDALUtil.getTileX(sector.getMaxLongitude() - 1e-10,level,lzts);
  int minY=GDALUtil.getTileY(sector.getMinLatitude() + 1e-10,level,lzts);
  int maxY=GDALUtil.getTileY(sector.getMaxLatitude() - 1e-10,level,lzts);
  int size=(maxX - minX + 1) * (maxY - minY + 1);
  int count=0;
  for (int Y=minY; Y <= maxY; Y++) {
    if (progress.isCancelled())     break;
    File rowDir=new File(outputDirectory,String.valueOf(level));
    rowDir=new File(rowDir,GDALUtil.paddedInt(Y,4));
    if (!rowDir.exists()) {
      rowDir.mkdirs();
    }
    for (int X=minX; X <= maxX; X++) {
      if (progress.isCancelled())       break;
      count++;
      progress.getLogger().fine("String_Node_Str" + X + "String_Node_Str"+ Y+ "String_Node_Str"+ count+ "String_Node_Str"+ size+ "String_Node_Str"+ (count * 100 / size)+ "String_Node_Str"+ (X - minX + 1)+ "String_Node_Str"+ (maxX - minX + 1)+ "String_Node_Str"+ (Y - minY + 1)+ "String_Node_Str"+ (maxY - minY + 1)+ "String_Node_Str");
      progress.progress(count / (double)size);
      final double lat1=(Y * tilesizedegrees) - 90;
      final double lon1=(X * tilesizedegrees) - 180;
      final double lat2=lat1 + tilesizedegrees;
      final double lon2=lon1 + tilesizedegrees;
      final File dst=new File(rowDir,GDALUtil.paddedInt(Y,4) + "String_Node_Str" + GDALUtil.paddedInt(X,4)+ "String_Node_Str"+ outputExt);
      if (dst.exists()) {
        progress.getLogger().warning(dst.getAbsolutePath() + "String_Node_Str");
      }
 else {
        try {
          if (type == Type.Mapnik) {
            Sector s=new Sector(lat1,lon1,lat2,lon2);
            MapnikUtil.tile(s,tilesize,tilesize,mapFile,dst,progress.getLogger());
          }
 else {
            GDALTile tile=new GDALTile(dataset,tilesize,tilesize,lat1,lon1,lat2,lon2,addAlpha,band);
            if (type == Type.Elevations) {
              tile=tile.convertToType(bufferType);
            }
            if (outsideValues != null) {
              tile.fillOutside(outsideValues);
            }
            if (minReplace != null && maxReplace != null && replace != null) {
              tile.replaceValues(minReplace,maxReplace,replace,otherwise);
            }
            if (type == Type.Elevations) {
              ByteBuffer bb=tile.getBuffer();
              bb.rewind();
              FileChannel fc=new RandomAccessFile(dst,"String_Node_Str").getChannel();
              MappedByteBuffer mbb=fc.map(MapMode.READ_WRITE,0,bb.limit());
              mbb.order(bb.order());
              mbb.put(bb);
              fc.close();
            }
 else {
              BufferedImage image=tile.getAsImage();
              ImageIO.write(image,outputExt,dst);
            }
          }
        }
 catch (        Exception e) {
          progress.getLogger().severe(e.getMessage());
          try {
            Thread.sleep(1);
          }
 catch (          InterruptedException e1) {
            e1.printStackTrace();
          }
        }
      }
    }
  }
  progress.getLogger().info("String_Node_Str" + (progress.isCancelled() ? "String_Node_Str" : "String_Node_Str"));
}

Fixed version (ground truth):
private static void tile(Type type,Dataset dataset,File mapFile,Sector sector,int level,int tilesize,double lzts,String imageFormat,boolean addAlpha,int bufferType,int band,NumberArray outsideValues,NumberArray minReplace,NumberArray maxReplace,NullableNumberArray replace,NullableNumberArray otherwise,NumberArray minMax,File outputDirectory,ProgressReporter progress){
  progress.getLogger().info("String_Node_Str");
  String outputExt=type == Type.Elevations ? "String_Node_Str" : imageFormat;
  double tilesizedegrees=Math.pow(0.5,level) * lzts;
  int minX=GDALUtil.getTileX(sector.getMinLongitude() + 1e-10,level,lzts);
  int maxX=GDALUtil.getTileX(sector.getMaxLongitude() - 1e-10,level,lzts);
  int minY=GDALUtil.getTileY(sector.getMinLatitude() + 1e-10,level,lzts);
  int maxY=GDALUtil.getTileY(sector.getMaxLatitude() - 1e-10,level,lzts);
  int size=(maxX - minX + 1) * (maxY - minY + 1);
  int count=0;
  for (int Y=minY; Y <= maxY; Y++) {
    if (progress.isCancelled())     break;
    File rowDir=new File(outputDirectory,String.valueOf(level));
    rowDir=new File(rowDir,GDALUtil.paddedInt(Y,4));
    if (!rowDir.exists()) {
      rowDir.mkdirs();
    }
    for (int X=minX; X <= maxX; X++) {
      if (progress.isCancelled())       break;
      count++;
      progress.getLogger().fine("String_Node_Str" + X + "String_Node_Str"+ Y+ "String_Node_Str"+ count+ "String_Node_Str"+ size+ "String_Node_Str"+ (count * 100 / size)+ "String_Node_Str"+ (X - minX + 1)+ "String_Node_Str"+ (maxX - minX + 1)+ "String_Node_Str"+ (Y - minY + 1)+ "String_Node_Str"+ (maxY - minY + 1)+ "String_Node_Str");
      progress.progress(count / (double)size);
      final double lat1=(Y * tilesizedegrees) - 90;
      final double lon1=(X * tilesizedegrees) - 180;
      final double lat2=lat1 + tilesizedegrees;
      final double lon2=lon1 + tilesizedegrees;
      final File dst=new File(rowDir,GDALUtil.paddedInt(Y,4) + "String_Node_Str" + GDALUtil.paddedInt(X,4)+ "String_Node_Str"+ outputExt);
      if (dst.exists()) {
        progress.getLogger().warning(dst.getAbsolutePath() + "String_Node_Str");
      }
 else {
        try {
          if (type == Type.Mapnik) {
            Sector s=new Sector(lat1,lon1,lat2,lon2);
            MapnikUtil.tile(s,tilesize,tilesize,mapFile,dst,progress.getLogger());
          }
 else {
            GDALTile tile=new GDALTile(dataset,tilesize,tilesize,lat1,lon1,lat2,lon2,addAlpha,band);
            if (type == Type.Elevations) {
              tile=tile.convertToType(bufferType);
            }
            if (outsideValues != null) {
              tile.fillOutside(outsideValues);
            }
            if (minReplace != null && maxReplace != null && replace != null && otherwise != null) {
              tile.replaceValues(minReplace,maxReplace,replace,otherwise);
            }
            if (type == Type.Elevations) {
              tile.updateMinMax(minMax,outsideValues);
              ByteBuffer bb=tile.getBuffer();
              bb.rewind();
              RandomAccessFile raf=null;
              try {
                raf=new RandomAccessFile(dst,"String_Node_Str");
                MappedByteBuffer mbb=raf.getChannel().map(MapMode.READ_WRITE,0,bb.limit());
                mbb.order(bb.order());
                mbb.put(bb);
              }
  finally {
                if (raf != null)                 raf.close();
              }
            }
 else {
              BufferedImage image=tile.getAsImage();
              ImageIO.write(image,outputExt,dst);
            }
          }
        }
 catch (        Exception e) {
          progress.getLogger().severe(e.getMessage());
          try {
            Thread.sleep(1);
          }
 catch (          InterruptedException e1) {
            e1.printStackTrace();
          }
        }
      }
    }
  }
  progress.getLogger().info("String_Node_Str" + (progress.isCancelled() ? "String_Node_Str" : "String_Node_Str"));
}