Program: 11196
Project: 11196
Buggy source:
private static void createOverviews(boolean elevations,File directory,String extension,int width,int height,int bufferType,ByteOrder byteOrder,int[] outsideValues,Sector sector,double lzts,ProgressReporter progress){
  progress.getLogger().info("String_Node_Str");
  if (directory.isDirectory()) {
    if (extension.startsWith("String_Node_Str")) {
      extension=extension.substring(1);
    }
    int bufferTypeSize=1;
    if (elevations) {
      bufferTypeSize=gdal.GetDataTypeSize(bufferType);
      bufferTypeSize/=4;
      if (bufferTypeSize != 1 && bufferTypeSize != 2 && bufferTypeSize != 4) {
        throw new IllegalArgumentException("String_Node_Str");
      }
    }
    ByteBuffer outsideBuffer=null;
    BufferedImage outsideImage=null;
    if (outsideValues != null) {
      int bandCount=outsideValues.length;
      int[] offsets=new int[bandCount];
      byte[] bytes=new byte[bandCount * width * height* bufferTypeSize];
      outsideBuffer=ByteBuffer.wrap(bytes);
      for (int b=0; b < bandCount; b++) {
        offsets[b]=b * width * height* bufferTypeSize;
        for (int i=0; i < width * height; i++) {
          int index=offsets[b] + i;
switch (bufferTypeSize) {
case 1:
            outsideBuffer.put(index,(byte)outsideValues[b]);
          break;
case 2:
        outsideBuffer.putShort(index,(short)outsideValues[b]);
      break;
case 4:
    outsideBuffer.putInt(index,outsideValues[b]);
  break;
}
}
}
if (!elevations) {
DataBuffer buffer=new DataBufferByte(bytes,bytes.length);
SampleModel sampleModel=new ComponentSampleModel(DataBuffer.TYPE_BYTE,width,height,1,width,offsets);
WritableRaster raster=Raster.createWritableRaster(sampleModel,buffer,null);
int imageType=bandCount == 1 ? BufferedImage.TYPE_BYTE_GRAY : bandCount == 3 ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB_PRE;
outsideImage=new BufferedImage(width,height,imageType);
outsideImage.setData(raster);
}
}
File[] dirs=directory.listFiles(new DirectoryFileFilter());
int maxlevel=Integer.MIN_VALUE;
for (int i=0; i < dirs.length; i++) {
try {
int num=Integer.parseInt(dirs[i].getName());
if (num > maxlevel) {
maxlevel=num;
}
}
 catch (NumberFormatException e) {
}
}
int count=0;
int size=0;
for (int i=0; i < maxlevel; i++) {
size+=GDALUtil.tileCount(sector,maxlevel,lzts);
}
for (int level=maxlevel; level > 0; level--) {
if (progress.isCancelled()) break;
File dir=new File(directory.getAbsolutePath() + "String_Node_Str" + level);
ExtensionFileFilter fileFilter=new ExtensionFileFilter(extension);
Set<File> sourceFiles=new HashSet<File>();
FileUtil.recursivelyAddFiles(sourceFiles,dir,fileFilter);
while (!sourceFiles.isEmpty()) {
if (progress.isCancelled()) break;
count++;
progress.getLogger().fine("String_Node_Str" + count + "String_Node_Str"+ size+ "String_Node_Str"+ (count * 100 / size)+ "String_Node_Str");
progress.progress(count / (double)size);
File file=sourceFiles.iterator().next();
String path=file.getName();
Pattern pattern=Pattern.compile("String_Node_Str");
Matcher matcher=pattern.matcher(path);
matcher.find();
int row=Integer.parseInt(matcher.group());
matcher.find(matcher.end());
int col=Integer.parseInt(matcher.group());
int rowabove=row / 2;
int colabove=col / 2;
final File src0=tileFile(dir,extension,rowabove * 2,colabove * 2);
final File src1=tileFile(dir,extension,rowabove * 2 + 1,colabove * 2);
final File src2=tileFile(dir,extension,rowabove * 2,colabove * 2 + 1);
final File src3=tileFile(dir,extension,rowabove * 2 + 1,colabove * 2 + 1);
sourceFiles.remove(src0);
sourceFiles.remove(src1);
sourceFiles.remove(src2);
sourceFiles.remove(src3);
final File dst=tileFile(new File(dir.getParent() + "String_Node_Str" + (level - 1)),extension,rowabove,colabove);
dst.getParentFile().mkdirs();
if (dst.exists()) {
progress.getLogger().warning(dst.getAbsolutePath() + "String_Node_Str");
}
 else {
try {
if (elevations) {
  mixElevations(src0,src1,src2,src3,dst,width,height,bufferTypeSize,byteOrder,outsideValues);
}
 else {
  mixImages(src0,src1,src2,src3,dst,width,height,outsideImage);
}
}
 catch (IOException e) {
progress.getLogger().severe(e.getMessage());
}
}
}
}
}
progress.getLogger().info("String_Node_Str" + (progress.isCancelled() ? "String_Node_Str" : "String_Node_Str"));
}

