Program: 25566
Project: 25566
Buggy source:
public void generateBoxesForZ(final Double z) throws Exception {
  LOG.info("String_Node_Str",z,boxDirectory,renderDataClient);
  final Bounds layerBounds=renderDataClient.getLayerBounds(stack,z);
  final SectionBoxBounds boxBounds=new SectionBoxBounds(z,boxWidth,boxHeight,layerBounds);
  if (params.renderGroup != null) {
    boxBounds.setRenderGroup(params.renderGroup,params.numberOfRenderGroups,params.maxLevel);
  }
  final List<TileBounds> tileBoundsList=renderDataClient.getTileBounds(stack,z);
  final int tileCount=tileBoundsList.size();
  final TileBounds firstTileBounds=tileBoundsList.get(0);
  final TileSpec firstTileSpec=renderDataClient.getTile(stack,firstTileBounds.getTileId());
  LOG.info("String_Node_Str",z,layerBounds,boxBounds,tileCount);
  final ImageProcessorCache imageProcessorCache;
  if (params.label) {
    imageProcessorCache=new LabelImageProcessorCache(ImageProcessorCache.DEFAULT_MAX_CACHED_PIXELS,true,false,firstTileSpec.getWidth(),firstTileSpec.getHeight(),tileCount);
  }
 else {
    imageProcessorCache=new ImageProcessorCache();
  }
  BoxMipmapGenerator boxMipmapGenerator=new BoxMipmapGenerator(z.intValue(),params.label,format,boxWidth,boxHeight,boxDirectory,0,boxBounds.getFirstRow(),boxBounds.getLastRow(),boxBounds.getFirstColumn(),boxBounds.getLastColumn(),params.forceGeneration);
  final IGridPaths iGridPaths;
  if (params.createIGrid) {
    iGridPaths=new IGridPaths(boxBounds.getNumberOfRows(),boxBounds.getNumberOfColumns());
  }
 else {
    iGridPaths=null;
  }
  generateLevelZero(z,boxBounds,tileCount,imageProcessorCache,boxMipmapGenerator,iGridPaths);
  if (iGridPaths != null) {
    final Path iGridDirectory=Paths.get(boxDirectory.getAbsolutePath(),"String_Node_Str","String_Node_Str");
    iGridPaths.saveToFile(iGridDirectory.toFile(),z,emptyImageFile);
  }
  final Path overviewDirPath=Paths.get(boxDirectory.getAbsolutePath(),"String_Node_Str");
  final String overviewFileName=z.intValue() + "String_Node_Str" + format.toLowerCase();
  final File overviewFile=new File(overviewDirPath.toFile(),overviewFileName).getAbsoluteFile();
  boolean isOverviewGenerated=(!params.forceGeneration) && overviewFile.exists();
  if (isOverviewGenerated) {
    LOG.info("String_Node_Str",z,overviewFile.getAbsolutePath());
  }
  for (int level=0; level < params.maxLevel; level++) {
    boxMipmapGenerator=boxMipmapGenerator.generateNextLevel();
    if (params.isOverviewNeeded() && (!isOverviewGenerated)) {
      isOverviewGenerated=boxMipmapGenerator.generateOverview(params.overviewWidth,layerBounds,overviewFile);
    }
  }
  LOG.info("String_Node_Str",z);
}

Fixed version (ground truth):
public void generateBoxesForZ(final Double z) throws Exception {
  LOG.info("String_Node_Str",z,boxDirectory,renderDataClient);
  final Bounds layerBounds=renderDataClient.getLayerBounds(stack,z);
  final SectionBoxBounds boxBounds=new SectionBoxBounds(z,boxWidth,boxHeight,layerBounds);
  if (params.renderGroup != null) {
    boxBounds.setRenderGroup(params.renderGroup,params.numberOfRenderGroups,params.maxLevel);
  }
  final List<TileBounds> tileBoundsList=renderDataClient.getTileBounds(stack,z);
  final int tileCount=tileBoundsList.size();
  final TileBounds firstTileBounds=tileBoundsList.get(0);
  final TileSpec firstTileSpec=renderDataClient.getTile(stack,firstTileBounds.getTileId());
  LOG.info("String_Node_Str",z,layerBounds,boxBounds,tileCount);
  final ImageProcessorCache imageProcessorCache;
  if (params.label) {
    imageProcessorCache=new LabelImageProcessorCache(ImageProcessorCache.DEFAULT_MAX_CACHED_PIXELS,true,false,firstTileSpec.getWidth(),firstTileSpec.getHeight(),tileCount);
  }
 else {
    imageProcessorCache=new ImageProcessorCache();
  }
  BoxMipmapGenerator boxMipmapGenerator=new BoxMipmapGenerator(z.intValue(),params.label,format,boxWidth,boxHeight,boxDirectory,0,boxBounds.getFirstRow(),boxBounds.getLastRow(),boxBounds.getFirstColumn(),boxBounds.getLastColumn(),params.forceGeneration);
  final IGridPaths iGridPaths;
  if (params.createIGrid) {
    iGridPaths=new IGridPaths(boxBounds.getNumberOfRows(),boxBounds.getNumberOfColumns());
  }
 else {
    iGridPaths=null;
  }
  generateLevelZero(z,boxBounds,tileCount,imageProcessorCache,boxMipmapGenerator,iGridPaths);
  if (iGridPaths != null) {
    final Path iGridDirectory=Paths.get(boxDirectory.getAbsolutePath(),"String_Node_Str","String_Node_Str");
    iGridPaths.saveToFile(iGridDirectory.toFile(),z,emptyImageFile);
  }
  final Path overviewDirPath=Paths.get(boxDirectory.getAbsolutePath(),"String_Node_Str");
  final String overviewFileName=z.intValue() + "String_Node_Str" + format.toLowerCase();
  final File overviewFile=new File(overviewDirPath.toFile(),overviewFileName).getAbsoluteFile();
  boolean isOverviewGenerated=(!params.forceGeneration) && overviewFile.exists();
  if (isOverviewGenerated) {
    LOG.info("String_Node_Str",z,overviewFile.getAbsolutePath());
  }
  for (int level=0; level < params.maxLevel; level++) {
    boxMipmapGenerator=boxMipmapGenerator.generateNextLevel();
    if (params.isOverviewNeeded() && (!isOverviewGenerated)) {
      isOverviewGenerated=boxMipmapGenerator.generateOverview(params.overviewWidth,stackBounds,overviewFile);
    }
  }
  LOG.info("String_Node_Str",z);
}