nus-yam/ex-repair huggingface dataset:
Program: 17336
Project: 17336
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 {
      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;
}

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);
        if (duration != null) {
          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: 17342
Project: 17342
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);
        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);
    }
  }
}

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);
          if (duration != null) {
            long expiryTime=duration.getAdjustedTime(now);
            cachedValue.setExpiryTime(expiryTime);
          }
        }
 catch (        Throwable t) {
        }
      }
    }
  finally {
      lockManager.unLock(key);
    }
  }
}
Program: 17343
Project: 17343
Buggy source:
@Test public void checkDefaults(){
  Configuration<?,?> config=getCacheConfiguration();
  assertFalse(config.isReadThrough());
  assertFalse(config.isWriteThrough());
  assertFalse(config.isStatisticsEnabled());
  assertTrue(config.isStoreByValue());
  Duration duration=new Duration(TimeUnit.MINUTES,10);
  ExpiryPolicy<?,?> expiryPolicy=config.getExpiryPolicyFactory().create();
  assertEquals(Duration.ETERNAL,expiryPolicy.getTTLForCreatedEntry(null));
  assertEquals(duration,expiryPolicy.getTTLForAccessedEntry(null,duration));
  assertEquals(duration,expiryPolicy.getTTLForModifiedEntry(null,duration));
}

Fixed version (ground truth):
@Test public void checkDefaults(){
  Configuration<?,?> config=getCacheConfiguration();
  assertFalse(config.isReadThrough());
  assertFalse(config.isWriteThrough());
  assertFalse(config.isStatisticsEnabled());
  assertTrue(config.isStoreByValue());
  Duration duration=new Duration(TimeUnit.MINUTES,10);
  ExpiryPolicy<?,?> expiryPolicy=config.getExpiryPolicyFactory().create();
  assertEquals(Duration.ETERNAL,expiryPolicy.getTTLForCreatedEntry(null));
  assertNull(expiryPolicy.getTTLForAccessedEntry(null));
  assertNull(expiryPolicy.getTTLForModifiedEntry(null));
}
Program: 17346
Project: 17346
Buggy source:
/** 
 * Returns cache hits as a percentage of total gets.
 * @return the percentage of successful hits, as a decimal
 */
@Override public float getCacheHitPercentage(){
  return getCacheHits() / getCacheGets();
}

Fixed version (ground truth):
/** 
 * Returns cache hits as a percentage of total gets.
 * @return the percentage of successful hits, as a decimal
 */
@Override public float getCacheHitPercentage(){
  Long hits=getCacheHits();
  if (hits == 0) {
    return 0;
  }
  return hits / getCacheGets();
}
Program: 17347
Project: 17347
Buggy source:
/** 
 * Returns cache misses as a percentage of total gets.
 * @return the percentage of accesses that failed to find anything
 */
@Override public float getCacheMissPercentage(){
  return getCacheMisses() / getCacheGets();
}

Fixed version (ground truth):
/** 
 * Returns cache misses as a percentage of total gets.
 * @return the percentage of accesses that failed to find anything
 */
@Override public float getCacheMissPercentage(){
  Long misses=getCacheMisses();
  if (misses == 0) {
    return 0;
  }
  return misses / getCacheGets();
}
Program: 17348
Project: 17348
Buggy source:
/** 
 * The mean time to execute removes.
 * @return the time in milliseconds
 */
@Override public float getAverageRemoveMillis(){
  return (cacheRemoveTimeTakenNanos.longValue() / getCacheGets()) / NANOSECONDS_IN_A_MILLISECOND;
}

Fixed version (ground truth):
/** 
 * The mean time to execute removes.
 * @return the time in milliseconds
 */
@Override public float getAverageRemoveMillis(){
  if (cacheRemoveTimeTakenNanos.longValue() == 0 || getCacheGets() == 0) {
    return 0;
  }
  return (cacheRemoveTimeTakenNanos.longValue() / getCacheGets()) / NANOSECONDS_IN_A_MILLISECOND;
}
Program: 17349
Project: 17349
Buggy source:
/** 
 * The mean time to execute puts.
 * @return the time in milliseconds
 */
@Override public float getAveragePutMillis(){
  return (cachePutTimeTakenNanos.longValue() / getCacheGets()) / NANOSECONDS_IN_A_MILLISECOND;
}

Fixed version (ground truth):
/** 
 * The mean time to execute puts.
 * @return the time in milliseconds
 */
@Override public float getAveragePutMillis(){
  if (cachePutTimeTakenNanos.longValue() == 0 || getCacheGets() == 0) {
    return 0;
  }
  return (cachePutTimeTakenNanos.longValue() / getCacheGets()) / NANOSECONDS_IN_A_MILLISECOND;
}
Program: 17350
Project: 17350
Buggy source:
/** 
 * The mean time to execute gets.
 * @return the time in milliseconds
 */
@Override public float getAverageGetMillis(){
  return (cacheGetTimeTakenNanos.longValue() / getCacheGets()) / NANOSECONDS_IN_A_MILLISECOND;
}

Fixed version (ground truth):
/** 
 * The mean time to execute gets.
 * @return the time in milliseconds
 */
@Override public float getAverageGetMillis(){
  if (cacheGetTimeTakenNanos.longValue() == 0 || getCacheGets() == 0) {
    return 0;
  }
  return (cacheGetTimeTakenNanos.longValue() / getCacheGets()) / NANOSECONDS_IN_A_MILLISECOND;
}
Program: 17351
Project: 17351
Buggy source:
/** 
 * Constructs an   {@link RIEntryIterator}.
 * @param iterator the {@link Iterator} over the internal entries
 * @param now      the time the iterator will use to test for expiry
 */
