nus-yam/ex-repair huggingface dataset:
Program: 47615
Project: 47615
Buggy source:
public ClientHeapNearCache(String mapName,ClientContext context,NearCacheConfig nearCacheConfig){
  this.mapName=mapName;
  this.context=context;
  maxSize=nearCacheConfig.getMaxSize();
  maxIdleMillis=nearCacheConfig.getMaxIdleSeconds() * SEC_TO_MILLISEC;
  inMemoryFormat=nearCacheConfig.getInMemoryFormat();
  if (inMemoryFormat != InMemoryFormat.BINARY && inMemoryFormat != InMemoryFormat.OBJECT) {
    throw new IllegalArgumentException("String_Node_Str" + inMemoryFormat);
  }
  timeToLiveMillis=nearCacheConfig.getTimeToLiveSeconds() * SEC_TO_MILLISEC;
  invalidateOnChange=nearCacheConfig.isInvalidateOnChange();
  evictionPolicy=EvictionPolicy.valueOf(nearCacheConfig.getEvictionPolicy());
  cache=new ConcurrentHashMap<K,CacheRecord<K>>();
  canCleanUp=new AtomicBoolean(true);
  canEvict=new AtomicBoolean(true);
  lastCleanup=Clock.currentTimeMillis();
  stats=new NearCacheStatsImpl();
}

Fixed version (ground truth):
public ClientHeapNearCache(String mapName,ClientContext context,NearCacheConfig nearCacheConfig){
  this.mapName=mapName;
  this.context=context;
  maxSize=nearCacheConfig.getMaxSize();
  maxIdleMillis=TimeUnit.SECONDS.toMillis(nearCacheConfig.getMaxIdleSeconds());
  inMemoryFormat=nearCacheConfig.getInMemoryFormat();
  if (inMemoryFormat != InMemoryFormat.BINARY && inMemoryFormat != InMemoryFormat.OBJECT) {
    throw new IllegalArgumentException("String_Node_Str" + inMemoryFormat);
  }
  timeToLiveMillis=TimeUnit.SECONDS.toMillis(nearCacheConfig.getTimeToLiveSeconds());
  invalidateOnChange=nearCacheConfig.isInvalidateOnChange();
  evictionPolicy=EvictionPolicy.valueOf(nearCacheConfig.getEvictionPolicy());
  if (EvictionPolicy.LRU.equals(evictionPolicy)) {
    selectedComparator=lruComparator;
  }
 else   if (EvictionPolicy.LFU.equals(evictionPolicy)) {
    selectedComparator=lfuComparator;
  }
 else {
    selectedComparator=defaultComparator;
  }
  cache=new ConcurrentHashMap<K,CacheRecord<K>>();
  canCleanUp=new AtomicBoolean(true);
  canEvict=new AtomicBoolean(true);
  lastCleanup=Clock.currentTimeMillis();
  stats=new NearCacheStatsImpl();
}
Program: 47616
Project: 47616
Buggy source:
private void fireEvictCache(){
  if (canEvict.compareAndSet(true,false)) {
    try {
      context.getExecutionService().execute(new Runnable(){
        public void run(){
          try {
            TreeSet<CacheRecord<K>> records=new TreeSet<CacheRecord<K>>(comparator);
            records.addAll(cache.values());
            int evictSize=cache.size() * EVICTION_PERCENTAGE / HUNDRED_PERCENTAGE;
            int i=0;
            for (            CacheRecord<K> record : records) {
              cache.remove(record.key);
              if (++i > evictSize) {
                break;
              }
            }
          }
  finally {
            canEvict.set(true);
          }
        }
      }
);
    }
 catch (    RejectedExecutionException e) {
      canEvict.set(true);
    }
catch (    Exception e) {
      throw ExceptionUtil.rethrow(e);
    }
  }
}

Fixed version (ground truth):
private void fireEvictCache(){
  if (canEvict.compareAndSet(true,false)) {
    try {
      context.getExecutionService().execute(new Runnable(){
        public void run(){
          try {
            TreeSet<CacheRecord<K>> records=new TreeSet<CacheRecord<K>>(selectedComparator);
            records.addAll(cache.values());
            int evictSize=cache.size() * EVICTION_PERCENTAGE / HUNDRED_PERCENTAGE;
            int i=0;
            for (            CacheRecord<K> record : records) {
              cache.remove(record.key);
              if (++i > evictSize) {
                break;
              }
            }
          }
  finally {
            canEvict.set(true);
          }
        }
      }
);
    }
 catch (    RejectedExecutionException e) {
      canEvict.set(true);
    }
catch (    Exception e) {
      throw ExceptionUtil.rethrow(e);
    }
  }
}
Program: 47617
Project: 47617
Buggy source:
@Override public void run() throws Exception {
  final LocalMapStats localMapStats=clientMap.getLocalMapStats();
  NearCacheStats stats=localMapStats.getNearCacheStats();
  assertEquals(1,stats.getOwnedEntryCount());
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  assertTrue(MAX_CACHE_SIZE > stats.getOwnedEntryCount());
}
Program: 47619
Project: 47619
Buggy source:
/** 
 * @param mapName    name of map which owns near cache.
 * @param nodeEngine node engine.
 */
public NearCache(String mapName,NodeEngine nodeEngine){
  this.nodeEngine=nodeEngine;
  Config config=nodeEngine.getConfig();
  NearCacheConfig nearCacheConfig=config.findMapConfig(mapName).getNearCacheConfig();
  maxSize=nearCacheConfig.getMaxSize() <= 0 ? Integer.MAX_VALUE : nearCacheConfig.getMaxSize();
  maxIdleMillis=TimeUnit.SECONDS.toMillis(nearCacheConfig.getMaxIdleSeconds());
  inMemoryFormat=nearCacheConfig.getInMemoryFormat();
  timeToLiveMillis=TimeUnit.SECONDS.toMillis(nearCacheConfig.getTimeToLiveSeconds());
  evictionPolicy=EvictionPolicy.valueOf(nearCacheConfig.getEvictionPolicy());
  cache=new ConcurrentHashMap<Data,CacheRecord>();
  canCleanUp=new AtomicBoolean(true);
  canEvict=new AtomicBoolean(true);
  nearCacheStats=new NearCacheStatsImpl();
  lastCleanup=Clock.currentTimeMillis();
  serializationService=nodeEngine.getSerializationService();
}

Fixed version (ground truth):
/** 
 * @param mapName    name of map which owns near cache.
 * @param nodeEngine node engine.
 */
