Program: 17303
Project: 17303
Buggy source:
/** 
 * Constructs a cache.
 * @param cacheManager       the CacheManager that's creating the RICache
 * @param cacheName          the name of the Cache
 * @param classLoader        the ClassLoader the RICache will use for loading classes
 * @param configuration      the Configuration of the Cache
 */
RICache(RICacheManager cacheManager,String cacheName,ClassLoader classLoader,Configuration<K,V> configuration){
  this.cacheManager=cacheManager;
  this.cacheName=cacheName;
  this.classLoaderReference=new WeakReference<ClassLoader>(classLoader);
  this.configuration=new RIConfiguration<K,V>(configuration);
  if (this.configuration.getCacheLoaderFactory() != null) {
    this.cacheLoader=(CacheLoader<K,V>)this.configuration.getCacheLoaderFactory().create();
  }
  if (this.configuration.getCacheWriterFactory() != null) {
    this.cacheWriter=(CacheWriter<K,V>)this.configuration.getCacheWriterFactory().create();
  }
  keyConverter=configuration.isStoreByValue() ? new RISerializingInternalConverter<K>(classLoader) : new RIReferenceInternalConverter<K>();
  valueConverter=configuration.isStoreByValue() ? new RISerializingInternalConverter<V>(classLoader) : new RIReferenceInternalConverter<V>();
  this.expiryPolicy=configuration.getExpiryPolicyFactory().create();
  status=Status.UNINITIALISED;
  entries=new RISimpleInternalMap<Object,RICachedValue>();
  cacheMXBean=new RICacheMXBean<K,V>(this);
  statistics=new RICacheStatisticsMXBean(this);
  if (configuration.isManagementEnabled()) {
    setManagementEnabled(true);
  }
  if (configuration.isStatisticsEnabled()) {
    setStatisticsEnabled(true);
  }
  for (  CacheEntryListenerRegistration<? super K,? super V> r : configuration.getCacheEntryListenerRegistrations()) {
    CacheEntryListener<? super K,? super V> listener=r.getCacheEntryListener();
    CacheEntryEventFilter<? super K,? super V> filter=r.getCacheEntryFilter();
    boolean oldValueRequired=r.isOldValueRequired();
    boolean synchronous=r.isSynchronous();
    RICacheEntryListenerRegistration<K,V> registration=new RICacheEntryListenerRegistration<K,V>(listener,filter,oldValueRequired,synchronous);
    cacheEntryListenerRegistrations.put(listener,registration);
  }
}

Fixed version (ground truth):
/** 
 * Constructs a cache.
 * @param cacheManager       the CacheManager that's creating the RICache
 * @param cacheName          the name of the Cache
 * @param classLoader        the ClassLoader the RICache will use for loading classes
 * @param configuration      the Configuration of the Cache
 */
RICache(RICacheManager cacheManager,String cacheName,ClassLoader classLoader,Configuration<K,V> configuration){
  this.cacheManager=cacheManager;
  this.cacheName=cacheName;
  this.classLoaderReference=new WeakReference<ClassLoader>(classLoader);
  this.configuration=new RIConfiguration<K,V>(configuration);
  if (this.configuration.getCacheLoaderFactory() != null) {
    this.cacheLoader=(CacheLoader<K,V>)this.configuration.getCacheLoaderFactory().create();
  }
  if (this.configuration.getCacheWriterFactory() != null) {
    this.cacheWriter=(CacheWriter<K,V>)this.configuration.getCacheWriterFactory().create();
  }
  keyConverter=configuration.isStoreByValue() ? new RISerializingInternalConverter<K>(classLoader) : new RIReferenceInternalConverter<K>();
  valueConverter=configuration.isStoreByValue() ? new RISerializingInternalConverter<V>(classLoader) : new RIReferenceInternalConverter<V>();
  this.expiryPolicy=configuration.getExpiryPolicyFactory().create();
  entries=new RISimpleInternalMap<Object,RICachedValue>();
  cacheMXBean=new RICacheMXBean<K,V>(this);
  statistics=new RICacheStatisticsMXBean(this);
  isClosed=false;
  if (configuration.isManagementEnabled()) {
    setManagementEnabled(true);
  }
  if (configuration.isStatisticsEnabled()) {
    setStatisticsEnabled(true);
  }
  for (  CacheEntryListenerRegistration<? super K,? super V> r : configuration.getCacheEntryListenerRegistrations()) {
    CacheEntryListener<? super K,? super V> listener=r.getCacheEntryListener();
    CacheEntryEventFilter<? super K,? super V> filter=r.getCacheEntryFilter();
    boolean oldValueRequired=r.isOldValueRequired();
    boolean synchronous=r.isSynchronous();
    RICacheEntryListenerRegistration<K,V> registration=new RICacheEntryListenerRegistration<K,V>(listener,filter,oldValueRequired,synchronous);
    cacheEntryListenerRegistrations.put(listener,registration);
  }
}