private RIEntryIterator(Iterator<Map.Entry<Object,RICachedValue>> iterator,long now){
  this.iterator=iterator;
  this.nextEntry=null;
  this.now=now;
}

Fixed version (ground truth):
/** 
 * Constructs an   {@link RIEntryIterator}.
 * @param iterator the {@link Iterator} over the internal entries
 * @param now      the time the iterator will use to test for expiry
 */
private RIEntryIterator(Iterator<Map.Entry<Object,RICachedValue>> iterator,long now){
  this.iterator=iterator;
  this.nextEntry=null;
  this.lastEntry=null;
  this.now=now;
}
Program: 17352
Project: 17352
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Entry<K,V> next(){
  if (hasNext()) {
    RIEntry<K,V> entry=nextEntry;
    RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
    dispatcher.addEvent(CacheEntryReadListener.class,new RICacheEntryEvent<K,V>(RICache.this,entry.getKey(),entry.getValue()));
    dispatcher.dispatch(cacheEntryListenerRegistrations.values());
    nextEntry=null;
    return entry;
  }
 else {
    throw new NoSuchElementException();
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Entry<K,V> next(){
  if (hasNext()) {
    lastEntry=nextEntry;
    RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
    dispatcher.addEvent(CacheEntryReadListener.class,new RICacheEntryEvent<K,V>(RICache.this,lastEntry.getKey(),lastEntry.getValue()));
    dispatcher.dispatch(cacheEntryListenerRegistrations.values());
    nextEntry=null;
    return lastEntry;
  }
 else {
    throw new NoSuchElementException();
  }
}
Program: 17353
Project: 17353
Buggy source:
/** 
 * Gets the internal value (and updates the access time to now)
 * @param accessTime the time when the internal value was accessed
 * @return the internal value
 */
public Object getInternalValue(long accessTime){
  this.accessTime=accessTime;
  return internalValue;
}

Fixed version (ground truth):
/** 
 * Gets the internal value with the side-effect of updating the access time to that which is specified and incrementing the access count.
 * @param accessTime the time when the internal value was accessed
 * @return the internal value
 */
public Object getInternalValue(long accessTime){
  this.accessTime=accessTime;
  this.accessCount++;
  return internalValue;
}
Program: 17354
Project: 17354
Buggy source:
/** 
 * Constructs an   {@link RICachedValue} with the creation, access andmodification times being the current time.
 * @param internalValue the internal representation of the value
 * @param creationTime  the time when the cache entry was created
 * @param expiryTime    the time when the cache entry should expire
 */
public RICachedValue(Object internalValue,long creationTime,long expiryTime){
  this.internalValue=internalValue;
  this.creationTime=creationTime;
  this.accessTime=creationTime;
  this.modificationTime=creationTime;
  this.expiryTime=expiryTime;
}

Fixed version (ground truth):
/** 
 * Constructs an   {@link RICachedValue} with the creation, access andmodification times being the current time.
 * @param internalValue the internal representation of the value
 * @param creationTime  the time when the cache entry was created
 * @param expiryTime    the time when the cache entry should expire
 */
public RICachedValue(Object internalValue,long creationTime,long expiryTime){
  this.internalValue=internalValue;
  this.creationTime=creationTime;
  this.accessTime=creationTime;
  this.modificationTime=creationTime;
  this.expiryTime=expiryTime;
  this.accessCount=0;
  this.modificationCount=0;
}
Program: 17355
Project: 17355
Buggy source:
/** 
 * Sets the internal value (and update the modification time to now)
 * @param internalValue    the new internal value
 * @param modificationTime the time when the value was modified
 */
public void setInternalValue(Object internalValue,long modificationTime){
  this.modificationTime=modificationTime;
  this.internalValue=internalValue;
}

Fixed version (ground truth):
/** 
 * Sets the internal value with the additional side-effect of updating the modification time to that which is specified and incrementing the modification count.
 * @param internalValue    the new internal value
 * @param modificationTime the time when the value was modified
 */
public void setInternalValue(Object internalValue,long modificationTime){
  this.modificationTime=modificationTime;
  this.internalValue=internalValue;
  this.modificationCount++;
}
Program: 17356
Project: 17356
Buggy source:
/** 
 * Constructs an   {@link AbstractCacheConfigurationBuilder} using thedefault CacheConfiguration options.
 */
public AbstractCacheConfigurationBuilder(){
  this.cacheEntryListeners=new ArrayList<CacheEntryListener<? super K,? super V>>();
  this.cacheLoader=null;
  this.cacheWriter=null;
  this.cacheEntryExpiryPolicy=DEFAULT_CACHE_ENTRY_EXPIRY_POLICY;
  this.isReadThrough=DEFAULT_IS_READ_THROUGH;
  this.isWriteThrough=DEFAULT_IS_WRITE_THROUGH;
  this.isStatisticsEnabled=DEFAULT_IS_STATISTICS_ENABLED;
  this.storeByValue=DEFAULT_STORE_BY_VALUE;
  this.txnIsolationLevel=DEFAULT_TRANSACTION_ISOLATION_LEVEL;
  this.txnMode=DEFAULT_TRANSACTION_MODE;
}

Fixed version (ground truth):
/** 
 * Constructs an   {@link AbstractCacheConfigurationBuilder} using thedefault CacheConfiguration options.
 */
public AbstractCacheConfigurationBuilder(){
  this.cacheEntryListenerRegistrations=new ArrayList<CacheEntryListenerRegistration<? super K,? super V>>();
  this.cacheLoader=null;
  this.cacheWriter=null;
  this.cacheEntryExpiryPolicy=DEFAULT_CACHE_ENTRY_EXPIRY_POLICY;
  this.isReadThrough=DEFAULT_IS_READ_THROUGH;
  this.isWriteThrough=DEFAULT_IS_WRITE_THROUGH;
  this.isStatisticsEnabled=DEFAULT_IS_STATISTICS_ENABLED;
  this.storeByValue=DEFAULT_STORE_BY_VALUE;
  this.txnIsolationLevel=DEFAULT_TRANSACTION_ISOLATION_LEVEL;
  this.txnMode=DEFAULT_TRANSACTION_MODE;
}
Program: 17357
Project: 17357
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public B addCacheEntryListener(CacheEntryListener<? super K,? super V> cacheEntryListener){
  cacheEntryListeners.add(cacheEntryListener);
  return (B)this;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public B addCacheEntryListener(final CacheEntryListener<? super K,? super V> listener,final boolean requireOldValue,final CacheEntryFilter<K,V> filter,final boolean synchronous){
  cacheEntryListenerRegistrations.add(new CacheEntryListenerRegistration(){
    @Override public CacheEntryListener getCacheEntryListener(){
      return listener;
    }
    @Override public CacheEntryFilter getCacheEntryFilter(){
      return filter;
    }
    @Override public boolean isOldValueRequired(){
      return requireOldValue;
    }
    @Override public boolean isSynchronous(){
      return synchronous;
    }
  }
);
  return (B)this;
}
Program: 17358
Project: 17358
Buggy source:
/** 
 * Specifies that a listener should be registered for a Cache when a   {@link CacheConfiguration} from this builder is used to configure a Cache.
 * @param cacheEntryListener the listener to add for later registration
 * @return the {@link CacheConfigurationBuilder}
 * @throws NullPointerException if any of the arguments are null.
 */
B addCacheEntryListener(CacheEntryListener<? super K,? super V> cacheEntryListener);

Fixed version (ground truth):
/** 
 * Adds the definition of a   {@link CacheEntryListener} to be registeredwith a Cache.
 * @see Cache#registerCacheEntryListener(CacheEntryListener,boolean,CacheEntryFilter,boolean)
 * @param cacheEntryListener The listener to add
 * @param requireOldValue    is the old value supplied in an event
 * @param cacheEntryFilter   the filter to be applied to events
 * @param synchronous        whether the caller is blocked until the listener invocation completes
 * @return the {@link CacheConfigurationBuilder}
 */
B addCacheEntryListener(CacheEntryListener<? super K,? super V> cacheEntryListener,boolean requireOldValue,CacheEntryFilter<K,V> cacheEntryFilter,boolean synchronous);
Program: 17359
Project: 17359
Buggy source:
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((cacheEntryListeners == null) ? 0 : cacheEntryListeners.hashCode());
  result=prime * result + ((cacheLoader == null) ? 0 : cacheLoader.hashCode());
  result=prime * result + ((cacheWriter == null) ? 0 : cacheWriter.hashCode());
  result=prime * result + ((cacheEntryExpiryPolicy == null) ? 0 : cacheEntryExpiryPolicy.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):
@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 + ((cacheEntryExpiryPolicy == null) ? 0 : cacheEntryExpiryPolicy.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: 17360
Project: 17360
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (!(obj instanceof SimpleCacheConfiguration)) {
    return false;
  }
  SimpleCacheConfiguration other=(SimpleCacheConfiguration)obj;
  if (cacheEntryListeners == null) {
    if (other.cacheEntryListeners != null) {
      return false;
    }
  }
 else   if (!cacheEntryListeners.equals(other.cacheEntryListeners)) {
    return false;
  }
  if (cacheLoader == null) {
    if (other.cacheLoader != null) {
      return false;
    }
  }
 else   if (!cacheLoader.equals(other.cacheLoader)) {
    return false;
  }
  if (cacheWriter == null) {
    if (other.cacheWriter != null) {
      return false;
    }
  }
 else   if (!cacheWriter.equals(other.cacheWriter)) {
    return false;
  }
  if (cacheEntryExpiryPolicy == null) {
    if (other.cacheEntryExpiryPolicy != null) {
      return false;
    }
  }
 else   if (!cacheEntryExpiryPolicy.equals(other.cacheEntryExpiryPolicy)) {
    return false;
  }
  if (isReadThrough != other.isReadThrough) {
    return false;
  }
  if (isStatisticsEnabled != other.isStatisticsEnabled) {
    return false;
  }
  if (isStoreByValue != other.isStoreByValue) {
    return false;
  }
  if (isWriteThrough != other.isWriteThrough) {
    return false;
  }
  if (txnIsolationLevel != other.txnIsolationLevel) {
    return false;
  }
  if (txnMode != other.txnMode) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (!(obj instanceof SimpleCacheConfiguration)) {
    return false;
  }
  SimpleCacheConfiguration other=(SimpleCacheConfiguration)obj;
  if (cacheEntryListenerRegistrations == null) {
    if (other.cacheEntryListenerRegistrations != null) {
      return false;
    }
  }
 else   if (!cacheEntryListenerRegistrations.equals(other.cacheEntryListenerRegistrations)) {
    return false;
  }
  if (cacheLoader == null) {
    if (other.cacheLoader != null) {
      return false;
    }
  }
 else   if (!cacheLoader.equals(other.cacheLoader)) {
    return false;
  }
  if (cacheWriter == null) {
    if (other.cacheWriter != null) {
      return false;
    }
  }
 else   if (!cacheWriter.equals(other.cacheWriter)) {
    return false;
  }
  if (cacheEntryExpiryPolicy == null) {
    if (other.cacheEntryExpiryPolicy != null) {
      return false;
    }
  }
 else   if (!cacheEntryExpiryPolicy.equals(other.cacheEntryExpiryPolicy)) {
    return false;
  }
  if (isReadThrough != other.isReadThrough) {
    return false;
  }
  if (isStatisticsEnabled != other.isStatisticsEnabled) {
    return false;
  }
  if (isStoreByValue != other.isStoreByValue) {
    return false;
  }
  if (isWriteThrough != other.isWriteThrough) {
    return false;
  }
  if (txnIsolationLevel != other.txnIsolationLevel) {
    return false;
  }
  if (txnMode != other.txnMode) {
    return false;
  }
  return true;
}
Program: 17361
Project: 17361
Buggy source:
/** 
 * A copy-constructor for a   {@link SimpleCacheConfiguration}.
 * @param configuration  the {@link CacheConfiguration} from which to copy
 */
public SimpleCacheConfiguration(CacheConfiguration<K,V> configuration){
  this(configuration.getCacheEntryListeners(),configuration.getCacheLoader(),configuration.getCacheWriter(),configuration.getCacheEntryExpiryPolicy(),configuration.isReadThrough(),configuration.isWriteThrough(),configuration.isStatisticsEnabled(),configuration.isStoreByValue(),configuration.getTransactionIsolationLevel(),configuration.getTransactionMode());
}

Fixed version (ground truth):
/** 
 * A copy-constructor for a   {@link SimpleCacheConfiguration}.
 * @param configuration  the {@link CacheConfiguration} from which to copy
 */
public SimpleCacheConfiguration(CacheConfiguration<K,V> configuration){
  this(configuration.getCacheEntryListenerRegistrations(),configuration.getCacheLoader(),configuration.getCacheWriter(),configuration.getCacheEntryExpiryPolicy(),configuration.isReadThrough(),configuration.isWriteThrough(),configuration.isStatisticsEnabled(),configuration.isStoreByValue(),configuration.getTransactionIsolationLevel(),configuration.getTransactionMode());
}
Program: 17362
Project: 17362
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public CacheConfiguration<K,V> build(){
  if (isReadThrough && cacheLoader == null) {
    throw new InvalidConfigurationException("String_Node_Str");
  }
  if (isWriteThrough && cacheWriter == null) {
    throw new InvalidConfigurationException("String_Node_Str");
  }
  return new SimpleCacheConfiguration<K,V>(cacheEntryListeners,cacheLoader,cacheWriter,cacheEntryExpiryPolicy,isReadThrough,isWriteThrough,isStatisticsEnabled,storeByValue,txnIsolationLevel,txnMode);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public CacheConfiguration<K,V> build(){
  if (isReadThrough && cacheLoader == null) {
    throw new InvalidConfigurationException("String_Node_Str");
  }
  if (isWriteThrough && cacheWriter == null) {
    throw new InvalidConfigurationException("String_Node_Str");
  }
  return new SimpleCacheConfiguration<K,V>(cacheEntryListenerRegistrations,cacheLoader,cacheWriter,cacheEntryExpiryPolicy,isReadThrough,isWriteThrough,isStatisticsEnabled,storeByValue,txnIsolationLevel,txnMode);
}
Program: 17363
Project: 17363
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Entry<K,V> next(){
  if (hasNext()) {
    RICachedValue cachedValue=nextEntry.getValue();
    K key=(K)RICache.this.keyConverter.fromInternal(nextEntry.getKey());
    V value=(V)RICache.this.valueConverter.fromInternal(cachedValue.getInternalValue(now));
    RIEntry<K,V> entry=new RIEntry<K,V>(key,value);
    Duration duration=expiryPolicy.getTTLForAccessedEntry(entry,new Duration(now,cachedValue.getExpiryTime()));
    long expiryTime=duration.getAdjustedTime(now);
    cachedValue.setExpiryTime(expiryTime);
    nextEntry=null;
    return entry;
  }
 else {
    throw new NoSuchElementException();
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Entry<K,V> next(){
  if (hasNext()) {
    RIEntry<K,V> entry=nextEntry;
    RICacheEventEventDispatcher<K,V> dispatcher=new RICacheEventEventDispatcher<K,V>();
    dispatcher.addEvent(CacheEntryReadListener.class,new RICacheEntryEvent<K,V>(RICache.this,entry.getKey(),entry.getValue()));
    dispatcher.dispatch(cacheEntryListenerRegistrations.values());
    nextEntry=null;
    return entry;
  }
 else {
    throw new NoSuchElementException();
  }
}
Program: 17364
Project: 17364
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();
    if (!cachedValue.isExpiredAt(now)) {
      nextEntry=entry;
    }
  }
}

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);
        Duration duration=expiryPolicy.getTTLForAccessedEntry(nextEntry,new Duration(now,cachedValue.getExpiryTime()));
        long expiryTime=duration.getAdjustedTime(now);
        cachedValue.setExpiryTime(expiryTime);
      }
    }
  finally {
      lockManager.unLock(key);
    }
  }
}
Program: 17366
Project: 17366
Buggy source:
/** 
 * Constructor
 * @param cache the cache
 */