Fixed version (ground truth):
private static void createOverviews(OverviewCreator overviewCreator,File directory,String extension,Sector sector,double lzts,ProgressReporter progress){
  progress.getLogger().info("String_Node_Str");
  if (directory.isDirectory()) {
    if (extension.startsWith("String_Node_Str")) {
      extension=extension.substring(1);
    }
    File[] dirs=directory.listFiles(new DirectoryFileFilter());
    int maxlevel=Integer.MIN_VALUE;
    for (int i=0; i < dirs.length; i++) {
      try {
        int num=Integer.parseInt(dirs[i].getName());
        if (num > maxlevel) {
          maxlevel=num;
        }
      }
 catch (      NumberFormatException e) {
      }
    }
    int count=0;
    int size=0;
    for (int i=0; i < maxlevel; i++) {
      size+=GDALUtil.tileCount(sector,i,lzts);
    }
    for (int level=maxlevel; level > 0; level--) {
      if (progress.isCancelled())       break;
      File dir=new File(directory.getAbsolutePath() + "String_Node_Str" + level);
      ExtensionFileFilter fileFilter=new ExtensionFileFilter(extension);
      Set<File> sourceFiles=new HashSet<File>();
      FileUtil.recursivelyAddFiles(sourceFiles,dir,fileFilter);
      while (!sourceFiles.isEmpty()) {
        if (progress.isCancelled())         break;
        count++;
        progress.getLogger().fine("String_Node_Str" + count + "String_Node_Str"+ size+ "String_Node_Str"+ (count * 100 / size)+ "String_Node_Str");
        progress.progress(count / (double)size);
        File file=sourceFiles.iterator().next();
        String path=file.getName();
        Pattern pattern=Pattern.compile("String_Node_Str");
        Matcher matcher=pattern.matcher(path);
        matcher.find();
        int row=Integer.parseInt(matcher.group());
        matcher.find(matcher.end());
        int col=Integer.parseInt(matcher.group());
        int rowabove=row / 2;
        int colabove=col / 2;
        final File src0=tileFile(dir,extension,rowabove * 2,colabove * 2);
        final File src1=tileFile(dir,extension,rowabove * 2 + 1,colabove * 2);
        final File src2=tileFile(dir,extension,rowabove * 2,colabove * 2 + 1);
        final File src3=tileFile(dir,extension,rowabove * 2 + 1,colabove * 2 + 1);
        sourceFiles.remove(src0);
        sourceFiles.remove(src1);
        sourceFiles.remove(src2);
        sourceFiles.remove(src3);
        final File dst=tileFile(new File(dir.getParent() + "String_Node_Str" + (level - 1)),extension,rowabove,colabove);
        dst.getParentFile().mkdirs();
        if (dst.exists()) {
          progress.getLogger().warning(dst.getAbsolutePath() + "String_Node_Str");
        }
 else {
          try {
            overviewCreator.mix(src0,src1,src2,src3,dst);
          }
 catch (          IOException e) {
            progress.getLogger().severe(e.getMessage());
          }
        }
      }
    }
  }
  progress.getLogger().info("String_Node_Str" + (progress.isCancelled() ? "String_Node_Str" : "String_Node_Str"));
}