nus-yam/ex-repair huggingface dataset:
Program: 17270
Project: 17270
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public V getValue(){
  if (operation == MutableEntryOperation.NONE) {
    if (cachedValue == null || cachedValue.isExpiredAt(now)) {
      value=null;
    }
 else     if (value == null) {
      Object internalValue=cachedValue.getInternalValue(now);
      value=internalValue == null ? null : (V)RICache.this.valueConverter.fromInternal(internalValue);
      if (value != null) {
        dispatcher.addEvent(CacheEntryReadListener.class,new RICacheEntryEvent<K,V>(RICache.this,key,value));
      }
    }
  }
  return value;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public V getValue(){
  if (operation == MutableEntryOperation.NONE) {
    if (cachedValue == null || cachedValue.isExpiredAt(now)) {
      value=null;
    }
 else     if (value == null) {
      Object internalValue=cachedValue.getInternalValue(now);
      value=internalValue == null ? null : (V)RICache.this.valueConverter.fromInternal(internalValue);
    }
  }
  return value;
}
Program: 17273
Project: 17273
Buggy source:
/** 
 * Returns the key of the cache entry with the event
 * @return the key
 */
@Override public K getKey(){
  return key;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public K getKey(){
  return key;
}
Program: 17274
Project: 17274
Buggy source:
/** 
 * Returns the value of the cache entry with the event
 * @return the value
 */
@Override public V getValue(){
  return value;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public V getValue(){
  return value;
}
Program: 17275
Project: 17275
Buggy source:
/** 
 * Whether the old value is available
 * @return true if the old value is populated
 */
@Override public boolean isOldValueAvailable(){
  return oldValueAvailable;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean isOldValueAvailable(){
  return oldValueAvailable;
}
Program: 17276
Project: 17276
Buggy source:
/** 
 * Returns the value of the cache entry with the event
 * @return the value
 * @throws UnsupportedOperationException if the old value is not available
 */
@Override public V getOldValue() throws UnsupportedOperationException {
  if (isOldValueAvailable()) {
    return oldValue;
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public V getOldValue() throws UnsupportedOperationException {
  if (isOldValueAvailable()) {
    return oldValue;
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str");
  }
}
Program: 17278
Project: 17278
Buggy source:
/** 
 * Lookup the Cache, generate a CacheKey and store the value in the cache.
 * @param cacheKeyInvocationContext The invocation context 
 * @param methodDetails The details about the cached method
 * @param value The value to cache
 */
protected void cacheValue(final InternalCacheKeyInvocationContext<? extends Annotation> cacheKeyInvocationContext,final CachePutMethodDetails methodDetails,final Object value){
  final Object cachedValue;
  if (value == null) {
    if (methodDetails.getCacheAnnotation().cacheNull()) {
      cachedValue=CacheContextSource.NULL_PLACEHOLDER;
    }
 else {
      return;
    }
  }
 else {
    cachedValue=value;
  }
  final CacheResolver cacheResolver=methodDetails.getCacheResolver();
  final Cache<Object,Object> cache=cacheResolver.resolveCache(cacheKeyInvocationContext);
  final CacheKeyGenerator cacheKeyGenerator=methodDetails.getCacheKeyGenerator();
  final CacheKey cacheKey=cacheKeyGenerator.generateCacheKey(cacheKeyInvocationContext);
  cache.put(cacheKey,cachedValue);
}

Fixed version (ground truth):
/** 
 * Lookup the Cache, generate a GeneratedCacheKey and store the value in the cache.
 * @param cacheKeyInvocationContext The invocation context 
 * @param methodDetails The details about the cached method
 * @param value The value to cache
 */
protected void cacheValue(final InternalCacheKeyInvocationContext<? extends Annotation> cacheKeyInvocationContext,final CachePutMethodDetails methodDetails,final Object value){
  final Object cachedValue;
  if (value == null) {
    if (methodDetails.getCacheAnnotation().cacheNull()) {
      cachedValue=CacheContextSource.NULL_PLACEHOLDER;
    }
 else {
      return;
    }
  }
 else {
    cachedValue=value;
  }
  final CacheResolver cacheResolver=methodDetails.getCacheResolver();
  final Cache<Object,Object> cache=cacheResolver.resolveCache(cacheKeyInvocationContext);
  final CacheKeyGenerator cacheKeyGenerator=methodDetails.getCacheKeyGenerator();
  final GeneratedCacheKey cacheKey=cacheKeyGenerator.generateCacheKey(cacheKeyInvocationContext);
  cache.put(cacheKey,cachedValue);
}
Program: 17279
Project: 17279
Buggy source:
/** 
 * Remove entry from cache
 * @param cacheKeyInvocationContext The invocation context 
 * @param methodDetails The details about the cached method
 */
private void cacheRemove(final InternalCacheKeyInvocationContext<? extends Annotation> cacheKeyInvocationContext,final CacheRemoveEntryMethodDetails methodDetails){
  final CacheResolver cacheResolver=methodDetails.getCacheResolver();
  final Cache<Object,Object> cache=cacheResolver.resolveCache(cacheKeyInvocationContext);
  final CacheKeyGenerator cacheKeyGenerator=methodDetails.getCacheKeyGenerator();
  final CacheKey cacheKey=cacheKeyGenerator.generateCacheKey(cacheKeyInvocationContext);
  cache.remove(cacheKey);
}

Fixed version (ground truth):
/** 
 * Remove entry from cache
 * @param cacheKeyInvocationContext The invocation context 
 * @param methodDetails The details about the cached method
 */
private void cacheRemove(final InternalCacheKeyInvocationContext<? extends Annotation> cacheKeyInvocationContext,final CacheRemoveEntryMethodDetails methodDetails){
  final CacheResolver cacheResolver=methodDetails.getCacheResolver();
  final Cache<Object,Object> cache=cacheResolver.resolveCache(cacheKeyInvocationContext);
  final CacheKeyGenerator cacheKeyGenerator=methodDetails.getCacheKeyGenerator();
  final GeneratedCacheKey cacheKey=cacheKeyGenerator.generateCacheKey(cacheKeyInvocationContext);
  cache.remove(cacheKey);
}
Program: 17281
Project: 17281
Buggy source:
/** 
 * Cache the exception if exception caching is enabled. 
 * @param exceptionCache The exception cache, may be null if no exception caching is being done
 * @param cacheKey The cache key
 * @param cacheResultAnnotation The cache result annotation
 * @param t The exception to cache
 */
protected void cacheException(final Cache<Object,Throwable> exceptionCache,final CacheKey cacheKey,final CacheResult cacheResultAnnotation,Throwable t){
  if (exceptionCache == null) {
    return;
  }
  final Class<? extends Throwable>[] cachedExceptions=cacheResultAnnotation.cachedExceptions();
  final Class<? extends Throwable>[] nonCachedExceptions=cacheResultAnnotation.nonCachedExceptions();
  final boolean included=ClassFilter.isIncluded(t,cachedExceptions,nonCachedExceptions,true);
  if (included) {
    exceptionCache.put(cacheKey,t);
  }
}

Fixed version (ground truth):
/** 
 * Cache the exception if exception caching is enabled. 
 * @param exceptionCache The exception cache, may be null if no exception caching is being done
 * @param cacheKey The cache key
 * @param cacheResultAnnotation The cache result annotation
 * @param t The exception to cache
 */
protected void cacheException(final Cache<Object,Throwable> exceptionCache,final GeneratedCacheKey cacheKey,final CacheResult cacheResultAnnotation,Throwable t){
  if (exceptionCache == null) {
    return;
  }
  final Class<? extends Throwable>[] cachedExceptions=cacheResultAnnotation.cachedExceptions();
  final Class<? extends Throwable>[] nonCachedExceptions=cacheResultAnnotation.nonCachedExceptions();
  final boolean included=ClassFilter.isIncluded(t,cachedExceptions,nonCachedExceptions,true);
  if (included) {
    exceptionCache.put(cacheKey,t);
  }
}
Program: 17282
Project: 17282
Buggy source:
/** 
 * Check to see if there is a cached exception that needs to be re-thrown
 * @param exceptionCache The exception cache, may be null if no exception caching is being done
 * @param cacheKey The cache key
 * @throws Throwable The cached exception
 */
protected void checkForCachedException(final Cache<Object,Throwable> exceptionCache,final CacheKey cacheKey) throws Throwable {
  if (exceptionCache == null) {
    return;
  }
  final Throwable throwable=exceptionCache.get(cacheKey);
  if (throwable != null) {
    throw throwable;
  }
}

Fixed version (ground truth):
/** 
 * Check to see if there is a cached exception that needs to be re-thrown
 * @param exceptionCache The exception cache, may be null if no exception caching is being done
 * @param cacheKey The cache key
 * @throws Throwable The cached exception
 */
protected void checkForCachedException(final Cache<Object,Throwable> exceptionCache,final GeneratedCacheKey cacheKey) throws Throwable {
  if (exceptionCache == null) {
    return;
  }
  final Throwable throwable=exceptionCache.get(cacheKey);
  if (throwable != null) {
    throw throwable;
  }
}
Program: 17283
Project: 17283
Buggy source:
@Override public CacheKey generateCacheKey(CacheKeyInvocationContext<? extends Annotation> cacheKeyInvocationContext){
  final CacheInvocationParameter[] keyParameters=cacheKeyInvocationContext.getKeyParameters();
  final Object[] parameters=new Object[keyParameters.length];
  for (int index=0; index < keyParameters.length; index++) {
    parameters[index]=keyParameters[index].getValue();
  }
  return new DefaultCacheKey(parameters);
}

Fixed version (ground truth):
@Override public GeneratedCacheKey generateCacheKey(CacheKeyInvocationContext<? extends Annotation> cacheKeyInvocationContext){
  final CacheInvocationParameter[] keyParameters=cacheKeyInvocationContext.getKeyParameters();
  final Object[] parameters=new Object[keyParameters.length];
  for (int index=0; index < keyParameters.length; index++) {
    parameters[index]=keyParameters[index].getValue();
  }
  return new DefaultGeneratedCacheKey(parameters);
}
Program: 17284
Project: 17284
Buggy source:
@Override public void run(){
  try {
    ArrayList<K> keysToLoad=new ArrayList<K>();
    for (    K key : keys) {
      if (!containsKey(key)) {
        keysToLoad.add(key);
      }
    }
    Map<? extends K,? extends V> loaded=cacheLoader.loadAll(keysToLoad);
    putAll(loaded);
    if (listener != null) {
      listener.onCompletion();
    }
  }
 catch (  Exception e) {
    if (listener != null) {
      listener.onException(e);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    ArrayList<K> keysToLoad=new ArrayList<K>();
    for (    K key : keys) {
      if (!containsKey(key)) {
        keysToLoad.add(key);
      }
    }
    Map<? extends K,? extends V> loaded=cacheLoader.loadAll(keysToLoad);
    putAll(loaded,replaceExistingValues);
    if (listener != null) {
      listener.onCompletion();
    }
  }
 catch (  Exception e) {
    if (listener != null) {
      listener.onException(e);
    }
  }
}
Program: 17285
Project: 17285
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void loadAll(final Iterable<? extends K> keys,final CompletionListener listener){
  checkStatusStarted();
  if (keys == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (cacheLoader == null) {
    if (listener != null) {
      listener.onCompletion();
    }
  }
 else {
    executorService.submit(new Runnable(){
      @Override public void run(){
        try {
          ArrayList<K> keysToLoad=new ArrayList<K>();
          for (          K key : keys) {
            if (!containsKey(key)) {
              keysToLoad.add(key);
            }
          }
          Map<? extends K,? extends V> loaded=cacheLoader.loadAll(keysToLoad);
          putAll(loaded);
          if (listener != null) {
            listener.onCompletion();
          }
        }
 catch (        Exception e) {
          if (listener != null) {
            listener.onException(e);
          }
        }
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void loadAll(final Iterable<? extends K> keys,final boolean replaceExistingValues,final CompletionListener listener){
  checkStatusStarted();
  if (keys == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (cacheLoader == null) {
    if (listener != null) {
      listener.onCompletion();
    }
  }
 else {
    executorService.submit(new Runnable(){
      @Override public void run(){
        try {
          ArrayList<K> keysToLoad=new ArrayList<K>();
          for (          K key : keys) {
            if (!containsKey(key)) {
              keysToLoad.add(key);
            }
          }
          Map<? extends K,? extends V> loaded=cacheLoader.loadAll(keysToLoad);
          putAll(loaded,replaceExistingValues);
          if (listener != null) {
            listener.onCompletion();
          }
        }
 catch (        Exception e) {
          if (listener != null) {
            listener.onException(e);
          }
        }
      }
    }
);
  }
}
Program: 17287
Project: 17287
Buggy source:
@Override public <T>T unwrap(java.lang.Class<T> cls){
  if (cls.isAssignableFrom(this.getClass())) {
    return cls.cast(this);
  }
  throw new IllegalArgumentException("String_Node_Str" + cls + "String_Node_Str");
}

Fixed version (ground truth):
@Override public <T>T unwrap(java.lang.Class<T> cls){
  if (cls.isAssignableFrom(((Object)this).getClass())) {
    return cls.cast(this);
  }
  throw new IllegalArgumentException("String_Node_Str" + cls + "String_Node_Str");
}
Program: 17289
Project: 17289
Buggy source:
/** 
 * Writes the Cache Entry to the configured CacheWriter.  Does nothing if write-through is not configured.
 * @param entry the Cache Entry to write
 */
private void writeCacheEntry(RIEntry<K,V> entry){
  if (configuration.isWriteThrough()) {
    configuration.getCacheWriter().write(entry);
  }
}

Fixed version (ground truth):
/** 
 * Writes the Cache Entry to the configured CacheWriter.  Does nothing if write-through is not configured.
 * @param entry the Cache Entry to write
 */
private void writeCacheEntry(RIEntry<K,V> entry){
  if (configuration.isWriteThrough()) {
    cacheWriter.write(entry);
  }
}
Program: 17291
Project: 17291
Buggy source:
/** 
 * Deletes the Cache Entry using the configued CacheWriter.  Does nothing if write-through is not configued.
 * @param key
 */
private void deleteCacheEntry(K key){
  if (configuration.isWriteThrough()) {
    configuration.getCacheWriter().delete(key);
  }
}

Fixed version (ground truth):
/** 
 * Deletes the Cache Entry using the configued CacheWriter.  Does nothing if write-through is not configued.
 * @param key
 */
private void deleteCacheEntry(K key){
  if (configuration.isWriteThrough()) {
    cacheWriter.delete(key);
  }
}
Program: 17292
Project: 17292
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void loadAll(final Iterable<? extends K> keys,final CompletionListener listener){
  checkStatusStarted();
  if (keys == null) {
    throw new NullPointerException("String_Node_Str");
  }
  final CacheLoader<K,? extends V> cacheLoader=configuration.getCacheLoader();
  if (cacheLoader == null) {
    if (listener != null) {
      listener.onCompletion();
    }
  }
 else {
    executorService.submit(new Runnable(){
      @Override public void run(){
        try {
          ArrayList<K> keysToLoad=new ArrayList<K>();
          for (          K key : keys) {
            if (!containsKey(key)) {
              keysToLoad.add(key);
            }
          }
          Map<? extends K,? extends V> loaded=cacheLoader.loadAll(keysToLoad);
          putAll(loaded);
          if (listener != null) {
            listener.onCompletion();
          }
        }
 catch (        Exception e) {
          if (listener != null) {
            listener.onException(e);
          }
        }
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void loadAll(final Iterable<? extends K> keys,final CompletionListener listener){
  checkStatusStarted();
  if (keys == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (cacheLoader == null) {
    if (listener != null) {
      listener.onCompletion();
    }
  }
 else {
    executorService.submit(new Runnable(){
      @Override public void run(){
        try {
          ArrayList<K> keysToLoad=new ArrayList<K>();
          for (          K key : keys) {
            if (!containsKey(key)) {
              keysToLoad.add(key);
            }
          }
          Map<? extends K,? extends V> loaded=cacheLoader.loadAll(keysToLoad);
          putAll(loaded);
          if (listener != null) {
            listener.onCompletion();
          }
        }
 catch (        Exception e) {
          if (listener != null) {
            listener.onException(e);
          }
        }
      }
    }
);
  }
}
Program: 17294
Project: 17294
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  RIEntry<?,?> e2=(RIEntry<?,?>)o;
  return this.getKey().equals(e2.getKey()) && this.getValue().equals(e2.getValue());
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || ((Object)this).getClass() != o.getClass())   return false;
  RIEntry<?,?> e2=(RIEntry<?,?>)o;
  return this.getKey().equals(e2.getKey()) && this.getValue().equals(e2.getValue());
}
Program: 17295
Project: 17295
Buggy source:
/** 
 * A copy-constructor for a   {@link RIConfiguration}.
 * @param configuration  the {@link javax.cache.Configuration} from which to copy
 */
public RIConfiguration(Configuration<K,V> configuration){
  this(configuration.getCacheEntryListenerRegistrations(),configuration.getCacheLoader(),configuration.getCacheWriter(),configuration.getExpiryPolicy(),configuration.isReadThrough(),configuration.isWriteThrough(),configuration.isStatisticsEnabled(),configuration.isManagementEnabled(),configuration.isStoreByValue(),configuration.isTransactionsEnabled(),configuration.getTransactionIsolationLevel(),configuration.getTransactionMode());
}

Fixed version (ground truth):
/** 
 * A copy-constructor for a   {@link RIConfiguration}.
 * @param configuration  the {@link javax.cache.Configuration} from which to copy
 */
public RIConfiguration(Configuration<K,V> configuration){
  this(configuration.getCacheEntryListenerRegistrations(),configuration.getCacheLoaderFactory(),configuration.getCacheWriterFactory(),configuration.getExpiryPolicyFactory(),configuration.isReadThrough(),configuration.isWriteThrough(),configuration.isStatisticsEnabled(),configuration.isManagementEnabled(),configuration.isStoreByValue(),configuration.isTransactionsEnabled(),configuration.getTransactionIsolationLevel(),configuration.getTransactionMode());
}
Program: 17296
Project: 17296
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((cacheEntryListenerRegistrations == null) ? 0 : cacheEntryListenerRegistrations.hashCode());
  result=prime * result + ((cacheLoader == null) ? 0 : cacheLoader.hashCode());
  result=prime * result + ((cacheWriter == null) ? 0 : cacheWriter.hashCode());
  result=prime * result + ((expiryPolicy == null) ? 0 : expiryPolicy.hashCode());
  result=prime * result + (isReadThrough ? 1231 : 1237);
  result=prime * result + (isStatisticsEnabled() ? 1231 : 1237);
  result=prime * result + (isStoreByValue ? 1231 : 1237);
  result=prime * result + (isWriteThrough ? 1231 : 1237);
  result=prime * result + ((txnIsolationLevel == null) ? 0 : txnIsolationLevel.hashCode());
  result=prime * result + ((txnMode == null) ? 0 : txnMode.hashCode());
  return result;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((cacheEntryListenerRegistrations == null) ? 0 : cacheEntryListenerRegistrations.hashCode());
  result=prime * result + ((cacheLoaderFactory == null) ? 0 : cacheLoaderFactory.hashCode());
  result=prime * result + ((cacheWriterFactory == null) ? 0 : cacheWriterFactory.hashCode());
  result=prime * result + ((expiryPolicyFactory == null) ? 0 : expiryPolicyFactory.hashCode());
  result=prime * result + (isReadThrough ? 1231 : 1237);
  result=prime * result + (isStatisticsEnabled() ? 1231 : 1237);
  result=prime * result + (isStoreByValue ? 1231 : 1237);
  result=prime * result + (isWriteThrough ? 1231 : 1237);
  result=prime * result + ((txnIsolationLevel == null) ? 0 : txnIsolationLevel.hashCode());
  result=prime * result + ((txnMode == null) ? 0 : txnMode.hashCode());
  return result;
}
Program: 17298
Project: 17298
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean replace(K key,V value){
  checkStatusStarted();
  if (value == null) {
    throw new NullPointerException("String_Node_Str" + key);
  }
  long now=System.currentTimeMillis();
  boolean result;
  lockManager.lock(key);
  try {
    Object internalKey=keyConverter.toInternal(key);
    RICachedValue cachedValue=entries.get(internalKey);
    if (cachedValue == null || cachedValue.isExpiredAt(now)) {
      result=false;
    }
 else {
      RIEntry<K,V> entry=new RIEntry<K,V>(key,value);
      writeCacheEntry(entry);
      V previousValue=valueConverter.fromInternal(cachedValue.get());
      try {
        Duration duration=expiryPolicy.getTTLForModifiedEntry(entry,new Duration(now,cachedValue.getExpiryTime()));
        long expiryTime=duration.getAdjustedTime(now);
        cachedValue.setExpiryTime(expiryTime);
      }
 catch (      Throwable t) {
      }
      Object internalValue=valueConverter.toInternal(value);
      cachedValue.setInternalValue(internalValue,now);
      RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
      dispatcher.addEvent(CacheEntryUpdatedListener.class,new RICacheEntryEvent<K,V>(this,key,value,previousValue));
      dispatcher.dispatch(cacheEntryListenerRegistrations.values());
      result=true;
    }
  }
  finally {
    lockManager.unLock(key);
  }
  if (result && statisticsEnabled()) {
    statistics.increaseCachePuts(1);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean replace(K key,V value){
  ensureOpen();
  if (value == null) {
    throw new NullPointerException("String_Node_Str" + key);
  }
  long now=System.currentTimeMillis();
  boolean result;
  lockManager.lock(key);
  try {
    Object internalKey=keyConverter.toInternal(key);
    RICachedValue cachedValue=entries.get(internalKey);
    if (cachedValue == null || cachedValue.isExpiredAt(now)) {
      result=false;
    }
 else {
      RIEntry<K,V> entry=new RIEntry<K,V>(key,value);
      writeCacheEntry(entry);
      V previousValue=valueConverter.fromInternal(cachedValue.get());
      try {
        Duration duration=expiryPolicy.getTTLForModifiedEntry(entry,new Duration(now,cachedValue.getExpiryTime()));
        long expiryTime=duration.getAdjustedTime(now);
        cachedValue.setExpiryTime(expiryTime);
      }
 catch (      Throwable t) {
      }
      Object internalValue=valueConverter.toInternal(value);
      cachedValue.setInternalValue(internalValue,now);
      RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
      dispatcher.addEvent(CacheEntryUpdatedListener.class,new RICacheEntryEvent<K,V>(this,key,value,previousValue));
      dispatcher.dispatch(cacheEntryListenerRegistrations.values());
      result=true;
    }
  }
  finally {
    lockManager.unLock(key);
  }
  if (result && statisticsEnabled()) {
    statistics.increaseCachePuts(1);
  }
  return result;
}
Program: 17302
Project: 17302
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Iterator<Entry<K,V>> iterator(){
  checkStatusStarted();
  long now=System.currentTimeMillis();
  return new RIEntryIterator(entries.iterator(),now);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Iterator<Entry<K,V>> iterator(){
  ensureOpen();
  long now=System.currentTimeMillis();
  return new RIEntryIterator(entries.iterator(),now);
}
Program: 17304
Project: 17304
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean containsKey(K key){
  checkStatusStarted();
  if (key == null) {
    throw new NullPointerException();
  }
  long now=System.currentTimeMillis();
  lockManager.lock(key);
  try {
    Object internalKey=keyConverter.toInternal(key);
    RICachedValue cachedValue=entries.get(internalKey);
    return cachedValue != null && !cachedValue.isExpiredAt(now);
  }
  finally {
    lockManager.unLock(key);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean containsKey(K key){
  ensureOpen();
  if (key == null) {
    throw new NullPointerException();
  }
  long now=System.currentTimeMillis();
  lockManager.lock(key);
  try {
    Object internalKey=keyConverter.toInternal(key);
    RICachedValue cachedValue=entries.get(internalKey);
    return cachedValue != null && !cachedValue.isExpiredAt(now);
  }
  finally {
    lockManager.unLock(key);
  }
}
Program: 17306
Project: 17306
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public V getAndRemove(K key){
  checkStatusStarted();
  long now=System.currentTimeMillis();
  V result;
  lockManager.lock(key);
  try {
    deleteCacheEntry(key);
    Object internalKey=keyConverter.toInternal(key);
    RICachedValue cachedValue=entries.get(internalKey);
    if (cachedValue == null || cachedValue.isExpiredAt(now)) {
      result=null;
    }
 else {
      entries.remove(internalKey);
      result=valueConverter.fromInternal(cachedValue.getInternalValue(now));
      CacheEntryEvent<K,V> event=new RICacheEntryEvent<K,V>(this,key,result);
      RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
      dispatcher.addEvent(CacheEntryRemovedListener.class,event);
      dispatcher.dispatch(cacheEntryListenerRegistrations.values());
    }
  }
  finally {
    lockManager.unLock(key);
  }
  if (statisticsEnabled()) {
    if (result != null) {
      statistics.increaseCacheHits(1);
      statistics.increaseCacheRemovals(1);
    }
 else {
      statistics.increaseCacheMisses(1);
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public V getAndRemove(K key){
  ensureOpen();
  long now=System.currentTimeMillis();
  V result;
  lockManager.lock(key);
  try {
    deleteCacheEntry(key);
    Object internalKey=keyConverter.toInternal(key);
    RICachedValue cachedValue=entries.get(internalKey);
    if (cachedValue == null || cachedValue.isExpiredAt(now)) {
      result=null;
    }
 else {
      entries.remove(internalKey);
      result=valueConverter.fromInternal(cachedValue.getInternalValue(now));
      CacheEntryEvent<K,V> event=new RICacheEntryEvent<K,V>(this,key,result);
      RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
      dispatcher.addEvent(CacheEntryRemovedListener.class,event);
      dispatcher.dispatch(cacheEntryListenerRegistrations.values());
    }
  }
  finally {
    lockManager.unLock(key);
  }
  if (statisticsEnabled()) {
    if (result != null) {
      statistics.increaseCacheHits(1);
      statistics.increaseCacheRemovals(1);
    }
 else {
      statistics.increaseCacheMisses(1);
    }
  }
  return result;
}
Program: 17307
Project: 17307
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void loadAll(final Iterable<? extends K> keys,final boolean replaceExistingValues,final CompletionListener listener){
  checkStatusStarted();
  if (keys == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (cacheLoader == null) {
    if (listener != null) {
      listener.onCompletion();
    }
  }
 else {
    executorService.submit(new Runnable(){
      @Override public void run(){
        try {
          ArrayList<K> keysToLoad=new ArrayList<K>();
          for (          K key : keys) {
            if (!containsKey(key)) {
              keysToLoad.add(key);
            }
          }
          Map<? extends K,? extends V> loaded=cacheLoader.loadAll(keysToLoad);
          putAll(loaded,replaceExistingValues);
          if (listener != null) {
            listener.onCompletion();
          }
        }
 catch (        Exception e) {
          if (listener != null) {
            listener.onException(e);
          }
        }
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void loadAll(final Iterable<? extends K> keys,final boolean replaceExistingValues,final CompletionListener listener){
  ensureOpen();
  if (keys == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (cacheLoader == null) {
    if (listener != null) {
      listener.onCompletion();
    }
  }
 else {
    executorService.submit(new Runnable(){
      @Override public void run(){
        try {
          ArrayList<K> keysToLoad=new ArrayList<K>();
          for (          K key : keys) {
            if (!containsKey(key)) {
              keysToLoad.add(key);
            }
          }
          Map<? extends K,? extends V> loaded=cacheLoader.loadAll(keysToLoad);
          putAll(loaded,replaceExistingValues);
          if (listener != null) {
            listener.onCompletion();
          }
        }
 catch (        Exception e) {
          if (listener != null) {
            listener.onException(e);
          }
        }
      }
    }
);
  }
}
Program: 17308
Project: 17308
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public V get(K key){
  checkStatusStarted();
  if (key == null) {
    throw new NullPointerException();
  }
  RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
  V value=getValue(key,dispatcher);
  dispatcher.dispatch(cacheEntryListenerRegistrations.values());
  return value;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public V get(K key){
  ensureOpen();
  if (key == null) {
    throw new NullPointerException();
  }
  RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
  V value=getValue(key,dispatcher);
  dispatcher.dispatch(cacheEntryListenerRegistrations.values());
  return value;
}
Program: 17310
Project: 17310
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Map<K,V> getAll(Set<? extends K> keys){
  checkStatusStarted();
  if (keys.contains(null)) {
    throw new NullPointerException("String_Node_Str");
  }
  HashMap<K,V> map=new HashMap<K,V>(keys.size());
  RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
  for (  K key : keys) {
    V value=getValue(key,dispatcher);
    if (value != null) {
      map.put(key,value);
    }
  }
  dispatcher.dispatch(cacheEntryListenerRegistrations.values());
  return map;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Map<K,V> getAll(Set<? extends K> keys){
  ensureOpen();
  if (keys.contains(null)) {
    throw new NullPointerException("String_Node_Str");
  }
  HashMap<K,V> map=new HashMap<K,V>(keys.size());
  RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
  for (  K key : keys) {
    V value=getValue(key,dispatcher);
    if (value != null) {
      map.put(key,value);
    }
  }
  dispatcher.dispatch(cacheEntryListenerRegistrations.values());
  return map;
}
Program: 17311
Project: 17311
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void clear(){
  checkStatusStarted();
  Iterator<Map.Entry<Object,RICachedValue>> iterator=entries.iterator();
  while (iterator.hasNext()) {
    Map.Entry<Object,RICachedValue> entry=iterator.next();
    Object internalKey=entry.getKey();
    K key=keyConverter.fromInternal(internalKey);
    lockManager.lock(key);
    try {
      iterator.remove();
    }
  finally {
      lockManager.unLock(key);
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void clear(){
  ensureOpen();
  Iterator<Map.Entry<Object,RICachedValue>> iterator=entries.iterator();
  while (iterator.hasNext()) {
    Map.Entry<Object,RICachedValue> entry=iterator.next();
    Object internalKey=entry.getKey();
    K key=keyConverter.fromInternal(internalKey);
    lockManager.lock(key);
    try {
      iterator.remove();
    }
  finally {
      lockManager.unLock(key);
    }
  }
}
Program: 17314
Project: 17314
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean replace(K key,V value){
  ensureOpen();
  if (value == null) {
    throw new NullPointerException("String_Node_Str" + key);
  }
  long now=System.currentTimeMillis();
  boolean result;
  lockManager.lock(key);
  try {
    Object internalKey=keyConverter.toInternal(key);
    RICachedValue cachedValue=entries.get(internalKey);
    if (cachedValue == null || cachedValue.isExpiredAt(now)) {
      result=false;
    }
 else {
      RIEntry<K,V> entry=new RIEntry<K,V>(key,value);
      writeCacheEntry(entry);
      V previousValue=valueConverter.fromInternal(cachedValue.get());
      try {
        Duration duration=expiryPolicy.getTTLForModifiedEntry(entry,new Duration(now,cachedValue.getExpiryTime()));
        long expiryTime=duration.getAdjustedTime(now);
        cachedValue.setExpiryTime(expiryTime);
      }
 catch (      Throwable t) {
      }
      Object internalValue=valueConverter.toInternal(value);
      cachedValue.setInternalValue(internalValue,now);
      RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
      dispatcher.addEvent(CacheEntryUpdatedListener.class,new RICacheEntryEvent<K,V>(this,key,value,previousValue));
      dispatcher.dispatch(cacheEntryListenerRegistrations.values());
      result=true;
    }
  }
  finally {
    lockManager.unLock(key);
  }
  if (result && statisticsEnabled()) {
    statistics.increaseCachePuts(1);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean replace(K key,V value){
  ensureOpen();
  if (value == null) {
    throw new NullPointerException("String_Node_Str" + key);
  }
  long now=System.currentTimeMillis();
  boolean result;
  lockManager.lock(key);
  try {
    Object internalKey=keyConverter.toInternal(key);
    RICachedValue cachedValue=entries.get(internalKey);
    if (cachedValue == null || cachedValue.isExpiredAt(now)) {
      result=false;
    }
 else {
      V oldValue=valueConverter.fromInternal(cachedValue.get());
      RIEntry<K,V> entry=new RIEntry<K,V>(key,value,oldValue);
      writeCacheEntry(entry);
      try {
        Duration duration=expiryPolicy.getTTLForModifiedEntry(entry,new Duration(now,cachedValue.getExpiryTime()));
        long expiryTime=duration.getAdjustedTime(now);
        cachedValue.setExpiryTime(expiryTime);
      }
 catch (      Throwable t) {
      }
      Object internalValue=valueConverter.toInternal(value);
      cachedValue.setInternalValue(internalValue,now);
      RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
      dispatcher.addEvent(CacheEntryUpdatedListener.class,new RICacheEntryEvent<K,V>(this,key,value,oldValue));
      dispatcher.dispatch(cacheEntryListenerRegistrations.values());
      result=true;
    }
  }
  finally {
    lockManager.unLock(key);
  }
  if (result && statisticsEnabled()) {
    statistics.increaseCachePuts(1);
  }
  return result;
}
Program: 17317
Project: 17317
Buggy source:
public RIEntry(K key,V value){
  if (key == null) {
    throw new NullPointerException("String_Node_Str");
  }
  this.key=key;
  this.value=value;
}

Fixed version (ground truth):
public RIEntry(K key,V value,V oldValue){
  if (key == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (value == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (oldValue == null) {
    throw new NullPointerException("String_Node_Str");
  }
  this.key=key;
  this.value=value;
  this.oldValue=oldValue;
}
Program: 17319
Project: 17319
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public int hashCode(){
  return getKey().hashCode() ^ getValue().hashCode();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public int hashCode(){
  return getKey().hashCode();
}
Program: 17322
Project: 17322
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || ((Object)this).getClass() != o.getClass())   return false;
  RIEntry<?,?> e2=(RIEntry<?,?>)o;
  return this.getKey().equals(e2.getKey()) && this.getValue().equals(e2.getValue());
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || ((Object)this).getClass() != o.getClass())   return false;
  RIEntry<?,?> e2=(RIEntry<?,?>)o;
  return this.getKey().equals(e2.getKey()) && this.getValue().equals(e2.getValue()) && (this.oldValue == null && e2.oldValue == null || this.getOldValue().equals(e2.getOldValue()));
}
Program: 17323
Project: 17323
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public <K,V>Cache<K,V> configureCache(String cacheName,Configuration<K,V> configuration){
  if (isClosed()) {
    throw new IllegalStateException();
  }
  if (cacheName == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (configuration == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if ((!configuration.isStoreByValue()) && configuration.isTransactionsEnabled()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (configuration.getTransactionIsolationLevel() == IsolationLevel.NONE && configuration.getTransactionMode() != Mode.NONE) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (configuration.getTransactionIsolationLevel() != IsolationLevel.NONE && configuration.getTransactionMode() == Mode.NONE) {
    throw new IllegalArgumentException("String_Node_Str");
  }
synchronized (caches) {
    Cache<?,?> cache=caches.get(cacheName);
    if (cache == null) {
      cache=new RICache<K,V>(this,cacheName,getClassLoader(),configuration);
      caches.put(cache.getName(),cache);
    }
 else {
      RIConfiguration<K,V> config=new RIConfiguration<K,V>(configuration);
      if (!cache.getConfiguration().equals(config)) {
        throw new CacheException("String_Node_Str" + cache.getName() + "String_Node_Str");
      }
    }
    return (Cache<K,V>)cache;
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public <K,V>Cache<K,V> configureCache(String cacheName,Configuration<K,V> configuration){
  if (isClosed()) {
    throw new IllegalStateException();
  }
  if (cacheName == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (configuration == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if ((!configuration.isStoreByValue()) && configuration.isTransactionsEnabled()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (configuration.getTransactionIsolationLevel() == IsolationLevel.NONE && configuration.getTransactionMode() != Mode.NONE) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (configuration.getTransactionIsolationLevel() != IsolationLevel.NONE && configuration.getTransactionMode() == Mode.NONE) {
    throw new IllegalArgumentException("String_Node_Str");
  }
synchronized (caches) {
    Cache<?,?> cache=caches.get(cacheName);
    if (cache == null) {
      cache=new RICache<K,V>(this,cacheName,getClassLoader(),configuration);
      caches.put(cache.getName(),cache);
    }
    return (Cache<K,V>)cache;
  }
}
Program: 17324
Project: 17324
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean replace(K key,V value){
  checkStatusStarted();
  if (value == null) {
    throw new NullPointerException("String_Node_Str" + key);
  }
  long now=System.currentTimeMillis();
  boolean result;
  lockManager.lock(key);
  try {
    Object internalKey=keyConverter.toInternal(key);
    RICachedValue cachedValue=entries.get(internalKey);
    if (cachedValue == null || cachedValue.isExpiredAt(now)) {
      result=false;
    }
 else {
      RIEntry<K,V> entry=new RIEntry<K,V>(key,value);
      writeCacheEntry(entry);
      V previousValue=valueConverter.fromInternal(cachedValue.get());
      Duration duration;
      try {
        duration=expiryPolicy.getTTLForModifiedEntry(entry,new Duration(now,cachedValue.getExpiryTime()));
      }
 catch (      Throwable t) {
        duration=getDefaultDuration();
      }
      long expiryTime=duration.getAdjustedTime(now);
      Object internalValue=valueConverter.toInternal(value);
      cachedValue.setInternalValue(internalValue,now);
      cachedValue.setExpiryTime(expiryTime);
      RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
      dispatcher.addEvent(CacheEntryUpdatedListener.class,new RICacheEntryEvent<K,V>(this,key,value,previousValue));
      dispatcher.dispatch(cacheEntryListenerRegistrations.values());
      result=true;
    }
  }
  finally {
    lockManager.unLock(key);
  }
  if (result && statisticsEnabled()) {
    statistics.increaseCachePuts(1);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean replace(K key,V value){
  checkStatusStarted();
  if (value == null) {
    throw new NullPointerException("String_Node_Str" + key);
  }
  long now=System.currentTimeMillis();
  boolean result;
  lockManager.lock(key);
  try {
    Object internalKey=keyConverter.toInternal(key);
    RICachedValue cachedValue=entries.get(internalKey);
    if (cachedValue == null || cachedValue.isExpiredAt(now)) {
      result=false;
    }
 else {
      RIEntry<K,V> entry=new RIEntry<K,V>(key,value);
      writeCacheEntry(entry);
      V previousValue=valueConverter.fromInternal(cachedValue.get());
      try {
        Duration duration=expiryPolicy.getTTLForModifiedEntry(entry,new Duration(now,cachedValue.getExpiryTime()));
        long expiryTime=duration.getAdjustedTime(now);
        cachedValue.setExpiryTime(expiryTime);
      }
 catch (      Throwable t) {
      }
      Object internalValue=valueConverter.toInternal(value);
      cachedValue.setInternalValue(internalValue,now);
      RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
      dispatcher.addEvent(CacheEntryUpdatedListener.class,new RICacheEntryEvent<K,V>(this,key,value,previousValue));
      dispatcher.dispatch(cacheEntryListenerRegistrations.values());
      result=true;
    }
  }
  finally {
    lockManager.unLock(key);
  }
  if (result && statisticsEnabled()) {
    statistics.increaseCachePuts(1);
  }
  return result;
}
Program: 17330
Project: 17330
Buggy source:
/** 
 * Fetches the next available, non-expired entry from the underlying  iterator.
 */
private void fetch(){
  while (nextEntry == null && iterator.hasNext()) {
    Map.Entry<Object,RICachedValue> entry=iterator.next();
    RICachedValue cachedValue=entry.getValue();
    K key=(K)RICache.this.keyConverter.fromInternal(entry.getKey());
    lockManager.lock(key);
    try {
      if (!cachedValue.isExpiredAt(now)) {
        V value=(V)RICache.this.valueConverter.fromInternal(cachedValue.getInternalValue(now));
        nextEntry=new RIEntry<K,V>(key,value);
        Duration duration;
        try {
          duration=expiryPolicy.getTTLForAccessedEntry(nextEntry,new Duration(now,cachedValue.getExpiryTime()));
        }
 catch (        Throwable t) {
          duration=getDefaultDuration();
        }
        long expiryTime=duration.getAdjustedTime(now);
        cachedValue.setExpiryTime(expiryTime);
      }
    }
  finally {
      lockManager.unLock(key);
    }
  }
}

Fixed version (ground truth):
/** 
 * Fetches the next available, non-expired entry from the underlying  iterator.
 */
private void fetch(){
  while (nextEntry == null && iterator.hasNext()) {
    Map.Entry<Object,RICachedValue> entry=iterator.next();
    RICachedValue cachedValue=entry.getValue();
    K key=(K)RICache.this.keyConverter.fromInternal(entry.getKey());
    lockManager.lock(key);
    try {
      if (!cachedValue.isExpiredAt(now)) {
        V value=(V)RICache.this.valueConverter.fromInternal(cachedValue.getInternalValue(now));
        nextEntry=new RIEntry<K,V>(key,value);
        try {
          Duration duration=expiryPolicy.getTTLForAccessedEntry(nextEntry,new Duration(now,cachedValue.getExpiryTime()));
          long expiryTime=duration.getAdjustedTime(now);
          cachedValue.setExpiryTime(expiryTime);
        }
 catch (        Throwable t) {
        }
      }
    }
  finally {
      lockManager.unLock(key);
    }
  }
}
Program: 17331
Project: 17331
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public CacheLoader<K,? extends V> getCacheLoader(){
  return this.cacheLoader;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public CacheLoader<K,V> getCacheLoader(){
  return this.cacheLoader;
}
Program: 17332
Project: 17332
Buggy source:
@Override public void run(){
  try {
    ArrayList<K> keysToLoad=new ArrayList<K>();
    for (    K key : keys) {
      if (!containsKey(key)) {
        keysToLoad.add(key);
      }
    }
    Map<? extends K,? extends V> loaded=cacheLoader.loadAll(keysToLoad);
    putAll(loaded,replaceExistingValues);
    if (listener != null) {
      listener.onCompletion();
    }
  }
 catch (  Exception e) {
    if (listener != null) {
      listener.onException(e);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    ArrayList<K> keysToLoad=new ArrayList<K>();
    for (    K key : keys) {
      if (!containsKey(key)) {
        keysToLoad.add(key);
      }
    }
    Map<? extends K,? extends V> loaded=cacheLoader.loadAll(keysToLoad);
    putAll(loaded,replaceExistingValues,false);
    if (listener != null) {
      listener.onCompletion();
    }
  }
 catch (  Exception e) {
    if (listener != null) {
      listener.onException(e);
    }
  }
}
Program: 17333
Project: 17333
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void loadAll(final Iterable<? extends K> keys,final boolean replaceExistingValues,final CompletionListener listener){
  ensureOpen();
  if (keys == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (cacheLoader == null) {
    if (listener != null) {
      listener.onCompletion();
    }
  }
 else {
    executorService.submit(new Runnable(){
      @Override public void run(){
        try {
          ArrayList<K> keysToLoad=new ArrayList<K>();
          for (          K key : keys) {
            if (!containsKey(key)) {
              keysToLoad.add(key);
            }
          }
          Map<? extends K,? extends V> loaded=cacheLoader.loadAll(keysToLoad);
          putAll(loaded,replaceExistingValues);
          if (listener != null) {
            listener.onCompletion();
          }
        }
 catch (        Exception e) {
          if (listener != null) {
            listener.onException(e);
          }
        }
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void loadAll(final Iterable<? extends K> keys,final boolean replaceExistingValues,final CompletionListener listener){
  ensureOpen();
  if (keys == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (cacheLoader == null) {
    if (listener != null) {
      listener.onCompletion();
    }
  }
 else {
    executorService.submit(new Runnable(){
      @Override public void run(){
        try {
          ArrayList<K> keysToLoad=new ArrayList<K>();
          for (          K key : keys) {
            if (!containsKey(key)) {
              keysToLoad.add(key);
            }
          }
          Map<? extends K,? extends V> loaded=cacheLoader.loadAll(keysToLoad);
          putAll(loaded,replaceExistingValues,false);
          if (listener != null) {
            listener.onCompletion();
          }
        }
 catch (        Exception e) {
          if (listener != null) {
            listener.onException(e);
          }
        }
      }
    }
);
  }
}