public DelegatingCacheMXBean(Cache<K,V> cache){
  this.cache=cache;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param cache the cache
 */
public DelegatingCacheMXBean(Cache<K,V> cache){
  super(cache);
  this.cache=cache;
}
Program: 17367
Project: 17367
Buggy source:
@Override public CacheBuilder<K,V> setExpiry(CacheConfiguration.ExpiryType type,CacheConfiguration.Duration timeToLive){
  if (type == null) {
    throw new NullPointerException();
  }
  if (timeToLive == null) {
    throw new NullPointerException();
  }
  configurationBuilder.setExpiry(type,timeToLive);
  return this;
}

Fixed version (ground truth):
@Override public CacheBuilder<K,V> setExpiry(CacheConfiguration.ExpiryType type,CacheConfiguration.Duration duration){
  if (type == null) {
    throw new NullPointerException();
  }
  if (duration == null) {
    throw new NullPointerException();
  }
  configurationBuilder.setExpiry(type,duration);
  return this;
}
Program: 17368
Project: 17368
Buggy source:
/** 
 * Set expiry
 * @param type ttl type
 * @param duration time to live
 * @return this Builder instance
 */
public Builder setExpiry(ExpiryType type,Duration duration){
  if (type == null) {
    throw new NullPointerException();
  }
  if (duration == null) {
    throw new NullPointerException();
  }
  this.timeToLive[type.ordinal()]=duration.getTimeToLive() == 0 ? Duration.ETERNAL : duration;
  return this;
}

Fixed version (ground truth):
/** 
 * Set expiry
 * @param type ttl type
 * @param duration time to live
 * @return this Builder instance
 */
public Builder setExpiry(ExpiryType type,Duration duration){
  if (type == null) {
    throw new NullPointerException();
  }
  if (duration == null) {
    throw new NullPointerException();
  }
  this.timeToLive[type.ordinal()]=duration.getDurationAmount() == 0 ? Duration.ETERNAL : duration;
  return this;
}
Program: 17369
Project: 17369
Buggy source:
@Override public CacheBuilder<K,V> setExpiry(CacheConfiguration.ExpiryType type,CacheConfiguration.Duration timeToLive){
  cacheBuilder.setExpiry(type,timeToLive);
  return this;
}

Fixed version (ground truth):
@Override public CacheBuilder<K,V> setExpiry(CacheConfiguration.ExpiryType type,CacheConfiguration.Duration duration){
  cacheBuilder.setExpiry(type,duration);
  return this;
}
Program: 17370
Project: 17370
Buggy source:
/** 
 * Builds the cache
 * @return a constructed cache.
 */
@Override public RICache<K,V> build(){
  CacheConfiguration configuration=configurationBuilder.build();
  if (configuration.isReadThrough() && (cacheLoader == null)) {
    throw new InvalidConfigurationException("String_Node_Str");
  }
  if (configuration.isWriteThrough() && (cacheWriter == null)) {
    throw new InvalidConfigurationException("String_Node_Str");
  }
  return new RICache<K,V>(cacheName,cacheManagerName,immutableClasses,classLoader,configuration,cacheLoader,cacheWriter,listeners);
}

Fixed version (ground truth):
/** 
 * Builds the cache
 * @return a constructed cache.
 */
@Override public RICache<K,V> build(){
  RICacheConfiguration configuration=configurationBuilder.build();
  if (configuration.isReadThrough() && (cacheLoader == null)) {
    throw new InvalidConfigurationException("String_Node_Str");
  }
  if (configuration.isWriteThrough() && (cacheWriter == null)) {
    throw new InvalidConfigurationException("String_Node_Str");
  }
  RICache<K,V> riCache=new RICache<K,V>(cacheName,cacheManagerName,immutableClasses,classLoader,configuration,cacheLoader,cacheWriter,listeners);
  configuration.setRiCache(riCache);
  return riCache;
}
Program: 17371
Project: 17371
Buggy source:
/** 
 * @inheritDoc
 */
@Override public CacheManager getCacheManager(){
  return Caching.getCacheManager(cacheManagerName);
}

Fixed version (ground truth):
/** 
 * @inheritDoc
 */
@Override public CacheManager getCacheManager(){
  return Caching.getCacheManager(classLoader,cacheManagerName);
}
Program: 17372
Project: 17372
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public <K,V>CacheBuilder<K,V> createCacheBuilder(String cacheName){
  return new RICacheBuilder<K,V>(cacheName);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public <K,V>CacheBuilder<K,V> createCacheBuilder(String cacheName){
  if (caches.get(cacheName) != null) {
    throw new CacheException("String_Node_Str" + cacheName + "String_Node_Str");
  }
  return new RICacheBuilder<K,V>(cacheName);
}
Program: 17373
Project: 17373
Buggy source:
private void addCacheInternal(Cache<?,?> cache){
  Cache<?,?> oldCache;
synchronized (caches) {
    oldCache=caches.put(cache.getName(),cache);
  }
  cache.start();
  if (oldCache != null) {
    oldCache.stop();
  }
}

Fixed version (ground truth):
private void addCacheInternal(Cache<?,?> cache){
synchronized (caches) {
    if (caches.get(cache.getName()) != null) {
      throw new CacheException("String_Node_Str" + cache.getName() + "String_Node_Str");
    }
    caches.put(cache.getName(),cache);
  }
  cache.start();
}
Program: 17374
Project: 17374
Buggy source:
/** 
 * Constructs a new RICacheManager with the specified name.
 * @param classLoader the ClassLoader that should be used in converting values into Java Objects.
 * @param name the name of this cache manager
 * @throws NullPointerException if classLoader or name is null.
 */
public RICacheManager(String name,ClassLoader classLoader){
  status=Status.UNINITIALISED;
  if (classLoader == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (name == null) {
    throw new NullPointerException("String_Node_Str");
  }
  this.classLoader=classLoader;
  this.name=name;
  status=Status.STARTED;
}

Fixed version (ground truth):
/** 
 * Constructs a new RICacheManager with the specified name.
 * @param classLoader the ClassLoader that should be used in converting values into Java Objects.
 * @param name        the name of this cache manager
 * @throws NullPointerException if classLoader or name is null.
 */
public RICacheManager(String name,ClassLoader classLoader){
  status=Status.UNINITIALISED;
  if (classLoader == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (name == null) {
    throw new NullPointerException("String_Node_Str");
  }
  this.classLoader=classLoader;
  this.name=name;
  status=Status.STARTED;
}
Program: 17375
Project: 17375
Buggy source:
/** 
 * Returns a list of caches managed by this CacheManager
 * @return the Caches or an empty list if there are none
 * @throws IllegalStateException if the CacheManager is not {@link javax.cache.Status#STARTED}
 */
@Override public Collection<Cache> getCaches(){
  return caches.values();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Collection<Cache> getCaches(){
synchronized (caches) {
    return new ArrayList<Cache>(caches.values());
  }
}
Program: 17376
Project: 17376
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public <K,V>Cache<K,V> getCache(String cacheName){
synchronized (caches) {
    return caches.get(cacheName);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public <K,V>Cache<K,V> getCache(String cacheName){
  if (status != Status.STARTED) {
    throw new IllegalStateException();
  }
synchronized (caches) {
    return caches.get(cacheName);
  }
}
Program: 17377
Project: 17377
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean removeCache(String cacheName){
  Cache oldCache;
  if (cacheName == null) {
    throw new NullPointerException("String_Node_Str");
  }
synchronized (caches) {
    oldCache=caches.remove(cacheName);
  }
  if (oldCache != null) {
    oldCache.stop();
  }
  return oldCache != null;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean removeCache(String cacheName){
  if (status != Status.STARTED) {
    throw new IllegalStateException();
  }
  if (cacheName == null) {
    throw new NullPointerException();
  }
  Cache oldCache;
synchronized (caches) {
    oldCache=caches.remove(cacheName);
  }
  if (oldCache != null) {
    oldCache.stop();
  }
  return oldCache != null;
}
Program: 17378
Project: 17378
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void shutdown(){
  status=Status.STOPPING;
  ArrayList<Cache> cacheList;
synchronized (caches) {
    cacheList=new ArrayList<Cache>(caches.values());
    caches.clear();
  }
  for (  Cache cache : cacheList) {
    try {
      cache.stop();
    }
 catch (    Exception e) {
      getLogger().log(Level.WARNING,"String_Node_Str" + cache);
    }
  }
  status=Status.STOPPED;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void shutdown(){
  if (status != Status.STARTED) {
    throw new IllegalStateException();
  }
  status=Status.STOPPING;
  ArrayList<Cache> cacheList;
synchronized (caches) {
    cacheList=new ArrayList<Cache>(caches.values());
    caches.clear();
  }
  for (  Cache cache : cacheList) {
    try {
      cache.stop();
    }
 catch (    Exception e) {
      getLogger().log(Level.WARNING,"String_Node_Str" + cache);
    }
  }
  status=Status.STOPPED;
}
Program: 17379
Project: 17379
Buggy source:
/** 
 * @param key the key
 * @return the previous value
 * @see javax.cache.Cache#remove(Object)
 */
V getAndRemove(Object key);

Fixed version (ground truth):
/** 
 * @param key the key
 * @return the previous value
 * @see javax.cache.Cache#getAndRemove(Object)
 */
V getAndRemove(Object key);
Program: 17380
Project: 17380
Buggy source:
/** 
 * @param cacheResult
 * @return
 */
public CacheResolver getCacheResolver(Class<? extends CacheResolver> clazz,CacheConfig config){
  if (config == null) {
    return beanManagerUtil.getBeanByType(clazz);
  }
 else {
    if (clazz == CacheResolver.class) {
      return beanManagerUtil.getBeanByType(config.cacheResovler());
    }
 else {
      return beanManagerUtil.getBeanByType(clazz);
    }
  }
}

Fixed version (ground truth):
/** 
 * @return
 */
public CacheResolver getCacheResolver(Class<? extends CacheResolver> clazz,CacheConfig config){
  if (config == null) {
    return beanManagerUtil.getBeanByType(clazz);
  }
 else {
    if (clazz == CacheResolver.class) {
      return beanManagerUtil.getBeanByType(config.cacheResolver());
    }
 else {
      return beanManagerUtil.getBeanByType(clazz);
    }
  }
}
Program: 17381
Project: 17381
Buggy source:
/** 
 * @param cacheResult
 * @return
 */
public CacheKeyGenerator getKeyGenerator(Class<? extends CacheKeyGenerator> clazz,CacheConfig config){
  if (config == null) {
    return beanManagerUtil.getBeanByType(clazz);
  }
 else {
    if (clazz == CacheKeyGenerator.class) {
      return beanManagerUtil.getBeanByType(config.cacheKeyGenerator());
    }
 else {
      return beanManagerUtil.getBeanByType(clazz);
    }
  }
}

Fixed version (ground truth):
/** 
 * @return
 */
public CacheKeyGenerator getKeyGenerator(Class<? extends CacheKeyGenerator> clazz,CacheConfig config){
  if (config == null) {
    return beanManagerUtil.getBeanByType(clazz);
  }
 else {
    if (clazz == CacheKeyGenerator.class) {
      return beanManagerUtil.getBeanByType(config.cacheKeyGenerator());
    }
 else {
      return beanManagerUtil.getBeanByType(clazz);
    }
  }
}
Program: 17382
Project: 17382
Buggy source:
/** 
 * NOTE: different return value
 * @return returns false if there was no matching key
 * @see java.util.Map#remove(Object)
 */
public boolean remove(Object key){
  if (key == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return (store.remove(key) == null);
}

Fixed version (ground truth):
/** 
 * NOTE: different return value
 * @return returns false if there was no matching key
 * @see java.util.Map#remove(Object)
 */
public boolean remove(Object key){
  if (key == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return (store.remove(key) != null);
}
Program: 17384
Project: 17384
Buggy source:
private static String[] parseAttribute(String fullAttribute){
  String[] parsedAttribute={"String_Node_Str","String_Node_Str"};
  String dirtyAttributeName=fullAttribute.substring(0,fullAttribute.indexOf("String_Node_Str"));
  String dirtyAttributeValue=fullAttribute.substring(fullAttribute.indexOf("String_Node_Str") + 1,fullAttribute.length());
  parsedAttribute[0]=dirtyAttributeName.trim();
  String cleanAttributeValue=dirtyAttributeValue.trim();
  if (cleanAttributeValue.startsWith("String_Node_Str") && cleanAttributeValue.endsWith("String_Node_Str")) {
    cleanAttributeValue=cleanAttributeValue.substring(1,cleanAttributeValue.length() - 1);
  }
  parsedAttribute[1]=cleanAttributeValue;
  return parsedAttribute;
}

Fixed version (ground truth):
private static String[] parseAttribute(String fullAttribute){
  String[] parsedAttribute={"String_Node_Str","String_Node_Str"};
  String dirtyAttributeName=fullAttribute.substring(0,fullAttribute.lastIndexOf("String_Node_Str"));
  String dirtyAttributeValue=fullAttribute.substring(fullAttribute.lastIndexOf("String_Node_Str") + 1,fullAttribute.length());
  parsedAttribute[0]=dirtyAttributeName.trim();
  String cleanAttributeValue=dirtyAttributeValue.trim();
  if (cleanAttributeValue.startsWith("String_Node_Str") && cleanAttributeValue.endsWith("String_Node_Str")) {
    cleanAttributeValue=cleanAttributeValue.substring(1,cleanAttributeValue.length() - 1);
  }
  parsedAttribute[1]=cleanAttributeValue;
  return parsedAttribute;
}
Program: 17387
Project: 17387
Buggy source:
public void createFieldEditors(){
  if (System.getProperty("String_Node_Str").equals("String_Node_Str")) {
    addField(new DirectoryFieldEditor(BrowserPreferenceConstants.P_PRIMARY_BROWSER_PATH,"String_Node_Str",getFieldEditorParent()));
    addField(new DirectoryFieldEditor(BrowserPreferenceConstants.P_SECONDARY_BROWSER_PATH,"String_Node_Str",getFieldEditorParent()));
  }
 else {
    addField(new FileFieldEditor(BrowserPreferenceConstants.P_PRIMARY_BROWSER_PATH,"String_Node_Str",getFieldEditorParent()));
    addField(new FileFieldEditor(BrowserPreferenceConstants.P_SECONDARY_BROWSER_PATH,"String_Node_Str",getFieldEditorParent()));
    addField(new StringFieldEditor(BrowserPreferenceConstants.P_TESTCASE_QUERYSTRING,"String_Node_Str",getFieldEditorParent()));
  }
}

Fixed version (ground truth):
public void createFieldEditors(){
  if (System.getProperty("String_Node_Str").equals("String_Node_Str")) {
    addField(new DirectoryFieldEditor(BrowserPreferenceConstants.P_PRIMARY_BROWSER_PATH,"String_Node_Str",getFieldEditorParent()));
    addField(new DirectoryFieldEditor(BrowserPreferenceConstants.P_SECONDARY_BROWSER_PATH,"String_Node_Str",getFieldEditorParent()));
  }
 else {
    addField(new FileFieldEditor(BrowserPreferenceConstants.P_PRIMARY_BROWSER_PATH,"String_Node_Str",getFieldEditorParent()));
    addField(new FileFieldEditor(BrowserPreferenceConstants.P_SECONDARY_BROWSER_PATH,"String_Node_Str",getFieldEditorParent()));
  }
  addField(new StringFieldEditor(BrowserPreferenceConstants.P_TESTCASE_QUERYSTRING,"String_Node_Str",getFieldEditorParent()));
}
Program: 17388
Project: 17388
Buggy source:
public void setActiveEditor(IAction action,IEditorPart targetEditor){
  this.editor=targetEditor;
}

Fixed version (ground truth):
public void setActiveEditor(IAction action,IEditorPart targetEditor){
  if (targetEditor != null) {
    this.editor=targetEditor;
  }
}
Program: 17389
Project: 17389
Buggy source:
public void selectionChanged(IAction action,ISelection selection){
  if (editor != null) {
    setActiveEditor(null,editor.getSite().getPage().getActiveEditor());
  }
}

Fixed version (ground truth):
public void selectionChanged(IAction action,ISelection selection){
  if (editor != null && editor.getSite().getPage().getActiveEditor().getClass().getName() == "String_Node_Str") {
    setActiveEditor(null,editor.getSite().getPage().getActiveEditor());
  }
}
Program: 17390
Project: 17390
Buggy source:
public boolean performOk(){
  IPreferenceStore store=getPreferenceStore();
  store.setValue(CFMLPreferenceConstants.P_TABBED_BROWSER,String.valueOf(tabbedBrowserCheckBox.getSelection()));
  store.setValue(CFMLPreferenceConstants.P_SNIPPETS_PATH,snippetsPathField.getStringValue());
  IProject[] projects=getProjects();
  String templateProject="String_Node_Str";
  if (templateProjectsPathField.getSelectionIndex() > 0) {
    templateProject=projects[templateProjectsPathField.getSelectionIndex() - 1].getFullPath().toString();
  }
  store.setValue(CFMLPreferenceConstants.P_TEMPLATE_PROJECT_PATH,templateProject);
  return true;
}

Fixed version (ground truth):
public boolean performOk(){
  IPreferenceStore store=getPreferenceStore();
  store.setValue(CFMLPreferenceConstants.P_TABBED_BROWSER,String.valueOf(tabbedBrowserCheckBox.getSelection()));
  store.setValue(CFMLPreferenceConstants.P_SNIPPETS_PATH,snippetsPathField.getStringValue());
  IProject[] projects=getProjects();
  String templateProject="String_Node_Str";
  return true;
}
Program: 17391
Project: 17391
Buggy source:
public Object[] getRoots(){
  if (isConnected()) {
    FileSystemRoot root=new FileSystemRoot(connectionProperties.getPath());
    root.setPath(connectionProperties.getPath());
    root.setType(connectionProperties.getType());
    try {
      root.setFileObject(manager.getBaseFile());
    }
 catch (    FileSystemException e) {
      e.printStackTrace();
    }
    return new FileSystemRoot[]{root};
  }
 else   if (connectFailed) {
    return new String[]{CONNECT_FAILED};
  }
 else {
    return new String[]{"String_Node_Str"};
  }
}

Fixed version (ground truth):
public Object[] getRoots(){
  if (isConnected()) {
    FileSystemRoot root=null;
    DefaultFileSystemManager manager2=manager;
    if (connectionProperties.getType().equalsIgnoreCase("String_Node_Str")) {
      ;
      try {
        root=new FileSystemRoot(manager2.getBaseFile().toString());
        root.setPath(manager2.getBaseFile().toString());
      }
 catch (      FileSystemException e) {
        e.printStackTrace();
      }
    }
 else {
      root=new FileSystemRoot(connectionProperties.getPath());
      root.setPath(connectionProperties.getPath());
    }
    root.setType(connectionProperties.getType());
    try {
      root.setFileObject(manager2.getBaseFile());
    }
 catch (    FileSystemException e) {
      e.printStackTrace();
    }
    return new FileSystemRoot[]{root};
  }
 else   if (connectFailed) {
    return new String[]{CONNECT_FAILED};
  }
 else {
    return new String[]{"String_Node_Str"};
  }
}
Program: 17392
Project: 17392
Buggy source:
public Object[] getChildren(String parent,FileNameFilter filter){
  try {
    connect(this.connectionProperties);
    if (connectFailed) {
      return new String[0];
    }
    FileObject initialItem=null;
    if (parent.length() == 0 || parent.equalsIgnoreCase("String_Node_Str")) {
      initialItem=this.manager.getBaseFile();
    }
 else {
      initialItem=this.manager.getBaseFile().resolveFile(parent);
    }
    if (initialItem.getType().equals(FileType.FILE)) {
    }
    FileObject[] files=initialItem.getChildren();
    if (files == null) {
      files=new FileObject[0];
    }
    ArrayList filteredFileList=new ArrayList();
    for (int i=0; i < files.length; i++) {
      if (filter.accept(files[i])) {
        RemoteFile file=new RemoteFile(files[i],files[i].getURL().toString());
        filteredFileList.add(file);
      }
    }
    Object[] filteredFiles=filteredFileList.toArray();
    return filteredFiles;
  }
 catch (  Exception e) {
    AlertUtils.alertUser(e);
  }
  return new String[0];
}

Fixed version (ground truth):
public Object[] getChildren(String parent,FileNameFilter filter){
  try {
    connect(this.connectionProperties);
    if (connectFailed) {
      return new String[0];
    }
    FileObject initialItem=null;
    if (parent.length() == 0 || parent.equalsIgnoreCase("String_Node_Str")) {
      FileObject bfile=this.manager.getBaseFile();
      boolean exists=bfile.exists();
      FileObject[] children=bfile.getChildren();
      initialItem=this.manager.getBaseFile();
    }
 else {
      initialItem=this.manager.getBaseFile().resolveFile(parent);
    }
    if (initialItem.getType().equals(FileType.FILE)) {
      initialItem=this.manager.getBaseFile();
    }
    FileObject[] files=initialItem.getChildren();
    if (files == null) {
      files=new FileObject[0];
    }
    ArrayList filteredFileList=new ArrayList();
    for (int i=0; i < files.length; i++) {
      if (filter.accept(files[i])) {
        RemoteFile file=new RemoteFile(files[i],files[i].getURL().toString());
        filteredFileList.add(file);
      }
    }
    Object[] filteredFiles=filteredFileList.toArray();
    return filteredFiles;
  }
 catch (  Exception e) {
  }
  return new String[0];
}