public NearCache(String mapName,NodeEngine nodeEngine){
  this.nodeEngine=nodeEngine;
  Config config=nodeEngine.getConfig();
  NearCacheConfig nearCacheConfig=config.findMapConfig(mapName).getNearCacheConfig();
  maxSize=nearCacheConfig.getMaxSize() <= 0 ? Integer.MAX_VALUE : nearCacheConfig.getMaxSize();
  maxIdleMillis=TimeUnit.SECONDS.toMillis(nearCacheConfig.getMaxIdleSeconds());
  inMemoryFormat=nearCacheConfig.getInMemoryFormat();
  timeToLiveMillis=TimeUnit.SECONDS.toMillis(nearCacheConfig.getTimeToLiveSeconds());
  evictionPolicy=EvictionPolicy.valueOf(nearCacheConfig.getEvictionPolicy());
  if (EvictionPolicy.LRU.equals(evictionPolicy)) {
    selectedComparator=lruComparator;
  }
 else   if (EvictionPolicy.LFU.equals(evictionPolicy)) {
    selectedComparator=lfuComparator;
  }
 else {
    selectedComparator=defaultComparator;
  }
  cache=new ConcurrentHashMap<Data,CacheRecord>();
  canCleanUp=new AtomicBoolean(true);
  canEvict=new AtomicBoolean(true);
  nearCacheStats=new NearCacheStatsImpl();
  lastCleanup=Clock.currentTimeMillis();
  serializationService=nodeEngine.getSerializationService();
}
Program: 47620
Project: 47620
Buggy source:
private void fireEvictCache(){
  if (canEvict.compareAndSet(true,false)) {
    try {
      nodeEngine.getExecutionService().execute("String_Node_Str",new Runnable(){
        public void run(){
          try {
            TreeSet<CacheRecord> records=new TreeSet<CacheRecord>(cache.values());
            int evictSize=cache.size() * EVICTION_PERCENTAGE / HUNDRED_PERCENT;
            int i=0;
            for (            CacheRecord record : records) {
              cache.remove(record.key);
              updateSizeEstimator(-calculateCost(record));
              if (++i > evictSize) {
                break;
              }
            }
          }
  finally {
            canEvict.set(true);
          }
        }
      }
);
    }
 catch (    RejectedExecutionException e) {
      canEvict.set(true);
    }
catch (    Exception e) {
      throw ExceptionUtil.rethrow(e);
    }
  }
}

Fixed version (ground truth):
private void fireEvictCache(){
  if (canEvict.compareAndSet(true,false)) {
    try {
      nodeEngine.getExecutionService().execute("String_Node_Str",new Runnable(){
        public void run(){
          try {
            TreeSet<CacheRecord> records=new TreeSet<CacheRecord>(selectedComparator);
            records.addAll(cache.values());
            int evictSize=cache.size() * EVICTION_PERCENTAGE / HUNDRED_PERCENT;
            int i=0;
            for (            CacheRecord record : records) {
              cache.remove(record.key);
              updateSizeEstimator(-calculateCost(record));
              if (++i > evictSize) {
                break;
              }
            }
          }
  finally {
            canEvict.set(true);
          }
        }
      }
);
    }
 catch (    RejectedExecutionException e) {
      canEvict.set(true);
    }
catch (    Exception e) {
      throw ExceptionUtil.rethrow(e);
    }
  }
}
Program: 47621
Project: 47621
Buggy source:
/** 
 * Return true if input argument is power of two. Input has to be a a positive integer. Result is undefined for zero or negative integers.
 * @param x
 * @return <code>true</code> if <code>x</code> is power of two
 */
public static boolean isPowerOfTwo(long x){
  return (x & (x - 1)) == 0;
}

Fixed version (ground truth):
/** 
 * Return true if input argument is power of two. Input has to be a a positive integer. <p/> Result is undefined for zero or negative integers.
 * @param x
 * @return <code>true</code> if <code>x</code> is power of two
 */
public static boolean isPowerOfTwo(long x){
  return (x & (x - 1)) == 0;
}
Program: 47622
Project: 47622
Buggy source:
ClusterClock getClusterClock();

Fixed version (ground truth):
/** 
 * Returns the   {@link com.hazelcast.cluster.ClusterClock} of the cluster.The returned value will never be null and will never change.
 * @return the ClusterClock.
 */
ClusterClock getClusterClock();
Program: 47623
Project: 47623
Buggy source:
private void createMemState(MemberStateImpl memberState,Collection<DistributedObject> distributedObjects){
  int count=0;
  final Config config=instance.getConfig();
  final Iterator<DistributedObject> iterator=distributedObjects.iterator();
  while (iterator.hasNext() && count < maxVisibleInstanceCount) {
    DistributedObject distributedObject=iterator.next();
    if (distributedObject instanceof IQueue) {
      count=handleQueue(memberState,count,config,(IQueue)distributedObject);
    }
 else     if (distributedObject instanceof ITopic) {
      count=handleTopic(memberState,count,config,(ITopic)distributedObject);
    }
 else     if (distributedObject instanceof MultiMap) {
      count=handleMultimap(memberState,count,config,(MultiMap)distributedObject);
    }
 else     if (distributedObject instanceof IExecutorService) {
      count=handleExecutorService(memberState,count,config,(IExecutorService)distributedObject);
    }
 else {
      logger.finest("String_Node_Str" + distributedObject.getName());
    }
  }
  count=handleMap(memberState,count,config,getMapStats());
  if (cacheServiceEnabled) {
    final ICacheService cacheService=getCacheService();
    for (    CacheConfig cacheConfig : cacheService.getCacheConfigs()) {
      if (cacheConfig.isStatisticsEnabled()) {
        CacheStatistics statistics=cacheService.getStatistics(cacheConfig.getNameWithPrefix());
        count=handleCache(memberState,count,cacheConfig,statistics);
      }
    }
  }
}

Fixed version (ground truth):
private void createMemState(MemberStateImpl memberState,Collection<DistributedObject> distributedObjects){
  int count=0;
  final Config config=instance.getConfig();
  final Iterator<DistributedObject> iterator=distributedObjects.iterator();
  while (iterator.hasNext() && count < maxVisibleInstanceCount) {
    DistributedObject distributedObject=iterator.next();
    if (distributedObject instanceof IQueue) {
      count=handleQueue(memberState,count,config,(IQueue)distributedObject);
    }
 else     if (distributedObject instanceof ITopic) {
      count=handleTopic(memberState,count,config,(ITopic)distributedObject);
    }
 else     if (distributedObject instanceof MultiMap) {
      count=handleMultimap(memberState,count,config,(MultiMap)distributedObject);
    }
 else     if (distributedObject instanceof IExecutorService) {
      count=handleExecutorService(memberState,count,config,(IExecutorService)distributedObject);
    }
 else {
      logger.finest("String_Node_Str" + distributedObject.getName());
    }
  }
  count=handleMap(memberState,count,getMapStats());
  if (cacheServiceEnabled) {
    final ICacheService cacheService=getCacheService();
    for (    CacheConfig cacheConfig : cacheService.getCacheConfigs()) {
      if (cacheConfig.isStatisticsEnabled()) {
        CacheStatistics statistics=cacheService.getStatistics(cacheConfig.getNameWithPrefix());
        count=handleCache(memberState,count,cacheConfig,statistics);
      }
    }
  }
}
Program: 47624
Project: 47624
Buggy source:
private int handleMap(MemberStateImpl memberState,int count,Config config,Map<String,LocalMapStatsImpl> maps){
  for (  String mapName : maps.keySet()) {
    if (count >= maxVisibleInstanceCount) {
      break;
    }
 else {
      memberState.putLocalMapStats(mapName,maps.get(mapName));
      count=count + 1;
    }
  }
  return count;
}

