Program: 17313
Project: 17313
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean putIfAbsent(K key,V value){
  checkStatusStarted();
  if (value == null) {
    throw new NullPointerException("String_Node_Str" + key);
  }
  long start=statisticsEnabled() ? System.nanoTime() : 0;
  long now=System.currentTimeMillis();
  boolean result;
  lockManager.lock(key);
  try {
    RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
    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 || cachedValue.isExpiredAt(now)) {
      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));
      }
      Duration duration;
      try {
        duration=expiryPolicy.getTTLForCreatedEntry(entry);
      }
 catch (      Throwable t) {
        duration=getDefaultDuration();
      }
      long expiryTime=duration.getAdjustedTime(now);
      cachedValue=new RICachedValue(internalValue,now,expiryTime);
      entries.put(internalKey,cachedValue);
      result=true;
      dispatcher.addEvent(CacheEntryCreatedListener.class,new RICacheEntryEvent<K,V>(this,key,value));
    }
 else {
      result=false;
    }
    dispatcher.dispatch(cacheEntryListenerRegistrations.values());
  }
  finally {
    lockManager.unLock(key);
  }
  if (result && statisticsEnabled()) {
    statistics.increaseCachePuts(1);
    statistics.addPutTimeNano(System.nanoTime() - start);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean putIfAbsent(K key,V value){
  ensureOpen();
  if (value == null) {
    throw new NullPointerException("String_Node_Str" + key);
  }
  long start=statisticsEnabled() ? System.nanoTime() : 0;
  long now=System.currentTimeMillis();
  boolean result;
  lockManager.lock(key);
  try {
    RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
    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 || cachedValue.isExpiredAt(now)) {
      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));
      }
      Duration duration;
      try {
        duration=expiryPolicy.getTTLForCreatedEntry(entry);
      }
 catch (      Throwable t) {
        duration=getDefaultDuration();
      }
      long expiryTime=duration.getAdjustedTime(now);
      cachedValue=new RICachedValue(internalValue,now,expiryTime);
      entries.put(internalKey,cachedValue);
      result=true;
      dispatcher.addEvent(CacheEntryCreatedListener.class,new RICacheEntryEvent<K,V>(this,key,value));
    }
 else {
      result=false;
    }
    dispatcher.dispatch(cacheEntryListenerRegistrations.values());
  }
  finally {
    lockManager.unLock(key);
  }
  if (result && statisticsEnabled()) {
    statistics.increaseCachePuts(1);
    statistics.addPutTimeNano(System.nanoTime() - start);
  }
  return result;
}