Program: 17220
Project: 17220
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public <T>T invoke(K key,javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,Object... arguments){
  ensureOpen();
  if (key == null) {
    throw new NullPointerException();
  }
  if (entryProcessor == null) {
    throw new NullPointerException();
  }
  long start=statisticsEnabled() ? System.nanoTime() : 0;
  T result=null;
  lockManager.lock(key);
  try {
    long now=System.currentTimeMillis();
    RICacheEventDispatcher<K,V> dispatcher=new RICacheEventDispatcher<K,V>();
    Object internalKey=keyConverter.toInternal(key);
    RICachedValue cachedValue=entries.get(internalKey);
    if (statisticsEnabled()) {
      if (cachedValue == null) {
        statistics.increaseCacheMisses(1);
      }
 else {
        statistics.increaseCacheHits(1);
      }
    }
    if (statisticsEnabled()) {
      statistics.addGetTimeNano(System.nanoTime() - start);
    }
    start=statisticsEnabled() ? System.nanoTime() : 0;
    EntryProcessorEntry<K,V> entry=new EntryProcessorEntry<>(valueConverter,key,cachedValue,now,dispatcher,configuration.isReadThrough() ? cacheLoader : null);
    try {
      result=entryProcessor.process(entry,arguments);
    }
 catch (    Exception e) {
      if (!(e instanceof EntryProcessorException)) {
        throw new EntryProcessorException(e);
      }
 else {
        throw e;
      }
    }
    Duration duration;
    long expiryTime;
switch (entry.getOperation()) {
case NONE:
      break;
case ACCESS:
    try {
      duration=expiryPolicy.getExpiryForAccess();
      if (duration != null) {
        long expiryTime1=duration.getAdjustedTime(now);
        cachedValue.setExpiryTime(expiryTime1);
      }
    }
 catch (    Throwable t) {
    }
  break;
case CREATE:
case LOAD:
RIEntry<K,V> e=new RIEntry<K,V>(key,entry.getValue());
if (entry.getOperation() == MutableEntryOperation.CREATE) {
writeCacheEntry(e);
}
try {
duration=expiryPolicy.getExpiryForCreation();
}
 catch (Throwable t) {
duration=getDefaultDuration();
}
expiryTime=duration.getAdjustedTime(now);
cachedValue=new RICachedValue(valueConverter.toInternal(entry.getValue()),now,expiryTime);
if (cachedValue.isExpiredAt(now)) {
V previousValue=valueConverter.fromInternal(cachedValue.get());
processExpiries(key,dispatcher,previousValue);
}
 else {
entries.put(internalKey,cachedValue);
dispatcher.addEvent(CacheEntryCreatedListener.class,new RICacheEntryEvent<K,V>(this,key,entry.getValue(),CREATED));
if (statisticsEnabled() && entry.getOperation() == MutableEntryOperation.CREATE) {
statistics.increaseCachePuts(1);
statistics.addPutTimeNano(System.nanoTime() - start);
}
}
break;
case UPDATE:
V oldValue=valueConverter.fromInternal(cachedValue.get());
e=new RIEntry<K,V>(key,entry.getValue(),oldValue);
writeCacheEntry(e);
try {
duration=expiryPolicy.getExpiryForUpdate();
if (duration != null) {
expiryTime=duration.getAdjustedTime(now);
cachedValue.setExpiryTime(expiryTime);
}
}
 catch (Throwable t) {
}
cachedValue.setInternalValue(valueConverter.toInternal(entry.getValue()),now);
dispatcher.addEvent(CacheEntryUpdatedListener.class,new RICacheEntryEvent<K,V>(this,key,entry.getValue(),oldValue,UPDATED));
if (statisticsEnabled()) {
statistics.increaseCachePuts(1);
statistics.addPutTimeNano(System.nanoTime() - start);
}
break;
case REMOVE:
deleteCacheEntry(key);
oldValue=cachedValue == null ? null : valueConverter.fromInternal(cachedValue.get());
entries.remove(internalKey);
dispatcher.addEvent(CacheEntryRemovedListener.class,new RICacheEntryEvent<K,V>(this,key,oldValue,REMOVED));
if (statisticsEnabled()) {
statistics.increaseCacheRemovals(1);
statistics.addRemoveTimeNano(System.nanoTime() - start);
}
break;
default :
break;
}
dispatcher.dispatch(listenerRegistrations);
}
  finally {
lockManager.unLock(key);
}
return result;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public <T>T invoke(K key,javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,Object... arguments){
  ensureOpen();
  if (key == null) {
    throw new NullPointerException();
  }
  if (entryProcessor == null) {
    throw new NullPointerException();
  }
  long start=statisticsEnabled() ? System.nanoTime() : 0;
  T result=null;
  lockManager.lock(key);
  try {
    long now=System.currentTimeMillis();
    RICacheEventDispatcher<K,V> dispatcher=new RICacheEventDispatcher<K,V>();
    Object internalKey=keyConverter.toInternal(key);
    RICachedValue cachedValue=entries.get(internalKey);
    if (statisticsEnabled()) {
      if (cachedValue == null) {
        statistics.increaseCacheMisses(1);
      }
 else {
        statistics.increaseCacheHits(1);
      }
    }
    if (statisticsEnabled()) {
      statistics.addGetTimeNano(System.nanoTime() - start);
    }
    start=statisticsEnabled() ? System.nanoTime() : 0;
    EntryProcessorEntry<K,V> entry=new EntryProcessorEntry<>(valueConverter,key,cachedValue,now,dispatcher,configuration.isReadThrough() ? cacheLoader : null);
    try {
      result=entryProcessor.process(entry,arguments);
    }
 catch (    CacheException e) {
      throw e;
    }
catch (    Exception e) {
      throw new EntryProcessorException(e);
    }
    Duration duration;
    long expiryTime;
switch (entry.getOperation()) {
case NONE:
      break;
case ACCESS:
    try {
      duration=expiryPolicy.getExpiryForAccess();
      if (duration != null) {
        long expiryTime1=duration.getAdjustedTime(now);
        cachedValue.setExpiryTime(expiryTime1);
      }
    }
 catch (    Throwable t) {
    }
  break;
case CREATE:
case LOAD:
RIEntry<K,V> e=new RIEntry<K,V>(key,entry.getValue());
if (entry.getOperation() == MutableEntryOperation.CREATE) {
writeCacheEntry(e);
}
try {
duration=expiryPolicy.getExpiryForCreation();
}
 catch (Throwable t) {
duration=getDefaultDuration();
}
expiryTime=duration.getAdjustedTime(now);
cachedValue=new RICachedValue(valueConverter.toInternal(entry.getValue()),now,expiryTime);
if (cachedValue.isExpiredAt(now)) {
V previousValue=valueConverter.fromInternal(cachedValue.get());
processExpiries(key,dispatcher,previousValue);
}
 else {
entries.put(internalKey,cachedValue);
dispatcher.addEvent(CacheEntryCreatedListener.class,new RICacheEntryEvent<K,V>(this,key,entry.getValue(),CREATED));
if (statisticsEnabled() && entry.getOperation() == MutableEntryOperation.CREATE) {
statistics.increaseCachePuts(1);
statistics.addPutTimeNano(System.nanoTime() - start);
}
}
break;
case UPDATE:
V oldValue=valueConverter.fromInternal(cachedValue.get());
e=new RIEntry<K,V>(key,entry.getValue(),oldValue);
writeCacheEntry(e);
try {
duration=expiryPolicy.getExpiryForUpdate();
if (duration != null) {
expiryTime=duration.getAdjustedTime(now);
cachedValue.setExpiryTime(expiryTime);
}
}
 catch (Throwable t) {
}
cachedValue.setInternalValue(valueConverter.toInternal(entry.getValue()),now);
dispatcher.addEvent(CacheEntryUpdatedListener.class,new RICacheEntryEvent<K,V>(this,key,entry.getValue(),oldValue,UPDATED));
if (statisticsEnabled()) {
statistics.increaseCachePuts(1);
statistics.addPutTimeNano(System.nanoTime() - start);
}
break;
case REMOVE:
deleteCacheEntry(key);
oldValue=cachedValue == null ? null : valueConverter.fromInternal(cachedValue.get());
entries.remove(internalKey);
dispatcher.addEvent(CacheEntryRemovedListener.class,new RICacheEntryEvent<K,V>(this,key,oldValue,REMOVED));
if (statisticsEnabled()) {
statistics.increaseCacheRemovals(1);
statistics.addRemoveTimeNano(System.nanoTime() - start);
}
break;
default :
break;
}
dispatcher.dispatch(listenerRegistrations);
}
  finally {
lockManager.unLock(key);
}
return result;
}