Fixed version (ground truth):
private int handleMap(MemberStateImpl memberState,int count,Map<String,LocalMapStatsImpl> maps){
  for (  Map.Entry<String,LocalMapStatsImpl> entry : maps.entrySet()) {
    if (count >= maxVisibleInstanceCount) {
      break;
    }
 else {
      memberState.putLocalMapStats(entry.getKey(),entry.getValue());
      count=count + 1;
    }
  }
  return count;
}
Program: 47625
Project: 47625
Buggy source:
private OperationThread[] initPartitionThreads(GroupProperties groupProperties){
  int threadCount=groupProperties.PARTITION_OPERATION_THREAD_COUNT.getInteger();
  if (threadCount <= 0) {
    int coreSize=Runtime.getRuntime().availableProcessors();
    threadCount=Math.max(2,coreSize);
  }
  PartitionOperationThreadFactory threadFactory=new PartitionOperationThreadFactory();
  OperationThread[] threads=new OperationThread[threadCount];
  for (int threadId=0; threadId < threads.length; threadId++) {
    OperationThread operationThread=threadFactory.newThread(null);
    threads[threadId]=operationThread;
    operationThread.start();
  }
  return threads;
}

Fixed version (ground truth):
private OperationThread[] initPartitionThreads(GroupProperties groupProperties){
  int threadCount=groupProperties.PARTITION_OPERATION_THREAD_COUNT.getInteger();
  if (threadCount <= 0) {
    int coreSize=Runtime.getRuntime().availableProcessors();
    threadCount=Math.max(2,coreSize);
  }
  OperationThread[] threads=new OperationThread[threadCount];
  for (int threadId=0; threadId < threads.length; threadId++) {
    String threadName=threadGroup.getThreadPoolNamePrefix("String_Node_Str") + threadId;
    LinkedBlockingQueue workQueue=new LinkedBlockingQueue();
    ConcurrentLinkedQueue priorityWorkQueue=new ConcurrentLinkedQueue();
    OperationThread operationThread=new OperationThread(threadName,true,threadId,workQueue,priorityWorkQueue);
    threads[threadId]=operationThread;
    operationThread.start();
  }
  return threads;
}
Program: 47626
Project: 47626
Buggy source:
private OperationThread[] initGenericThreads(GroupProperties groupProperties){
  int threadCount=groupProperties.GENERIC_OPERATION_THREAD_COUNT.getInteger();
  if (threadCount <= 0) {
    int coreSize=Runtime.getRuntime().availableProcessors();
    threadCount=Math.max(2,coreSize / 2);
  }
  GenericOperationThreadFactory threadFactory=new GenericOperationThreadFactory();
  OperationThread[] threads=new OperationThread[threadCount];
  for (int threadId=0; threadId < threads.length; threadId++) {
    OperationThread operationThread=threadFactory.newThread(null);
    threads[threadId]=operationThread;
    operationThread.start();
  }
  return threads;
}

Fixed version (ground truth):
private OperationThread[] initGenericThreads(GroupProperties groupProperties){
  int threadCount=groupProperties.GENERIC_OPERATION_THREAD_COUNT.getInteger();
  if (threadCount <= 0) {
    int coreSize=Runtime.getRuntime().availableProcessors();
    threadCount=Math.max(2,coreSize / 2);
  }
  OperationThread[] threads=new OperationThread[threadCount];
  for (int threadId=0; threadId < threads.length; threadId++) {
    String threadName=threadGroup.getThreadPoolNamePrefix("String_Node_Str") + threadId;
    OperationThread operationThread=new OperationThread(threadName,false,threadId,genericWorkQueue,genericPriorityWorkQueue);
    threads[threadId]=operationThread;
    operationThread.start();
  }
  return threads;
}
Program: 47627
Project: 47627
Buggy source:
private int handleExecutorService(MemberStateImpl memberState,int count,Config config,Map<String,LocalExecutorStats> executorServices){
  for (  String name : executorServices.keySet()) {
    if (count >= maxVisibleInstanceCount) {
      break;
    }
 else     if (config.findExecutorConfig(name).isStatisticsEnabled()) {
      memberState.putLocalExecutorStats(name,executorServices.get(name));
      ++count;
    }
  }
  return count;
}

Fixed version (ground truth):
private int handleExecutorService(MemberStateImpl memberState,int count,Config config,Map<String,LocalExecutorStats> executorServices){
  for (  Map.Entry<String,LocalExecutorStats> entry : executorServices.entrySet()) {
    String name=entry.getKey();
    if (count >= maxVisibleInstanceCount) {
      break;
    }
 else     if (config.findExecutorConfig(name).isStatisticsEnabled()) {
      LocalExecutorStats stats=entry.getValue();
      memberState.putLocalExecutorStats(name,stats);
      ++count;
    }
  }
  return count;
}
Program: 47628
Project: 47628
Buggy source:
private int handleMap(MemberStateImpl memberState,int count,Config config,Map<String,LocalMapStats> maps){
  for (  String mapName : maps.keySet()) {
    if (count >= maxVisibleInstanceCount) {
      break;
    }
 else     if (config.findMapConfig(mapName).isStatisticsEnabled()) {
      memberState.putLocalMapStats(mapName,maps.get(mapName));
      count=count + 1;
    }
  }
  return count;
}

