Program: 17231
Project: 17231
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void put(K key,V value){
  long start=statisticsEnabled() ? System.nanoTime() : 0;
  ensureOpen();
  if (value == null) {
    throw new NullPointerException("String_Node_Str" + key);
  }
  lockManager.lock(key);
  try {
    RICacheEventDispatcher<K,V> dispatcher=new RICacheEventDispatcher<K,V>();
    long now=System.currentTimeMillis();
    Object internalKey=keyConverter.toInternal(key);
    Object internalValue=valueConverter.toInternal(value);
    RICachedValue cachedValue=entries.get(internalKey);
    boolean isExpired=cachedValue != null && cachedValue.isExpiredAt(now);
    if (cachedValue == null || isExpired) {
      RIEntry<K,V> entry=new RIEntry<K,V>(key,value);
      writeCacheEntry(entry);
      if (isExpired) {
        V expiredValue=valueConverter.fromInternal(cachedValue.get());
        dispatcher.addEvent(CacheEntryExpiredListener.class,new RICacheEntryEvent<K,V>(this,key,expiredValue,EXPIRED));
      }
      Duration duration;
      try {
        duration=expiryPolicy.getExpiryForCreatedEntry(key);
      }
 catch (      Throwable t) {
        duration=getDefaultDuration();
      }
      long expiryTime=duration.getAdjustedTime(now);
      cachedValue=new RICachedValue(internalValue,now,expiryTime);
      entries.put(internalKey,cachedValue);
      dispatcher.addEvent(CacheEntryCreatedListener.class,new RICacheEntryEvent<K,V>(this,key,value,EventType.CREATED));
    }
 else {
      V oldValue=valueConverter.fromInternal(cachedValue.get());
      RIEntry<K,V> entry=new RIEntry<K,V>(key,value,oldValue);
      writeCacheEntry(entry);
      try {
        Duration duration=expiryPolicy.getExpiryForModifiedEntry(key);
        if (duration != null) {
          long expiryTime=duration.getAdjustedTime(now);
          cachedValue.setExpiryTime(expiryTime);
        }
      }
 catch (      Throwable t) {
      }
      cachedValue.setInternalValue(internalValue,now);
      dispatcher.addEvent(CacheEntryUpdatedListener.class,new RICacheEntryEvent<K,V>(this,key,value,oldValue,EventType.UPDATED));
    }
    dispatcher.dispatch(listenerRegistrations);
  }
  finally {
    lockManager.unLock(key);
  }
  if (statisticsEnabled()) {
    statistics.increaseCachePuts(1);
    statistics.addPutTimeNano(System.nanoTime() - start);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void put(K key,V value){
  long start=statisticsEnabled() ? System.nanoTime() : 0;
  ensureOpen();
  if (value == null) {
    throw new NullPointerException("String_Node_Str" + key);
  }
  lockManager.lock(key);
  try {
    RICacheEventDispatcher<K,V> dispatcher=new RICacheEventDispatcher<K,V>();
    long now=System.currentTimeMillis();
    Object internalKey=keyConverter.toInternal(key);
    Object internalValue=valueConverter.toInternal(value);
    RICachedValue cachedValue=entries.get(internalKey);
    boolean isExpired=cachedValue != null && cachedValue.isExpiredAt(now);
    if (cachedValue == null || isExpired) {
      RIEntry<K,V> entry=new RIEntry<K,V>(key,value);
      writeCacheEntry(entry);
      if (isExpired) {
        V expiredValue=valueConverter.fromInternal(cachedValue.get());
        dispatcher.addEvent(CacheEntryExpiredListener.class,new RICacheEntryEvent<K,V>(this,key,expiredValue,EXPIRED));
      }
      Duration duration;
      try {
        duration=expiryPolicy.getExpiryForCreation();
      }
 catch (      Throwable t) {
        duration=getDefaultDuration();
      }
      long expiryTime=duration.getAdjustedTime(now);
      cachedValue=new RICachedValue(internalValue,now,expiryTime);
      entries.put(internalKey,cachedValue);
      dispatcher.addEvent(CacheEntryCreatedListener.class,new RICacheEntryEvent<K,V>(this,key,value,EventType.CREATED));
    }
 else {
      V oldValue=valueConverter.fromInternal(cachedValue.get());
      RIEntry<K,V> entry=new RIEntry<K,V>(key,value,oldValue);
      writeCacheEntry(entry);
      try {
        Duration duration=expiryPolicy.getExpiryForUpdate();
        if (duration != null) {
          long expiryTime=duration.getAdjustedTime(now);
          cachedValue.setExpiryTime(expiryTime);
        }
      }
 catch (      Throwable t) {
      }
      cachedValue.setInternalValue(internalValue,now);
      dispatcher.addEvent(CacheEntryUpdatedListener.class,new RICacheEntryEvent<K,V>(this,key,value,oldValue,EventType.UPDATED));
    }
    dispatcher.dispatch(listenerRegistrations);
  }
  finally {
    lockManager.unLock(key);
  }
  if (statisticsEnabled()) {
    statistics.increaseCachePuts(1);
    statistics.addPutTimeNano(System.nanoTime() - start);
  }
}