Program: 30376
Project: 30376
Buggy source:
public boolean passivateEJB(StatefulEJBContext ctx,Serializable sessionKey) throws java.io.NotSerializableException {
  try {
    int hashCode=hash(sessionKey);
    int index=getIndex(hashCode);
    boolean itemRemoved=false;
    CacheItem prev=null, item=null;
synchronized (bucketLocks[index]) {
      for (item=buckets[index]; item != null; item=item.next) {
        if (item.value == ctx) {
          LruCacheItem lruSCItem=(LruCacheItem)item;
          if (lruSCItem.isTrimmed == false) {
            if (_logger.isLoggable(Level.FINE)) {
              _logger.log(Level.FINE,cacheName + "String_Node_Str" + sessionKey);
            }
            return false;
          }
          break;
        }
        prev=item;
      }
      if (item == null) {
        return true;
      }
      if (removeIfIdle) {
        long idleThreshold=System.currentTimeMillis() - removalTimeoutInSeconds * 1000L;
        if (ctx.getLastAccessTime() <= idleThreshold) {
          if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE,cacheName + "String_Node_Str" + "String_Node_Str"+ sessionKey);
          }
          if (prev == null) {
            buckets[index]=item.next;
          }
 else {
            prev.next=item.next;
          }
          item.next=null;
          itemRemoved=true;
        }
      }
    }
    if (itemRemoved) {
      decrementEntryCount();
      incrementRemovalCount();
      return true;
    }
    if (saveStateToStore(sessionKey,ctx) == false) {
      return false;
    }
synchronized (bucketLocks[index]) {
      prev=null;
      for (item=buckets[index]; item != null; item=item.next) {
        if (item.value == ctx) {
          LruCacheItem lruSCItem=(LruCacheItem)item;
          if (lruSCItem.isTrimmed == false) {
            return false;
          }
          if (prev == null) {
            buckets[index]=item.next;
          }
 else {
            prev.next=item.next;
          }
          item.next=null;
          break;
        }
        prev=item;
      }
    }
    if (item != null) {
      decrementEntryCount();
      incrementRemovalCount();
    }
    return true;
  }
 catch (  java.io.NotSerializableException notSerEx) {
    throw notSerEx;
  }
catch (  Exception ex) {
    _logger.log(Level.WARNING,"String_Node_Str" + cacheName + "String_Node_Str",ex);
  }
  return false;
}

Fixed version (ground truth):
public boolean passivateEJB(StatefulEJBContext ctx,Serializable sessionKey) throws java.io.NotSerializableException {
  try {
    int hashCode=hash(sessionKey);
    int index=getIndex(hashCode);
    CacheItem prev=null, item=null;
synchronized (bucketLocks[index]) {
      for (item=buckets[index]; item != null; item=item.next) {
        if (item.value == ctx) {
          LruCacheItem lruSCItem=(LruCacheItem)item;
          if (lruSCItem.isTrimmed == false) {
            if (_logger.isLoggable(Level.FINE)) {
              _logger.log(Level.FINE,cacheName + "String_Node_Str" + sessionKey);
            }
            return false;
          }
          break;
        }
        prev=item;
      }
      if (item == null) {
        return true;
      }
    }
    if (saveStateToStore(sessionKey,ctx) == false) {
      return false;
    }
synchronized (bucketLocks[index]) {
      prev=null;
      for (item=buckets[index]; item != null; item=item.next) {
        if (item.value == ctx) {
          LruCacheItem lruSCItem=(LruCacheItem)item;
          if (lruSCItem.isTrimmed == false) {
            return false;
          }
          if (prev == null) {
            buckets[index]=item.next;
          }
 else {
            prev.next=item.next;
          }
          item.next=null;
          break;
        }
        prev=item;
      }
    }
    if (item != null) {
      decrementEntryCount();
      incrementRemovalCount();
    }
    return true;
  }
 catch (  java.io.NotSerializableException notSerEx) {
    throw notSerEx;
  }
catch (  Exception ex) {
    _logger.log(Level.WARNING,"String_Node_Str" + cacheName + "String_Node_Str",ex);
  }
  return false;
}