Fixed version (ground truth):
private int handleMap(MemberStateImpl memberState,int count,Config config,Map<String,LocalMapStats> maps){
  for (  Map.Entry<String,LocalMapStats> entry : maps.entrySet()) {
    String name=entry.getKey();
    if (count >= maxVisibleInstanceCount) {
      break;
    }
 else     if (config.findMapConfig(name).isStatisticsEnabled()) {
      LocalMapStats stats=entry.getValue();
      memberState.putLocalMapStats(name,stats);
      ++count;
    }
  }
  return count;
}
Program: 47629
Project: 47629
Buggy source:
private int handleQueue(MemberStateImpl memberState,int count,Config config,Map<String,LocalQueueStats> queues){
  for (  String name : queues.keySet()) {
    if (count >= maxVisibleInstanceCount) {
      break;
    }
 else     if (config.findQueueConfig(name).isStatisticsEnabled()) {
      memberState.putLocalQueueStats(name,queues.get(name));
      ++count;
    }
  }
  return count;
}

Fixed version (ground truth):
private int handleQueue(MemberStateImpl memberState,int count,Config config,Map<String,LocalQueueStats> queues){
  for (  Map.Entry<String,LocalQueueStats> entry : queues.entrySet()) {
    String name=entry.getKey();
    if (count >= maxVisibleInstanceCount) {
      break;
    }
 else     if (config.findQueueConfig(name).isStatisticsEnabled()) {
      LocalQueueStats stats=entry.getValue();
      memberState.putLocalQueueStats(name,stats);
      ++count;
    }
  }
  return count;
}
Program: 47630
Project: 47630
Buggy source:
private int handleTopic(MemberStateImpl memberState,int count,Config config,Map<String,LocalTopicStats> topics){
  for (  String name : topics.keySet()) {
    if (count >= maxVisibleInstanceCount) {
      break;
    }
 else     if (config.findTopicConfig(name).isStatisticsEnabled()) {
      memberState.putLocalTopicStats(name,topics.get(name));
      ++count;
    }
  }
  return count;
}

Fixed version (ground truth):
private int handleTopic(MemberStateImpl memberState,int count,Config config,Map<String,LocalTopicStats> topics){
  for (  Map.Entry<String,LocalTopicStats> entry : topics.entrySet()) {
    String name=entry.getKey();
    if (count >= maxVisibleInstanceCount) {
      break;
    }
 else     if (config.findTopicConfig(name).isStatisticsEnabled()) {
      LocalTopicStats stats=entry.getValue();
      memberState.putLocalTopicStats(name,stats);
      ++count;
    }
  }
  return count;
}
Program: 47631
Project: 47631
Buggy source:
private int handleMultimap(MemberStateImpl memberState,int count,Config config,Map<String,LocalMultiMapStats> multiMaps){
  for (  String name : multiMaps.keySet()) {
    if (count >= maxVisibleInstanceCount) {
      break;
    }
 else     if (config.findMultiMapConfig(name).isStatisticsEnabled()) {
      memberState.putLocalMultiMapStats(name,multiMaps.get(name));
      ++count;
    }
  }
  return count;
}

Fixed version (ground truth):
private int handleMultimap(MemberStateImpl memberState,int count,Config config,Map<String,LocalMultiMapStats> multiMaps){
  for (  Map.Entry<String,LocalMultiMapStats> entry : multiMaps.entrySet()) {
    String name=entry.getKey();
    if (count >= maxVisibleInstanceCount) {
      break;
    }
 else     if (config.findMultiMapConfig(name).isStatisticsEnabled()) {
      LocalMultiMapStats stats=entry.getValue();
      memberState.putLocalMultiMapStats(name,stats);
      ++count;
    }
  }
  return count;
}
Program: 47632
Project: 47632
Buggy source:
@Override public Map<Integer,List<DelayedEntry>> process(List<DelayedEntry> delayedEntries){
  Map<Integer,List<DelayedEntry>> failMap;
  sort(delayedEntries);
  if (writeBatchSize > 1) {
    failMap=doStoreUsingBatchSize(delayedEntries);
  }
 else {
    failMap=processInternal((List)delayedEntries);
  }
  return failMap;
}

Fixed version (ground truth):
@Override public Map<Integer,List<DelayedEntry>> process(List<DelayedEntry> delayedEntries){
  Map<Integer,List<DelayedEntry>> failMap;
  sort(delayedEntries);
  if (writeBatchSize > 1) {
    failMap=doStoreUsingBatchSize(delayedEntries);
  }
 else {
    failMap=processInternal(delayedEntries);
  }
  return failMap;
}
Program: 47633
Project: 47633
Buggy source:
/** 
 * Store chunk by chunk using write batch size   {@link #writeBatchSize}
 * @param sortedDelayedEntries entries to be stored.
 * @return not-stored entries per partition.
 */
private Map<Integer,List<DelayedEntry>> doStoreUsingBatchSize(Collection<DelayedEntry> sortedDelayedEntries){
  final Map<Integer,List<DelayedEntry>> failsPerPartition=new HashMap<Integer,List<DelayedEntry>>();
  int page=0;
  List<DelayedEntry> delayedEntryList;
  while ((delayedEntryList=getBatchChunk((List)sortedDelayedEntries,writeBatchSize,page++)) != null) {
    final Map<Integer,List<DelayedEntry>> fails=processInternal(delayedEntryList);
    final Set<Map.Entry<Integer,List<DelayedEntry>>> entries=fails.entrySet();
    for (    Map.Entry<Integer,List<DelayedEntry>> entry : entries) {
      final Integer partitionId=entry.getKey();
      final List<DelayedEntry> tmpFailList=entry.getValue();
      List<DelayedEntry> failList=failsPerPartition.get(partitionId);
      if (failList == null || failList.isEmpty()) {
        failsPerPartition.put(partitionId,tmpFailList);
        failList=failsPerPartition.get(partitionId);
      }
      failList.addAll(tmpFailList);
    }
  }
  return failsPerPartition;
}

Fixed version (ground truth):
/** 
 * Store chunk by chunk using write batch size   {@link #writeBatchSize}
 * @param sortedDelayedEntries entries to be stored.
 * @return not-stored entries per partition.
 */
private Map<Integer,List<DelayedEntry>> doStoreUsingBatchSize(List<DelayedEntry> sortedDelayedEntries){
  final Map<Integer,List<DelayedEntry>> failsPerPartition=new HashMap<Integer,List<DelayedEntry>>();
  int page=0;
  List<DelayedEntry> delayedEntryList;
  while ((delayedEntryList=getBatchChunk(sortedDelayedEntries,writeBatchSize,page++)) != null) {
    final Map<Integer,List<DelayedEntry>> fails=processInternal(delayedEntryList);
    final Set<Map.Entry<Integer,List<DelayedEntry>>> entries=fails.entrySet();
    for (    Map.Entry<Integer,List<DelayedEntry>> entry : entries) {
      final Integer partitionId=entry.getKey();
      final List<DelayedEntry> tmpFailList=entry.getValue();
      List<DelayedEntry> failList=failsPerPartition.get(partitionId);
      if (failList == null || failList.isEmpty()) {
        failsPerPartition.put(partitionId,tmpFailList);
        failList=failsPerPartition.get(partitionId);
      }
      failList.addAll(tmpFailList);
    }
  }
  return failsPerPartition;
}
Program: 47634
Project: 47634
Buggy source:
@Override public synchronized void start(){
  if (alive) {
    return;
  }
  alive=true;
  inSelector.start();
  outSelector.start();
  HeartBeat heartBeat=new HeartBeat();
  executionService.scheduleWithFixedDelay(heartBeat,heartBeatInterval,heartBeatInterval,TimeUnit.MILLISECONDS);
  invocationService=client.getInvocationService();
}

