Program: 94423
Project: 94423
Buggy source:
private boolean saveMultipleTiles(String output,String format,final MrsImage image,final long[] tiles){
  try {
    final MrsImagePyramidMetadata metadata=image.getMetadata();
    Raster raster=RasterTileMerger.mergeTiles(image,tiles);
    Raster sampleRaster=null;
    TMSUtils.Bounds imageBounds=null;
    long minId=tiles[0];
    final int tilesize=image.getTilesize();
    final int zoomlevel=image.getZoomlevel();
    for (    final long lid : tiles) {
      if (minId > lid) {
        minId=lid;
      }
      final TMSUtils.Tile tile=TMSUtils.tileid(lid,zoomlevel);
      final TMSUtils.Bounds bounds=TMSUtils.tileBounds(tile.tx,tile.ty,zoomlevel,tilesize);
      if (imageBounds == null) {
        imageBounds=bounds;
      }
 else {
        imageBounds.expand(bounds);
      }
      if (sampleRaster == null) {
        try {
          sampleRaster=image.getTile(tile.tx,tile.ty);
        }
 catch (        final TileNotFoundException e) {
        }
      }
    }
    if (imageBounds == null) {
      throw new MrsImageException("String_Node_Str");
    }
    if (sampleRaster == null) {
      throw new MrsImageException("String_Node_Str");
    }
    String out=makeOutputName(output,format,minId,zoomlevel,tilesize);
    if (colorscale != null || !format.equals("String_Node_Str")) {
      ColorScaleApplier applier=null;
switch (format) {
case "String_Node_Str":
case "String_Node_Str":
        applier=new PngColorScaleApplier();
      break;
case "String_Node_Str":
case "String_Node_Str":
    applier=new JpegColorScaleApplier();
  break;
}
if (applier != null) {
raster=applier.applyColorScale(raster,colorscale,image.getExtrema(),image.getMetadata().getDefaultValues());
}
}
GDALUtils.saveRaster(raster,out,format,imageBounds,zoomlevel,tilesize,metadata.getDefaultValue(0));
System.out.println("String_Node_Str" + out);
return true;
}
 catch (final Exception e) {
e.printStackTrace();
}
return false;
}

Fixed version (ground truth):
private boolean saveMultipleTiles(String output,String format,final MrsImage image,final long[] tiles){
  try {
    final MrsImagePyramidMetadata metadata=image.getMetadata();
    Raster raster=RasterTileMerger.mergeTiles(image,tiles);
    Raster sampleRaster=null;
    TMSUtils.Bounds imageBounds=null;
    long minId=tiles[0];
    final int tilesize=image.getTilesize();
    final int zoomlevel=image.getZoomlevel();
    for (    final long lid : tiles) {
      if (minId > lid) {
        minId=lid;
      }
      final TMSUtils.Tile tile=TMSUtils.tileid(lid,zoomlevel);
      final TMSUtils.Bounds bounds=TMSUtils.tileBounds(tile.tx,tile.ty,zoomlevel,tilesize);
      if (imageBounds == null) {
        imageBounds=bounds;
      }
 else {
        imageBounds.expand(bounds);
      }
      if (sampleRaster == null) {
        try {
          sampleRaster=image.getTile(tile.tx,tile.ty);
        }
 catch (        final TileNotFoundException e) {
        }
      }
    }
    if (imageBounds == null) {
      throw new MrsImageException("String_Node_Str");
    }
    if (sampleRaster == null) {
      throw new MrsImageException("String_Node_Str");
    }
    String out=makeOutputName(output,format,minId,zoomlevel,tilesize);
    if (colorscale != null || !format.equals("String_Node_Str")) {
      ColorScaleApplier applier=null;
switch (format) {
case "String_Node_Str":
case "String_Node_Str":
        applier=new PngColorScaleApplier();
      break;
case "String_Node_Str":
case "String_Node_Str":
    applier=new JpegColorScaleApplier();
  break;
}
if (applier != null) {
raster=applier.applyColorScale(raster,colorscale,image.getExtrema(),image.getMetadata().getDefaultValues());
}
}
GDALJavaUtils.saveRaster(raster,out,imageBounds,metadata.getDefaultValue(0),format);
System.out.println("String_Node_Str" + out);
return true;
}
 catch (final Exception e) {
e.printStackTrace();
}
return false;
}