Program: 25524
Project: 25524
Buggy source:
/** 
 * Loads remaining channel data for multi-channel images.
 * @param firstChannelWidth    first channel width (at requested mipmap level).
 * @param firstChannelHeight   first channel height (at requested mipmap level).
 * @param firstChannelHasMask  indicates whether the first channel has a mask.
 * @param mipmapLevel          requested mipmap level for all channels.
 * @param channels             map of pixel data for all source channels.
 */
private void loadAdditionalChannels(final int firstChannelWidth,final int firstChannelHeight,final boolean firstChannelHasMask,final int mipmapLevel,final ChannelMap channels){
  for (int i=1; i < channelSpecList.size(); i++) {
    final ChannelSpec channelSpec=channelSpecList.get(i);
    final Map.Entry<Integer,ImageAndMask> mipmapEntry=channelSpec.getFloorMipmapEntry(mipmapLevel);
    final ImageAndMask imageAndMask=mipmapEntry.getValue();
    int downSampleLevels=0;
    final int currentMipmapLevel=mipmapEntry.getKey();
    if (currentMipmapLevel < mipmapLevel) {
      downSampleLevels=mipmapLevel - currentMipmapLevel;
    }
    final ImageProcessor imageProcessor=imageProcessorCache.get(imageAndMask.getImageUrl(),downSampleLevels,false,channelSpec.is16Bit());
    if (imageProcessor.getWidth() == firstChannelWidth && imageProcessor.getWidth() == firstChannelHeight) {
      final ImageProcessor maskProcessor;
      final String maskUrl=imageAndMask.getMaskUrl();
      if ((maskUrl != null) && (!excludeMask)) {
        maskProcessor=imageProcessorCache.get(maskUrl,downSampleLevels,true,false);
      }
 else {
        maskProcessor=null;
      }
      setMinAndMaxIntensity(imageProcessor,channelSpec);
      final ImageProcessorWithMasks channel=new ImageProcessorWithMasks(imageProcessor,maskProcessor,null);
      channels.put(channelSpec.getName(),channel);
    }
 else {
      LOG.warn("String_Node_Str",getSourceName(),channelSpec.getName(),imageAndMask.getImageUrl(),mipmapLevel,imageProcessor.getWidth(),imageProcessor.getHeight(),firstChannelWidth,firstChannelHeight);
    }
  }
  boolean removeAllMasks=false;
  for (  final ImageProcessorWithMasks channel : channels.values()) {
    if (firstChannelHasMask) {
      if (channel.mask == null) {
        removeAllMasks=true;
        break;
      }
    }
 else     if (channel.mask != null) {
      removeAllMasks=true;
      break;
    }
  }
  if (removeAllMasks) {
    LOG.warn("String_Node_Str",getSourceName());
    for (    final ImageProcessorWithMasks channel : channels.values()) {
      channel.mask=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * Loads remaining channel data for multi-channel images.
 * @param firstChannelWidth    first channel width (at requested mipmap level).
 * @param firstChannelHeight   first channel height (at requested mipmap level).
 * @param mipmapLevel          requested mipmap level for all channels.
 * @param channels             map of pixel data for all source channels.
 */
private void loadAdditionalChannels(final int firstChannelWidth,final int firstChannelHeight,final int mipmapLevel,final ChannelMap channels){
  for (int i=1; i < channelSpecList.size(); i++) {
    final ChannelSpec channelSpec=channelSpecList.get(i);
    final Map.Entry<Integer,ImageAndMask> mipmapEntry=channelSpec.getFloorMipmapEntry(mipmapLevel);
    final ImageAndMask imageAndMask=mipmapEntry.getValue();
    int downSampleLevels=0;
    final int currentMipmapLevel=mipmapEntry.getKey();
    if (currentMipmapLevel < mipmapLevel) {
      downSampleLevels=mipmapLevel - currentMipmapLevel;
    }
    final ImageProcessor imageProcessor=imageProcessorCache.get(imageAndMask.getImageUrl(),downSampleLevels,false,channelSpec.is16Bit());
    if (imageProcessor.getWidth() == firstChannelWidth && imageProcessor.getWidth() == firstChannelHeight) {
      final ImageProcessor maskProcessor;
      final String maskUrl=imageAndMask.getMaskUrl();
      if ((maskUrl != null) && (!excludeMask)) {
        maskProcessor=imageProcessorCache.get(maskUrl,downSampleLevels,true,false);
      }
 else {
        maskProcessor=null;
      }
      setMinAndMaxIntensity(imageProcessor,channelSpec);
      final ImageProcessorWithMasks channel=new ImageProcessorWithMasks(imageProcessor,maskProcessor,null);
      channels.put(channelSpec.getName(),channel);
    }
 else {
      LOG.warn("String_Node_Str",getSourceName(),channelSpec.getName(),imageAndMask.getImageUrl(),mipmapLevel,imageProcessor.getWidth(),imageProcessor.getHeight(),firstChannelWidth,firstChannelHeight);
    }
  }
}