Fixed version (ground truth):
@Override public synchronized void start(){
  if (alive) {
    return;
  }
  alive=true;
  inSelector.start();
  outSelector.start();
  HeartBeat heartBeat=new HeartBeat();
  executionService.scheduleWithFixedDelay(heartBeat,heartBeatInterval,heartBeatInterval,TimeUnit.MILLISECONDS);
}
Program: 47635
Project: 47635
Buggy source:
@Override public void handlePacket(Packet packet){
  final ClientConnection conn=(ClientConnection)packet.getConn();
  conn.incrementPacketCount();
  if (packet.isHeaderSet(Packet.HEADER_EVENT)) {
    final ClientListenerServiceImpl listenerService=(ClientListenerServiceImpl)client.getListenerService();
    listenerService.handleEventPacket(packet);
  }
 else {
    invocationService.handlePacket(packet);
  }
}

Fixed version (ground truth):
@Override public void handlePacket(Packet packet){
  final ClientConnection conn=(ClientConnection)packet.getConn();
  conn.incrementPacketCount();
  if (packet.isHeaderSet(Packet.HEADER_EVENT)) {
    final ClientListenerServiceImpl listenerService=(ClientListenerServiceImpl)client.getListenerService();
    listenerService.handleEventPacket(packet);
  }
 else {
    ClientInvocationService invocationService=client.getInvocationService();
    invocationService.handlePacket(packet);
  }
}
Program: 47637
Project: 47637
Buggy source:
private <T>T lookupByPattern(Map<String,T> configPatterns,String itemName){
  T candidate=configPatterns.get(itemName);
  if (candidate != null) {
    return candidate;
  }
  String configPatternKey=configPatternMatcher.matches(configPatterns.keySet(),itemName);
  if (configPatternKey != null) {
    return configPatterns.get(configPatternKey);
  }
  LOGGER.warning("String_Node_Str" + itemName + "String_Node_Str");
  return null;
}

Fixed version (ground truth):
private <T>T lookupByPattern(Map<String,T> configPatterns,String itemName){
  T candidate=configPatterns.get(itemName);
  if (candidate != null) {
    return candidate;
  }
  String configPatternKey=configPatternMatcher.matches(configPatterns.keySet(),itemName);
  if (configPatternKey != null) {
    return configPatterns.get(configPatternKey);
  }
  if (!"String_Node_Str".equals(itemName)) {
    LOGGER.warning("String_Node_Str" + itemName + "String_Node_Str");
  }
  return null;
}
Program: 47638
Project: 47638
Buggy source:
private <T>T lookupByPattern(Map<String,T> configPatterns,String itemName){
  T candidate=configPatterns.get(itemName);
  if (candidate != null) {
    return candidate;
  }
  String configPatternKey=configPatternMatcher.matches(configPatterns.keySet(),itemName);
  if (configPatternKey != null) {
    return configPatterns.get(configPatternKey);
  }
  LOGGER.warning("String_Node_Str" + itemName + "String_Node_Str");
  return null;
}

Fixed version (ground truth):
private <T>T lookupByPattern(Map<String,T> configPatterns,String itemName){
  T candidate=configPatterns.get(itemName);
  if (candidate != null) {
    return candidate;
  }
  String configPatternKey=configPatternMatcher.matches(configPatterns.keySet(),itemName);
  if (configPatternKey != null) {
    return configPatterns.get(configPatternKey);
  }
  if (!"String_Node_Str".equals(itemName)) {
    LOGGER.warning("String_Node_Str" + itemName + "String_Node_Str");
  }
  return null;
}
Program: 47639
Project: 47639
Buggy source:
private static <T>T lookupByPattern(Map<String,T> map,String name){
  T t=map.get(name);
  if (t == null) {
    int lastMatchingPoint=-1;
    for (    Map.Entry<String,T> entry : map.entrySet()) {
      String pattern=entry.getKey();
      T value=entry.getValue();
      final int matchingPoint=getMatchingPoint(name,pattern);
      if (matchingPoint > lastMatchingPoint) {
        lastMatchingPoint=matchingPoint;
        t=value;
      }
    }
  }
  return t;
}

Fixed version (ground truth):
private <T>T lookupByPattern(Map<String,T> configPatterns,String itemName){
  T candidate=configPatterns.get(itemName);
  if (candidate != null) {
    return candidate;
  }
  String configPatternKey=configPatternMatcher.matches(configPatterns.keySet(),itemName);
  if (configPatternKey != null) {
    return configPatterns.get(configPatternKey);
  }
  LOGGER.warning("String_Node_Str" + itemName + "String_Node_Str");
  return null;
}
Program: 47640
Project: 47640
Buggy source:
/** 
 * Utility method that creates an   {@link java.util.HashMap} with its initialCapacity calculatedto minimize rehash operations
 */
public static <K,V>Map<K,V> createHashMap(int expectedMapSize){
  int initialCapacity=(int)(expectedMapSize * HASHMAP_DEFAULT_LOAD_FACTOR) + 1;
  return new HashMap<K,V>(initialCapacity);
}

Fixed version (ground truth):
/** 
 * Utility method that creates an   {@link java.util.HashMap} with its initialCapacity calculatedto minimize rehash operations
 */
public static <K,V>Map<K,V> createHashMap(int expectedMapSize){
  int initialCapacity=(int)(expectedMapSize / HASHMAP_DEFAULT_LOAD_FACTOR) + 1;
  return new HashMap<K,V>(initialCapacity);
}
Program: 47641
Project: 47641
Buggy source:
private ClientConnection getOrConnect(Address target,Authenticator authenticator) throws Exception {
  if (!smartRouting) {
    target=ownerConnectionFuture.getOrWaitForCreation().getEndPoint();
  }
  Address address=addressTranslator.translate(target);
  if (address == null) {
    throw new IOException("String_Node_Str");
  }
  ClientConnection clientConnection=connections.get(target);
  if (clientConnection == null) {
    final Object lock=getLock(target);
synchronized (lock) {
      clientConnection=connections.get(target);
      if (clientConnection == null) {
        final ConnectionProcessor connectionProcessor=new ConnectionProcessor(address,authenticator,false);
        final ICompletableFuture<ClientConnection> future=executionService.submitInternal(connectionProcessor);
        try {
          clientConnection=future.get(connectionTimeout,TimeUnit.MILLISECONDS);
        }
 catch (        Exception e) {
          future.cancel(true);
          throw ExceptionUtil.rethrow(e,IOException.class);
        }
        ClientConnection current=connections.putIfAbsent(clientConnection.getRemoteEndpoint(),clientConnection);
        if (current != null) {
          clientConnection.close();
          clientConnection=current;
        }
      }
    }
  }
  return clientConnection;
}

