Program: 25587
Project: 25587
Buggy source:
/** 
 * Constructs a cache instance using the specified parameters.
 * @param maximumNumberOfCachedPixels         the maximum number of pixels to maintain in the cache.This should roughly correlate to the maximum amount of memory for the cache.
 * @param recordStats                         if true, useful tuning stats like cache hits and loads will bemaintained (presumably at some nominal overhead cost); otherwise stats are not maintained.
 * @param cacheOriginalsForDownSampledImages  if true, when down sampled images are requested their sourceimages will also be cached (presumably improving the speed of future down sampling to a different level); otherwise only the down sampled result images are cached.
 */
public ImageProcessorCache(final long maximumNumberOfCachedPixels,final boolean recordStats,final boolean cacheOriginalsForDownSampledImages){
  this.maximumNumberOfCachedPixels=maximumNumberOfCachedPixels;
  this.recordStats=recordStats;
  this.cacheOriginalsForDownSampledImages=cacheOriginalsForDownSampledImages;
  this.opener=new Opener();
  this.opener.setSilentMode(true);
  final Weigher<CacheKey,ImageProcessor> weigher=new Weigher<CacheKey,ImageProcessor>(){
    @Override public int weigh(    @Nullable CacheKey key,    @Nullable ImageProcessor value){
      final int weight;
      if (value == null) {
        weight=0;
      }
 else {
        weight=value.getPixelCount();
      }
      return weight;
    }
  }
;
  final CacheLoader<CacheKey,ImageProcessor> loader=new CacheLoader<CacheKey,ImageProcessor>(){
    @Override public ImageProcessor load(    @Nullable CacheKey key) throws Exception {
      ImageProcessor imageProcessor=null;
      if (key != null) {
        imageProcessor=loadImageProcessor(key.getUri(),key.getDownSampleLevels(),key.isMask());
      }
      return imageProcessor;
    }
  }
;
  if (recordStats) {
    cache=CacheBuilder.newBuilder().maximumWeight(maximumNumberOfCachedPixels).weigher(weigher).recordStats().build(loader);
  }
 else {
    cache=CacheBuilder.newBuilder().maximumWeight(maximumNumberOfCachedPixels).weigher(weigher).build(loader);
  }
}

Fixed version (ground truth):
/** 
 * Constructs a cache instance using the specified parameters.
 * @param maximumNumberOfCachedPixels         the maximum number of pixels to maintain in the cache.This should roughly correlate to the maximum amount of memory for the cache.
 * @param recordStats                         if true, useful tuning stats like cache hits and loads will bemaintained (presumably at some nominal overhead cost); otherwise stats are not maintained.
 * @param cacheOriginalsForDownSampledImages  if true, when down sampled images are requested their sourceimages will also be cached (presumably improving the speed of future down sampling to a different level); otherwise only the down sampled result images are cached.
 */
public ImageProcessorCache(final long maximumNumberOfCachedPixels,final boolean recordStats,final boolean cacheOriginalsForDownSampledImages){
  this.maximumNumberOfCachedPixels=maximumNumberOfCachedPixels;
  this.recordStats=recordStats;
  this.cacheOriginalsForDownSampledImages=cacheOriginalsForDownSampledImages;
  final Weigher<CacheKey,ImageProcessor> weigher=new Weigher<CacheKey,ImageProcessor>(){
    @Override public int weigh(    @Nullable CacheKey key,    @Nullable ImageProcessor value){
      final int weight;
      if (value == null) {
        weight=0;
      }
 else {
        weight=value.getPixelCount();
      }
      return weight;
    }
  }
;
  final CacheLoader<CacheKey,ImageProcessor> loader=new CacheLoader<CacheKey,ImageProcessor>(){
    @Override public ImageProcessor load(    @Nullable CacheKey key) throws Exception {
      ImageProcessor imageProcessor=null;
      if (key != null) {
        imageProcessor=loadImageProcessor(key.getUri(),key.getDownSampleLevels(),key.isMask());
      }
      return imageProcessor;
    }
  }
;
  if (recordStats) {
    cache=CacheBuilder.newBuilder().maximumWeight(maximumNumberOfCachedPixels).weigher(weigher).recordStats().build(loader);
  }
 else {
    cache=CacheBuilder.newBuilder().maximumWeight(maximumNumberOfCachedPixels).weigher(weigher).build(loader);
  }
}