Program: 46795
Project: 46795
Buggy source:
public AbstractCacheRecordStore(final String name,final int partitionId,final NodeEngine nodeEngine,final AbstractCacheService cacheService){
  this.name=name;
  this.partitionId=partitionId;
  this.isOwner=nodeEngine.getPartitionService().isPartitionOwner(partitionId);
  this.nodeEngine=nodeEngine;
  this.partitionService=nodeEngine.getPartitionService();
  this.partitionCount=partitionService.getPartitionCount();
  this.cacheService=cacheService;
  this.cacheConfig=cacheService.getCacheConfig(name);
  this.cacheContext=cacheService.getOrCreateCacheContext(name);
  if (cacheConfig == null) {
    throw new CacheNotExistsException("String_Node_Str" + name + "String_Node_Str"+ nodeEngine.getLocalMember());
  }
  this.wanReplicationEnabled=cacheService.isWanReplicationEnabled(name);
  this.evictionConfig=cacheConfig.getEvictionConfig();
  if (evictionConfig == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (cacheConfig.getCacheLoaderFactory() != null) {
    final Factory<CacheLoader> cacheLoaderFactory=cacheConfig.getCacheLoaderFactory();
    if (cacheLoaderFactory instanceof HazelcastInstanceAware) {
      ((HazelcastInstanceAware)cacheLoaderFactory).setHazelcastInstance(nodeEngine.getHazelcastInstance());
    }
    cacheLoader=cacheLoaderFactory.create();
  }
  if (cacheConfig.getCacheWriterFactory() != null) {
    final Factory<CacheWriter> cacheWriterFactory=cacheConfig.getCacheWriterFactory();
    if (cacheWriterFactory instanceof HazelcastInstanceAware) {
      ((HazelcastInstanceAware)cacheWriterFactory).setHazelcastInstance(nodeEngine.getHazelcastInstance());
    }
    cacheWriter=cacheWriterFactory.create();
  }
  if (cacheConfig.isStatisticsEnabled()) {
    this.statistics=cacheService.createCacheStatIfAbsent(name);
  }
  final Factory<ExpiryPolicy> expiryPolicyFactory=cacheConfig.getExpiryPolicyFactory();
  this.defaultExpiryPolicy=expiryPolicyFactory.create();
  this.records=createRecordCacheMap();
  this.maxSizeChecker=createCacheMaxSizeChecker(evictionConfig.getSize(),evictionConfig.getMaximumSizePolicy());
  this.evictionPolicyEvaluator=createEvictionPolicyEvaluator(evictionConfig);
  this.evictionChecker=createEvictionChecker(evictionConfig);
  this.evictionStrategy=createEvictionStrategy(evictionConfig);
  if (cacheWriter instanceof Closeable) {
    cacheService.addCacheResource(name,(Closeable)cacheWriter);
  }
  if (cacheLoader instanceof Closeable) {
    cacheService.addCacheResource(name,(Closeable)cacheLoader);
  }
  if (defaultExpiryPolicy instanceof Closeable) {
    cacheService.addCacheResource(name,(Closeable)defaultExpiryPolicy);
  }
}

Fixed version (ground truth):
public AbstractCacheRecordStore(final String name,final int partitionId,final NodeEngine nodeEngine,final AbstractCacheService cacheService){
  this.name=name;
  this.partitionId=partitionId;
  this.nodeEngine=nodeEngine;
  this.partitionCount=nodeEngine.getPartitionService().getPartitionCount();
  this.cacheService=cacheService;
  this.cacheConfig=cacheService.getCacheConfig(name);
  this.cacheContext=cacheService.getOrCreateCacheContext(name);
  if (cacheConfig == null) {
    throw new CacheNotExistsException("String_Node_Str" + name + "String_Node_Str"+ nodeEngine.getLocalMember());
  }
  this.wanReplicationEnabled=cacheService.isWanReplicationEnabled(name);
  this.evictionConfig=cacheConfig.getEvictionConfig();
  if (evictionConfig == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (cacheConfig.getCacheLoaderFactory() != null) {
    final Factory<CacheLoader> cacheLoaderFactory=cacheConfig.getCacheLoaderFactory();
    if (cacheLoaderFactory instanceof HazelcastInstanceAware) {
      ((HazelcastInstanceAware)cacheLoaderFactory).setHazelcastInstance(nodeEngine.getHazelcastInstance());
    }
    cacheLoader=cacheLoaderFactory.create();
  }
  if (cacheConfig.getCacheWriterFactory() != null) {
    final Factory<CacheWriter> cacheWriterFactory=cacheConfig.getCacheWriterFactory();
    if (cacheWriterFactory instanceof HazelcastInstanceAware) {
      ((HazelcastInstanceAware)cacheWriterFactory).setHazelcastInstance(nodeEngine.getHazelcastInstance());
    }
    cacheWriter=cacheWriterFactory.create();
  }
  if (cacheConfig.isStatisticsEnabled()) {
    this.statistics=cacheService.createCacheStatIfAbsent(name);
  }
  final Factory<ExpiryPolicy> expiryPolicyFactory=cacheConfig.getExpiryPolicyFactory();
  this.defaultExpiryPolicy=expiryPolicyFactory.create();
  this.records=createRecordCacheMap();
  this.maxSizeChecker=createCacheMaxSizeChecker(evictionConfig.getSize(),evictionConfig.getMaximumSizePolicy());
  this.evictionPolicyEvaluator=createEvictionPolicyEvaluator(evictionConfig);
  this.evictionChecker=createEvictionChecker(evictionConfig);
  this.evictionStrategy=createEvictionStrategy(evictionConfig);
  if (cacheWriter instanceof Closeable) {
    cacheService.addCacheResource(name,(Closeable)cacheWriter);
  }
  if (cacheLoader instanceof Closeable) {
    cacheService.addCacheResource(name,(Closeable)cacheLoader);
  }
  if (defaultExpiryPolicy instanceof Closeable) {
    cacheService.addCacheResource(name,(Closeable)defaultExpiryPolicy);
  }
  init();
}