Fixed version (ground truth):
private ClientConnection getOrConnect(Address target,Authenticator authenticator) throws Exception {
  if (!smartRouting) {
    target=ownerConnectionFuture.getOrWaitForCreation().getEndPoint();
  }
  Address address=addressTranslator.translate(target);
  if (address == null) {
    throw new IOException("String_Node_Str");
  }
  ClientConnection clientConnection=connections.get(target);
  if (clientConnection == null) {
    final Object lock=getLock(target);
synchronized (lock) {
      clientConnection=connections.get(target);
      if (clientConnection == null) {
        final ConnectionProcessor connectionProcessor=new ConnectionProcessor(address,authenticator,false);
        final ICompletableFuture<ClientConnection> future=executionService.submitInternal(connectionProcessor);
        try {
          clientConnection=future.get(connectionTimeout,TimeUnit.MILLISECONDS);
        }
 catch (        TimeoutException e) {
          throw new IOException(e);
        }
catch (        Exception e) {
          future.cancel(true);
          throw ExceptionUtil.rethrow(e,IOException.class);
        }
        ClientConnection current=connections.putIfAbsent(clientConnection.getRemoteEndpoint(),clientConnection);
        if (current != null) {
          clientConnection.close();
          clientConnection=current;
        }
      }
    }
  }
  return clientConnection;
}
Program: 47642
Project: 47642
Buggy source:
private ClientConnection getOrConnect(Address target,Authenticator authenticator) throws Exception {
  if (!smartRouting) {
    target=ownerConnectionFuture.getOrWaitForCreation().getEndPoint();
  }
  Address address=addressTranslator.translate(target);
  if (address == null) {
    throw new IOException("String_Node_Str");
  }
  ClientConnection clientConnection=connections.get(target);
  if (clientConnection == null) {
    final Object lock=getLock(target);
synchronized (lock) {
      clientConnection=connections.get(target);
      if (clientConnection == null) {
        final ConnectionProcessor connectionProcessor=new ConnectionProcessor(address,authenticator,false);
        final ICompletableFuture<ClientConnection> future=executionService.submitInternal(connectionProcessor);
        try {
          clientConnection=future.get(connectionTimeout,TimeUnit.MILLISECONDS);
        }
 catch (        Exception e) {
          future.cancel(true);
          throw ExceptionUtil.rethrow(e,IOException.class);
        }
        ClientConnection current=connections.putIfAbsent(clientConnection.getRemoteEndpoint(),clientConnection);
        if (current != null) {
          clientConnection.close();
          clientConnection=current;
        }
      }
    }
  }
  return clientConnection;
}

Fixed version (ground truth):
private ClientConnection getOrConnect(Address target,Authenticator authenticator) throws Exception {
  if (!smartRouting) {
    target=ownerConnectionFuture.getOrWaitForCreation().getEndPoint();
  }
  Address address=addressTranslator.translate(target);
  if (address == null) {
    throw new IOException("String_Node_Str");
  }
  ClientConnection clientConnection=connections.get(target);
  if (clientConnection == null) {
    final Object lock=getLock(target);
synchronized (lock) {
      clientConnection=connections.get(target);
      if (clientConnection == null) {
        final ConnectionProcessor connectionProcessor=new ConnectionProcessor(address,authenticator,false);
        final ICompletableFuture<ClientConnection> future=executionService.submitInternal(connectionProcessor);
        try {
          clientConnection=future.get(connectionTimeout,TimeUnit.MILLISECONDS);
        }
 catch (        TimeoutException e) {
          throw new IOException(e);
        }
catch (        Exception e) {
          future.cancel(true);
          throw ExceptionUtil.rethrow(e,IOException.class);
        }
        ClientConnection current=connections.putIfAbsent(clientConnection.getRemoteEndpoint(),clientConnection);
        if (current != null) {
          clientConnection.close();
          clientConnection=current;
        }
      }
    }
  }
  return clientConnection;
}
Program: 47643
Project: 47643
Buggy source:
@Test public void testMapDestroyIssue764() throws Exception {
  final HazelcastInstance instance=Hazelcast.newHazelcastInstance();
  HazelcastInstance client=HazelcastClient.newHazelcastClient();
  assertEquals(0,client.getDistributedObjects().size());
  IMap map=client.getMap("String_Node_Str");
  assertEquals(1,client.getDistributedObjects().size());
  map.destroy();
  assertEquals(0,instance.getDistributedObjects().size());
  assertEquals(0,client.getDistributedObjects().size());
}

Fixed version (ground truth):
@Test public void testMapDestroyIssue764() throws Exception {
  HazelcastInstance server=Hazelcast.newHazelcastInstance();
  HazelcastInstance client=HazelcastClient.newHazelcastClient();
  assertNoOfDistributedObject("String_Node_Str",0,server.getDistributedObjects());
  assertNoOfDistributedObject("String_Node_Str",0,client.getDistributedObjects());
  IMap map=client.getMap("String_Node_Str");
  assertNoOfDistributedObject("String_Node_Str",1,server.getDistributedObjects());
  assertNoOfDistributedObject("String_Node_Str",1,client.getDistributedObjects());
  map.destroy();
  Collection<DistributedObject> serverDistributedObjects=server.getDistributedObjects();
  Collection<DistributedObject> clientDistributedObjects=client.getDistributedObjects();
  assertNoOfDistributedObject("String_Node_Str",0,serverDistributedObjects);
  assertNoOfDistributedObject("String_Node_Str",0,clientDistributedObjects);
}
Program: 47644
Project: 47644
Buggy source:
@Test public void testMapDestroyIssue764() throws Exception {
  final HazelcastInstance instance=Hazelcast.newHazelcastInstance();
  HazelcastInstance client=HazelcastClient.newHazelcastClient();
  assertEquals(0,client.getDistributedObjects().size());
  IMap map=client.getMap("String_Node_Str");
  assertEquals(1,client.getDistributedObjects().size());
  map.destroy();
  assertEquals(0,instance.getDistributedObjects().size());
  assertEquals(0,client.getDistributedObjects().size());
}

Fixed version (ground truth):
@Test public void testMapDestroyIssue764() throws Exception {
  HazelcastInstance server=Hazelcast.newHazelcastInstance();
  HazelcastInstance client=HazelcastClient.newHazelcastClient();
  assertNoOfDistributedObject("String_Node_Str",0,server.getDistributedObjects());
  assertNoOfDistributedObject("String_Node_Str",0,client.getDistributedObjects());
  IMap map=client.getMap("String_Node_Str");
  assertNoOfDistributedObject("String_Node_Str",1,server.getDistributedObjects());
  assertNoOfDistributedObject("String_Node_Str",1,client.getDistributedObjects());
  map.destroy();
  Collection<DistributedObject> serverDistributedObjects=server.getDistributedObjects();
  Collection<DistributedObject> clientDistributedObjects=client.getDistributedObjects();
  assertNoOfDistributedObject("String_Node_Str",0,serverDistributedObjects);
  assertNoOfDistributedObject("String_Node_Str",0,clientDistributedObjects);
}
Program: 47645
Project: 47645
Buggy source:
private void assertRecord(ReplicatedRecord<String,String> record,long startTime){
  long hits=record.getHits();
  long lastAccessTime=record.getLastAccessTime();
  long now=Clock.currentTimeMillis();
  assertEquals(String.format("String_Node_Str",1,hits),1,hits);
  assertTrue(String.format("String_Node_Str",lastAccessTime,startTime),lastAccessTime > startTime);
  assertTrue(String.format("String_Node_Str",lastAccessTime,now),lastAccessTime <= now);
}

Fixed version (ground truth):
private void assertRecord(ReplicatedRecord<String,String> record,long startTime){
  long hits=record.getHits();
  long lastAccessTime=record.getLastAccessTime();
  long now=Clock.currentTimeMillis();
  assertTrue(String.format("String_Node_Str",hits,0),hits > 0);
  assertTrue(String.format("String_Node_Str",hits,1000),hits < 1000);
  assertTrue(String.format("String_Node_Str",lastAccessTime,startTime),lastAccessTime > startTime);
  assertTrue(String.format("String_Node_Str",lastAccessTime,now),lastAccessTime <= now);
}
Program: 47646
Project: 47646
Buggy source:
private static List<Member> createMembers(MemberImpl startAfter,int memberCount,int maxSameHostCount) throws Exception {
  Random rand=new Random();
  final byte[] ip=new byte[]{10,10,0,0};
  if (startAfter != null) {
    Address address=startAfter.getAddress();
    byte[] startIp=address.getInetAddress().getAddress();
    if (startIp[3] < 255) {
      ip[2]=startIp[2];
      ip[3]=(byte)(startIp[3] + 1);
    }
 else {
      ip[2]=(byte)(startIp[2] + 1);
      ip[3]=0;
    }
  }
  int count=0;
  int port=5700;
  List<Member> members=new ArrayList<Member>();
  int sameHostCount=rand.nextInt(maxSameHostCount) + 1;
  for (int i=0; i < memberCount; i++) {
    if (count == sameHostCount) {
      ip[3]=++ip[3];
      count=0;
      port=5700;
      sameHostCount=rand.nextInt(maxSameHostCount) + 1;
    }
    count++;
    port++;
    MemberImpl m=new MemberImpl(new Address(InetAddress.getByAddress(new byte[]{ip[0],ip[1],ip[2],ip[3]}),port),false);
    members.add(m);
    if (ip[3] == 255) {
      ip[2]=++ip[2];
    }
  }
  return members;
}

Fixed version (ground truth):
private static List<Member> createMembers(MemberImpl startAfter,int memberCount,int maxSameHostCount) throws Exception {
  Random rand=new Random();
  final byte[] ip=new byte[]{10,10,0,0};
  if (startAfter != null) {
    Address address=startAfter.getAddress();
    byte[] startIp=address.getInetAddress().getAddress();
    if ((0xff & startIp[3]) < 255) {
      ip[2]=startIp[2];
      ip[3]=(byte)(startIp[3] + 1);
    }
 else {
      ip[2]=(byte)(startIp[2] + 1);
      ip[3]=0;
    }
  }
  int count=0;
  int port=5700;
  List<Member> members=new ArrayList<Member>();
  int sameHostCount=rand.nextInt(maxSameHostCount) + 1;
  for (int i=0; i < memberCount; i++) {
    if (count == sameHostCount) {
      ip[3]=++ip[3];
      count=0;
      port=5700;
      sameHostCount=rand.nextInt(maxSameHostCount) + 1;
    }
    count++;
    port++;
    MemberImpl m=new MemberImpl(new Address(InetAddress.getByAddress(new byte[]{ip[0],ip[1],ip[2],ip[3]}),port),false);
    members.add(m);
    if ((0xff & ip[3]) == 255) {
      ip[2]=++ip[2];
    }
  }
  return members;
}
Program: 47647
Project: 47647
Buggy source:
private static List<Member> createMembers(MemberImpl startAfter,int memberCount,int maxSameHostCount) throws Exception {
  Random rand=new Random();
  final byte[] ip=new byte[]{10,10,0,0};
  if (startAfter != null) {
    Address address=startAfter.getAddress();
    byte[] startIp=address.getInetAddress().getAddress();
    if (startIp[3] < 255) {
      ip[2]=startIp[2];
      ip[3]=(byte)(startIp[3] + 1);
    }
 else {
      ip[2]=(byte)(startIp[2] + 1);
      ip[3]=0;
    }
  }
  int count=0;
  int port=5700;
  List<Member> members=new ArrayList<Member>();
  int sameHostCount=rand.nextInt(maxSameHostCount) + 1;
  for (int i=0; i < memberCount; i++) {
    if (count == sameHostCount) {
      ip[3]=++ip[3];
      count=0;
      port=5700;
      sameHostCount=rand.nextInt(maxSameHostCount) + 1;
    }
    count++;
    port++;
    MemberImpl m=new MemberImpl(new Address(InetAddress.getByAddress(new byte[]{ip[0],ip[1],ip[2],ip[3]}),port),false);
    members.add(m);
    if (ip[3] == 255) {
      ip[2]=++ip[2];
    }
  }
  return members;
}

Fixed version (ground truth):
private static List<Member> createMembers(MemberImpl startAfter,int memberCount,int maxSameHostCount) throws Exception {
  Random rand=new Random();
  final byte[] ip=new byte[]{10,10,0,0};
  if (startAfter != null) {
    Address address=startAfter.getAddress();
    byte[] startIp=address.getInetAddress().getAddress();
    if ((0xff & startIp[3]) < 255) {
      ip[2]=startIp[2];
      ip[3]=(byte)(startIp[3] + 1);
    }
 else {
      ip[2]=(byte)(startIp[2] + 1);
      ip[3]=0;
    }
  }
  int count=0;
  int port=5700;
  List<Member> members=new ArrayList<Member>();
  int sameHostCount=rand.nextInt(maxSameHostCount) + 1;
  for (int i=0; i < memberCount; i++) {
    if (count == sameHostCount) {
      ip[3]=++ip[3];
      count=0;
      port=5700;
      sameHostCount=rand.nextInt(maxSameHostCount) + 1;
    }
    count++;
    port++;
    MemberImpl m=new MemberImpl(new Address(InetAddress.getByAddress(new byte[]{ip[0],ip[1],ip[2],ip[3]}),port),false);
    members.add(m);
    if ((0xff & ip[3]) == 255) {
      ip[2]=++ip[2];
    }
  }
  return members;
}
Program: 47648
Project: 47648
Buggy source:
@Override public boolean equals(Object o){
  if (o != null && o.getClass().equals(IterableSamplingEntry.class)) {
    return super.equals(o);
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (IterableSamplingEntry.class.isInstance(o)) {
    return super.equals(o);
  }
 else {
    return false;
  }
}
Program: 47649
Project: 47649
Buggy source:
@Override public E next(){
  return currentSample;
}

Fixed version (ground truth):
@Override public E next(){
  if (currentSample != null) {
    return currentSample;
  }
 else {
    throw new NoSuchElementException();
  }
}
Program: 47650
Project: 47650
Buggy source:
private LazySamplingEntryIterableIterator(int maxEntryCount){
  this.maxEntryCount=maxEntryCount;
  this.randomNumber=Math.abs(THREAD_LOCAL_RANDOM.get().nextInt());
  this.firstSegmentIndex=randomNumber % segments.length;
  this.currentSegmentIndex=firstSegmentIndex;
  this.currentBucketIndex=-1;
}

Fixed version (ground truth):
private LazySamplingEntryIterableIterator(int maxEntryCount){
  this.maxEntryCount=maxEntryCount;
  this.randomNumber=THREAD_LOCAL_RANDOM.get().nextInt(Integer.MAX_VALUE);
  this.firstSegmentIndex=randomNumber % segments.length;
  this.currentSegmentIndex=firstSegmentIndex;
  this.currentBucketIndex=-1;
}
Program: 47651
Project: 47651
Buggy source:
@Override public void run(){
  waitForPacketsProcessed();
  cleanResources(new TargetDisconnectedException(remoteEndpoint));
}

Fixed version (ground truth):
@Override public void run(){
  waitForPacketsProcessed();
  cleanResources(new ConstructorFunction<Object,Throwable>(){
    @Override public Throwable createNew(    Object arg){
      return new TargetDisconnectedException(remoteEndpoint);
    }
  }
);
}
Program: 47652
Project: 47652
Buggy source:
private void innerClose() throws IOException {
  if (!live) {
    return;
  }
  live=false;
  if (socketChannelWrapper.isOpen()) {
    socketChannelWrapper.close();
  }
  readHandler.shutdown();
  writeHandler.shutdown();
  if (socketChannelWrapper.isBlocking()) {
    return;
  }
  if (connectionManager.isLive()) {
    try {
      executionService.execute(new CleanResourcesTask());
    }
 catch (    RejectedExecutionException e) {
      logger.warning("String_Node_Str",e);
    }
  }
 else {
    cleanResources(new HazelcastException("String_Node_Str"));
  }
}

Fixed version (ground truth):
private void innerClose() throws IOException {
  if (!live) {
    return;
  }
  live=false;
  if (socketChannelWrapper.isOpen()) {
    socketChannelWrapper.close();
  }
  readHandler.shutdown();
  writeHandler.shutdown();
  if (socketChannelWrapper.isBlocking()) {
    return;
  }
  if (connectionManager.isLive()) {
    try {
      executionService.execute(new CleanResourcesTask());
    }
 catch (    RejectedExecutionException e) {
      logger.warning("String_Node_Str",e);
    }
  }
 else {
    cleanResources(new ConstructorFunction<Object,Throwable>(){
      @Override public Throwable createNew(      Object arg){
        return new HazelcastException("String_Node_Str");
      }
    }
);
  }
}
Program: 47653
Project: 47653
Buggy source:
private void cleanResources(HazelcastException response){
  final Iterator<Map.Entry<Integer,ClientCallFuture>> iter=callIdMap.entrySet().iterator();
  while (iter.hasNext()) {
    final Map.Entry<Integer,ClientCallFuture> entry=iter.next();
    iter.remove();
    entry.getValue().notify(response);
    eventHandlerMap.remove(entry.getKey());
  }
  final Iterator<ClientCallFuture> iterator=eventHandlerMap.values().iterator();
  while (iterator.hasNext()) {
    final ClientCallFuture future=iterator.next();
    iterator.remove();
    future.notify(response);
  }
}

Fixed version (ground truth):
private void cleanResources(ConstructorFunction<Object,Throwable> responseCtor){
  final Iterator<Map.Entry<Integer,ClientCallFuture>> iter=callIdMap.entrySet().iterator();
  while (iter.hasNext()) {
    final Map.Entry<Integer,ClientCallFuture> entry=iter.next();
    iter.remove();
    entry.getValue().notify(responseCtor.createNew(null));
    eventHandlerMap.remove(entry.getKey());
  }
  final Iterator<ClientCallFuture> iterator=eventHandlerMap.values().iterator();
  while (iterator.hasNext()) {
    final ClientCallFuture future=iterator.next();
    iterator.remove();
    future.notify(responseCtor.createNew(null));
  }
}
Program: 47654
Project: 47654
Buggy source:
@Override public void shutdown(){
  logger.finest("String_Node_Str");
  final Object response=new HazelcastInstanceNotActiveException();
  for (  BasicInvocation invocation : invocations.values()) {
    try {
      invocation.notify(response);
    }
 catch (    Throwable e) {
      logger.warning(invocation + "String_Node_Str" + e.getMessage());
    }
  }
  invocations.clear();
  scheduler.shutdown();
}

Fixed version (ground truth):
@Override public void shutdown(){
  logger.finest("String_Node_Str");
  for (  BasicInvocation invocation : invocations.values()) {
    try {
      invocation.notify(new HazelcastInstanceNotActiveException());
    }
 catch (    Throwable e) {
      logger.warning(invocation + "String_Node_Str" + e.getMessage());
    }
  }
  invocations.clear();
  scheduler.shutdown();
}