nus-yam/ex-repair huggingface dataset:
Program: 47167
Project: 47167
Buggy source:
@Test public void testUsedHeapPercentagePolicy(){
  final int maxUsedHeapPercentage=60;
  final int nodeCount=1;
  final int putCount=1000;
  final String mapName=randomMapName();
  final Config config=createConfig(MaxSizeConfig.MaxSizePolicy.USED_HEAP_PERCENTAGE,maxUsedHeapPercentage,mapName);
  final Collection<IMap> maps=createMaps(mapName,config,nodeCount);
  final long oneEntryHeapCostInMegaBytes=1 << 30;
  setTestSizeEstimator(maps,oneEntryHeapCostInMegaBytes);
  populateMaps(maps,putCount);
  assertUsedHeapPercentagePolicyTriggersEviction(maps,putCount);
}

Fixed version (ground truth):
@Test public void testUsedHeapPercentagePolicy(){
  final int maxUsedHeapPercentage=60;
  final int nodeCount=1;
  final int putCount=1000;
  final String mapName=randomMapName();
  final Config config=createConfig(MaxSizeConfig.MaxSizePolicy.USED_HEAP_PERCENTAGE,maxUsedHeapPercentage,mapName);
  final Collection<IMap> maps=createMaps(mapName,config,nodeCount);
  final long oneEntryHeapCostInMegaBytes=1 << 30;
  setTestSizeEstimator(maps,MemoryUnit.MEGABYTES.toBytes(oneEntryHeapCostInMegaBytes));
  populateMaps(maps,putCount);
  assertUsedHeapPercentagePolicyTriggersEviction(maps,putCount);
}
Program: 47168
Project: 47168
Buggy source:
@Test public void testUsedHeapSizePolicy(){
  final int perNodeHeapMaxSizeInMegaBytes=10;
  final int nodeCount=1;
  final String mapName=randomMapName();
  final Config config=createConfig(MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE,perNodeHeapMaxSizeInMegaBytes,mapName);
  final Collection<IMap> maps=createMaps(mapName,config,nodeCount);
  setTestSizeEstimator(maps,1);
  populateMaps(maps,100);
  assertUsedHeapSizePolicyWorks(maps,perNodeHeapMaxSizeInMegaBytes);
}

Fixed version (ground truth):
@Test public void testUsedHeapSizePolicy(){
  final int perNodeHeapMaxSizeInMegaBytes=10;
  final int nodeCount=1;
  final String mapName=randomMapName();
  final Config config=createConfig(MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE,perNodeHeapMaxSizeInMegaBytes,mapName);
  final Collection<IMap> maps=createMaps(mapName,config,nodeCount);
  setTestSizeEstimator(maps,MemoryUnit.MEGABYTES.toBytes(1));
  populateMaps(maps,100);
  assertUsedHeapSizePolicyWorks(maps,perNodeHeapMaxSizeInMegaBytes);
}
Program: 47169
Project: 47169
Buggy source:
@Override public long getCost(Object record){
  return MemoryUnit.MEGABYTES.toBytes(oneEntryHeapCostInMegaBytes);
}

Fixed version (ground truth):
@Override public long getCost(Object record){
  return oneEntryHeapCostInBytes;
}
Program: 47170
Project: 47170
Buggy source:
private void setTestSizeEstimator(IMap map,final long oneEntryHeapCostInMegaBytes){
  final MapProxyImpl mapProxy=(MapProxyImpl)map;
  final MapService mapService=(MapService)mapProxy.getService();
  final MapServiceContext mapServiceContext=mapService.getMapServiceContext();
  final NodeEngine nodeEngine=mapServiceContext.getNodeEngine();
  final InternalPartitionService partitionService=nodeEngine.getPartitionService();
  for (int i=0; i < partitionService.getPartitionCount(); i++) {
    final Address owner=partitionService.getPartitionOwner(i);
    if (nodeEngine.getThisAddress().equals(owner)) {
      final PartitionContainer container=mapServiceContext.getPartitionContainer(i);
      if (container == null) {
        continue;
      }
      final RecordStore recordStore=container.getRecordStore(map.getName());
      final DefaultRecordStore defaultRecordStore=(DefaultRecordStore)recordStore;
      defaultRecordStore.setSizeEstimator(new SizeEstimator(){
        long size;
        @Override public long getSize(){
          return size;
        }
        @Override public void add(        long size){
          this.size+=size;
        }
        @Override public long getCost(        Object record){
          return MemoryUnit.MEGABYTES.toBytes(oneEntryHeapCostInMegaBytes);
        }
        @Override public void reset(){
          size=0;
        }
      }
);
    }
  }
}

Fixed version (ground truth):
private void setTestSizeEstimator(IMap map,final long oneEntryHeapCostInBytes){
  final MapProxyImpl mapProxy=(MapProxyImpl)map;
  final MapService mapService=(MapService)mapProxy.getService();
  final MapServiceContext mapServiceContext=mapService.getMapServiceContext();
  final NodeEngine nodeEngine=mapServiceContext.getNodeEngine();
  final InternalPartitionService partitionService=nodeEngine.getPartitionService();
  for (int i=0; i < partitionService.getPartitionCount(); i++) {
    final Address owner=partitionService.getPartitionOwner(i);
    if (nodeEngine.getThisAddress().equals(owner)) {
      final PartitionContainer container=mapServiceContext.getPartitionContainer(i);
      if (container == null) {
        continue;
      }
      final RecordStore recordStore=container.getRecordStore(map.getName());
      final DefaultRecordStore defaultRecordStore=(DefaultRecordStore)recordStore;
      defaultRecordStore.setSizeEstimator(new SizeEstimator(){
        long size;
        @Override public long getSize(){
          return size;
        }
        @Override public void add(        long size){
          this.size+=size;
        }
        @Override public long getCost(        Object record){
          return oneEntryHeapCostInBytes;
        }
        @Override public void reset(){
          size=0;
        }
      }
);
    }
  }
}
Program: 47171
Project: 47171
Buggy source:
private Record isTTLExpired(Record record,long now,boolean backup){
  if (record == null) {
    return null;
  }
  final long ttl=record.getTtl();
  if (ttl < 1L) {
    return record;
  }
  final long lastUpdateTime=record.getLastUpdateTime();
  final long ttlMillis=calculateExpirationWithDelay(ttl,backupExpiryDelayMillis,backup);
  final long elapsedMillis=now - lastUpdateTime;
  return elapsedMillis >= ttlMillis ? null : record;
}

Fixed version (ground truth):
private Record isTTLExpired(Record record,long now,boolean backup){
  if (record == null) {
    return null;
  }
  final long ttl=record.getTtl();
  if (ttl < 1L) {
    return record;
  }
  final long lastUpdateTime=record.getLastUpdateTime();
  final long ttlMillis=calculateExpirationWithDelay(ttl,getBackupExpiryDelayMillis(),backup);
  final long elapsedMillis=now - lastUpdateTime;
  return elapsedMillis >= ttlMillis ? null : record;
}
Program: 47172
Project: 47172
Buggy source:
protected AbstractEvictableRecordStore(MapContainer mapContainer,int partitionId){
  super(mapContainer,partitionId);
  final MapConfig mapConfig=mapContainer.getMapConfig();
  this.minEvictionCheckMillis=mapConfig.getMinEvictionCheckMillis();
  this.evictionPolicy=mapContainer.getMapConfig().getEvictionPolicy();
  this.evictionEnabled=!EvictionPolicy.NONE.equals(evictionPolicy);
  this.expirable=isRecordStoreExpirable();
  this.backupExpiryDelayMillis=getBackupExpiryDelayMillis();
}

Fixed version (ground truth):
protected AbstractEvictableRecordStore(MapContainer mapContainer,int partitionId){
  super(mapContainer,partitionId);
}
Program: 47173
Project: 47173
Buggy source:
/** 
 * Eviction waits at least   {@link #minEvictionCheckMillis} milliseconds to run.
 * @return <code>true</code> if in that time window,otherwise <code>false</code>
 */
private boolean inEvictableTimeWindow(long now){
  return minEvictionCheckMillis == 0L || (now - lastEvictionTime) > minEvictionCheckMillis;
}

Fixed version (ground truth):
/** 
 * Eviction waits at least   {@link MapConfig#minEvictionCheckMillis} milliseconds to run.
 * @return <code>true</code> if in that time window,otherwise <code>false</code>
 */
private boolean inEvictableTimeWindow(long now){
  long minEvictionCheckMillis=getMinEvictionCheckMillis();
  return minEvictionCheckMillis == 0L || (now - lastEvictionTime) > minEvictionCheckMillis;
}
Program: 47174
Project: 47174
Buggy source:
/** 
 * If there is no clean-up caused by puts after some time, try to clean-up from gets.
 * @param now now.
 */
protected void postReadCleanUp(long now,boolean backup){
  if (evictionEnabled) {
    readCountBeforeCleanUp++;
    if ((readCountBeforeCleanUp & POST_READ_CHECK_POINT) == 0) {
      cleanUp(now,backup);
    }
  }
}

Fixed version (ground truth):
/** 
 * If there is no clean-up caused by puts after some time, try to clean-up from gets.
 * @param now now.
 */
protected void postReadCleanUp(long now,boolean backup){
  if (isEvictionEnabled()) {
    readCountBeforeCleanUp++;
    if ((readCountBeforeCleanUp & POST_READ_CHECK_POINT) == 0) {
      cleanUp(now,backup);
    }
  }
}
Program: 47175
Project: 47175
Buggy source:
protected boolean shouldEvict(long now){
  return evictionEnabled && inEvictableTimeWindow(now) && isEvictable();
}

Fixed version (ground truth):
protected boolean shouldEvict(long now){
  return isEvictionEnabled() && inEvictableTimeWindow(now) && isEvictable();
}
Program: 47176
Project: 47176
Buggy source:
protected void markRecordStoreExpirable(long ttl){
  if (ttl > 0L) {
    expirable=true;
  }
}

Fixed version (ground truth):
protected void markRecordStoreExpirable(long ttl){
  if (ttl > 0L) {
    hasEntryWithCustomTTL=true;
  }
}
Program: 47177
Project: 47177
Buggy source:
private boolean isRecordStoreExpirable(){
  final MapConfig mapConfig=mapContainer.getMapConfig();
  return mapConfig.getMaxIdleSeconds() > 0 || mapConfig.getTimeToLiveSeconds() > 0;
}

Fixed version (ground truth):
/** 
 * Returns   {@code true} if this record store has at least one candidate entryfor expiration (idle or tll) otherwise returns  {@code false}.
 */
private boolean isRecordStoreExpirable(){
  final MapConfig mapConfig=mapContainer.getMapConfig();
  return hasEntryWithCustomTTL || mapConfig.getMaxIdleSeconds() > 0 || mapConfig.getTimeToLiveSeconds() > 0;
}
Program: 47178
Project: 47178
Buggy source:
/** 
 * Check if record is reachable according to ttl or idle times. If not reachable return null.
 * @param record {@link com.hazelcast.map.impl.record.Record}
 * @return null if evictable.
 */
protected Record getOrNullIfExpired(Record record,long now,boolean backup){
  if (!expirable) {
    return record;
  }
  if (record == null) {
    return null;
  }
  final Data key=record.getKey();
  if (isLocked(key)) {
    return record;
  }
  if (!isExpired(record,now,backup)) {
    return record;
  }
  final Object value=record.getValue();
  evictInternal(key,backup);
  if (!backup) {
    doPostExpirationOperations(key,value);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Check if record is reachable according to ttl or idle times. If not reachable return null.
 * @param record {@link com.hazelcast.map.impl.record.Record}
 * @return null if evictable.
 */
protected Record getOrNullIfExpired(Record record,long now,boolean backup){
  if (!isRecordStoreExpirable()) {
    return record;
  }
  if (record == null) {
    return null;
  }
  final Data key=record.getKey();
  if (isLocked(key)) {
    return record;
  }
  if (!isExpired(record,now,backup)) {
    return record;
  }
  final Object value=record.getValue();
  evictInternal(key,backup);
  if (!backup) {
    doPostExpirationOperations(key,value);
  }
  return null;
}
Program: 47179
Project: 47179
Buggy source:
private Record isIdleExpired(Record record,long now,boolean backup){
  if (record == null) {
    return null;
  }
  final long lastAccessTime=record.getLastAccessTime();
  final long maxIdleMillis=mapContainer.getMaxIdleMillis();
  final long idleMillis=calculateExpirationWithDelay(maxIdleMillis,backupExpiryDelayMillis,backup);
  final long elapsedMillis=now - lastAccessTime;
  return elapsedMillis >= idleMillis ? null : record;
}

Fixed version (ground truth):
private Record isIdleExpired(Record record,long now,boolean backup){
  if (record == null) {
    return null;
  }
  final long lastAccessTime=record.getLastAccessTime();
  final long maxIdleMillis=calculateMaxIdleMillis(mapContainer.getMapConfig());
  final long idleMillis=calculateExpirationWithDelay(maxIdleMillis,getBackupExpiryDelayMillis(),backup);
  final long elapsedMillis=now - lastAccessTime;
  return elapsedMillis >= idleMillis ? null : record;
}
Program: 47180
Project: 47180
Buggy source:
@Override public boolean isExpirable(){
  return expirable;
}

Fixed version (ground truth):
@Override public boolean isExpirable(){
  return isRecordStoreExpirable();
}
Program: 47181
Project: 47181
Buggy source:
@Override protected void accessRecord(Record record,long now){
  super.accessRecord(record,now);
  increaseRecordEvictionCriteriaNumber(record,evictionPolicy);
  final long maxIdleMillis=mapContainer.getMaxIdleMillis();
  setExpirationTime(record,maxIdleMillis);
}

Fixed version (ground truth):
@Override protected void accessRecord(Record record,long now){
  super.accessRecord(record,now);
  increaseRecordEvictionCriteriaNumber(record,getEvictionPolicy());
  final long maxIdleMillis=calculateMaxIdleMillis(mapContainer.getMapConfig());
  setExpirationTime(record,maxIdleMillis);
}
Program: 47182
Project: 47182
Buggy source:
/** 
 * TODO make checkEvictable fast by carrying threshold logic to partition. This cleanup adds some latency to write operations. But it sweeps records much better under high write loads. <p/>
 * @param now now in time.
 */
public void evictEntries(long now,boolean backup){
  if (evictionEnabled) {
    cleanUp(now,backup);
  }
}

Fixed version (ground truth):
/** 
 * TODO make checkEvictable fast by carrying threshold logic to partition. This cleanup adds some latency to write operations. But it sweeps records much better under high write loads. <p/>
 * @param now now in time.
 */
public void evictEntries(long now,boolean backup){
  if (isEvictionEnabled()) {
    cleanUp(now,backup);
  }
}
Program: 47183
Project: 47183
Buggy source:
@Override public void putTransient(Data key,Object value,long ttl){
  checkIfLoaded();
  final long now=getNow();
  markRecordStoreExpirable(ttl);
  Record record=getRecordOrNull(key,now,false);
  if (record == null) {
    value=mapServiceContext.interceptPut(name,null,value);
    record=createRecord(key,value,ttl,now);
    records.put(key,record);
    updateSizeEstimator(calculateRecordHeapCost(record));
  }
 else {
    value=mapServiceContext.interceptPut(name,record.getValue(),value);
    updateSizeEstimator(-calculateRecordHeapCost(record));
    updateRecord(record,value,now);
    updateSizeEstimator(calculateRecordHeapCost(record));
    updateExpiryTime(record,ttl,mapContainer.getMaxIdleMillis());
  }
  saveIndex(record);
  mapDataStore.addTransient(key,now);
}

Fixed version (ground truth):
@Override public void putTransient(Data key,Object value,long ttl){
  checkIfLoaded();
  final long now=getNow();
  markRecordStoreExpirable(ttl);
  Record record=getRecordOrNull(key,now,false);
  if (record == null) {
    value=mapServiceContext.interceptPut(name,null,value);
    record=createRecord(key,value,ttl,now);
    records.put(key,record);
    updateSizeEstimator(calculateRecordHeapCost(record));
  }
 else {
    value=mapServiceContext.interceptPut(name,record.getValue(),value);
    updateSizeEstimator(-calculateRecordHeapCost(record));
    updateRecord(record,value,now);
    updateSizeEstimator(calculateRecordHeapCost(record));
    updateExpiryTime(record,ttl,mapContainer.getMapConfig());
  }
  saveIndex(record);
  mapDataStore.addTransient(key,now);
}
Program: 47184
Project: 47184
Buggy source:
@Override public Object put(Data key,Object value,long ttl){
  checkIfLoaded();
  final long now=getNow();
  markRecordStoreExpirable(ttl);
  Record record=getRecordOrNull(key,now,false);
  Object oldValue;
  if (record == null) {
    oldValue=mapDataStore.load(key);
    value=mapServiceContext.interceptPut(name,null,value);
    value=mapDataStore.add(key,value,now);
    record=createRecord(key,value,ttl,now);
    records.put(key,record);
    updateSizeEstimator(calculateRecordHeapCost(record));
    saveIndex(record);
  }
 else {
    oldValue=record.getValue();
    value=mapServiceContext.interceptPut(name,oldValue,value);
    value=mapDataStore.add(key,value,now);
    onStore(record);
    updateSizeEstimator(-calculateRecordHeapCost(record));
    updateRecord(record,value,now);
    updateSizeEstimator(calculateRecordHeapCost(record));
    updateExpiryTime(record,ttl,mapContainer.getMaxIdleMillis());
    saveIndex(record);
  }
  return oldValue;
}

Fixed version (ground truth):
@Override public Object put(Data key,Object value,long ttl){
  checkIfLoaded();
  final long now=getNow();
  markRecordStoreExpirable(ttl);
  Record record=getRecordOrNull(key,now,false);
  Object oldValue;
  if (record == null) {
    oldValue=mapDataStore.load(key);
    value=mapServiceContext.interceptPut(name,null,value);
    value=mapDataStore.add(key,value,now);
    record=createRecord(key,value,ttl,now);
    records.put(key,record);
    updateSizeEstimator(calculateRecordHeapCost(record));
    saveIndex(record);
  }
 else {
    oldValue=record.getValue();
    value=mapServiceContext.interceptPut(name,oldValue,value);
    value=mapDataStore.add(key,value,now);
    onStore(record);
    updateSizeEstimator(-calculateRecordHeapCost(record));
    updateRecord(record,value,now);
    updateSizeEstimator(calculateRecordHeapCost(record));
    updateExpiryTime(record,ttl,mapContainer.getMapConfig());
    saveIndex(record);
  }
  return oldValue;
}
Program: 47185
Project: 47185
Buggy source:
@Override public Object putFromLoad(Data key,Object value,long ttl){
  final long now=getNow();
  if (shouldEvict(now)) {
    return null;
  }
  markRecordStoreExpirable(ttl);
  Record record=getRecordOrNull(key,now,false);
  Object oldValue=null;
  if (record == null) {
    value=mapServiceContext.interceptPut(name,null,value);
    record=createRecord(key,value,ttl,now);
    records.put(key,record);
    updateSizeEstimator(calculateRecordHeapCost(record));
  }
 else {
    oldValue=record.getValue();
    value=mapServiceContext.interceptPut(name,record.getValue(),value);
    updateSizeEstimator(-calculateRecordHeapCost(record));
    updateRecord(record,value,now);
    updateSizeEstimator(calculateRecordHeapCost(record));
    updateExpiryTime(record,ttl,mapContainer.getMaxIdleMillis());
  }
  saveIndex(record);
  return oldValue;
}

Fixed version (ground truth):
@Override public Object putFromLoad(Data key,Object value,long ttl){
  final long now=getNow();
  if (shouldEvict(now)) {
    return null;
  }
  markRecordStoreExpirable(ttl);
  Record record=getRecordOrNull(key,now,false);
  Object oldValue=null;
  if (record == null) {
    value=mapServiceContext.interceptPut(name,null,value);
    record=createRecord(key,value,ttl,now);
    records.put(key,record);
    updateSizeEstimator(calculateRecordHeapCost(record));
  }
 else {
    oldValue=record.getValue();
    value=mapServiceContext.interceptPut(name,record.getValue(),value);
    updateSizeEstimator(-calculateRecordHeapCost(record));
    updateRecord(record,value,now);
    updateSizeEstimator(calculateRecordHeapCost(record));
    updateExpiryTime(record,ttl,mapContainer.getMapConfig());
  }
  saveIndex(record);
  return oldValue;
}
Program: 47186
Project: 47186
Buggy source:
@Override public boolean tryPut(Data key,Object value,long ttl){
  checkIfLoaded();
  final long now=getNow();
  markRecordStoreExpirable(ttl);
  Record record=getRecordOrNull(key,now,false);
  if (record == null) {
    value=mapServiceContext.interceptPut(name,null,value);
    value=mapDataStore.add(key,value,now);
    record=createRecord(key,value,ttl,now);
    records.put(key,record);
    updateSizeEstimator(calculateRecordHeapCost(record));
  }
 else {
    value=mapServiceContext.interceptPut(name,record.getValue(),value);
    value=mapDataStore.add(key,value,now);
    onStore(record);
    updateSizeEstimator(-calculateRecordHeapCost(record));
    updateRecord(record,value,now);
    updateSizeEstimator(calculateRecordHeapCost(record));
    updateExpiryTime(record,ttl,mapContainer.getMaxIdleMillis());
  }
  saveIndex(record);
  return true;
}

Fixed version (ground truth):
@Override public boolean tryPut(Data key,Object value,long ttl){
  checkIfLoaded();
  final long now=getNow();
  markRecordStoreExpirable(ttl);
  Record record=getRecordOrNull(key,now,false);
  if (record == null) {
    value=mapServiceContext.interceptPut(name,null,value);
    value=mapDataStore.add(key,value,now);
    record=createRecord(key,value,ttl,now);
    records.put(key,record);
    updateSizeEstimator(calculateRecordHeapCost(record));
  }
 else {
    value=mapServiceContext.interceptPut(name,record.getValue(),value);
    value=mapDataStore.add(key,value,now);
    onStore(record);
    updateSizeEstimator(-calculateRecordHeapCost(record));
    updateRecord(record,value,now);
    updateSizeEstimator(calculateRecordHeapCost(record));
    updateExpiryTime(record,ttl,mapContainer.getMapConfig());
  }
  saveIndex(record);
  return true;
}
Program: 47187
Project: 47187
Buggy source:
@Override public boolean set(Data key,Object value,long ttl){
  checkIfLoaded();
  final long now=getNow();
  markRecordStoreExpirable(ttl);
  Record record=getRecordOrNull(key,now,false);
  boolean newRecord=false;
  if (record == null) {
    value=mapServiceContext.interceptPut(name,null,value);
    value=mapDataStore.add(key,value,now);
    record=createRecord(key,value,ttl,now);
    records.put(key,record);
    updateSizeEstimator(calculateRecordHeapCost(record));
    newRecord=true;
  }
 else {
    value=mapServiceContext.interceptPut(name,record.getValue(),value);
    value=mapDataStore.add(key,value,now);
    onStore(record);
    updateSizeEstimator(-calculateRecordHeapCost(record));
    updateRecord(record,value,now);
    updateSizeEstimator(calculateRecordHeapCost(record));
    updateExpiryTime(record,ttl,mapContainer.getMaxIdleMillis());
  }
  saveIndex(record);
  return newRecord;
}

Fixed version (ground truth):
@Override public boolean set(Data key,Object value,long ttl){
  checkIfLoaded();
  final long now=getNow();
  markRecordStoreExpirable(ttl);
  Record record=getRecordOrNull(key,now,false);
  boolean newRecord=false;
  if (record == null) {
    value=mapServiceContext.interceptPut(name,null,value);
    value=mapDataStore.add(key,value,now);
    record=createRecord(key,value,ttl,now);
    records.put(key,record);
    updateSizeEstimator(calculateRecordHeapCost(record));
    newRecord=true;
  }
 else {
    value=mapServiceContext.interceptPut(name,record.getValue(),value);
    value=mapDataStore.add(key,value,now);
    onStore(record);
    updateSizeEstimator(-calculateRecordHeapCost(record));
    updateRecord(record,value,now);
    updateSizeEstimator(calculateRecordHeapCost(record));
    updateExpiryTime(record,ttl,mapContainer.getMapConfig());
  }
  saveIndex(record);
  return newRecord;
}
Program: 47188
Project: 47188
Buggy source:
@Override public Object putIfAbsent(Data key,Object value,long ttl){
  checkIfLoaded();
  final long now=getNow();
  markRecordStoreExpirable(ttl);
  Record record=getRecordOrNull(key,now,false);
  Object oldValue;
  if (record == null) {
    oldValue=mapDataStore.load(key);
    if (oldValue != null) {
      record=createRecord(key,oldValue,now);
      records.put(key,record);
      updateSizeEstimator(calculateRecordHeapCost(record));
    }
  }
 else {
    accessRecord(record,now);
    oldValue=record.getValue();
  }
  if (oldValue == null) {
    value=mapServiceContext.interceptPut(name,null,value);
    value=mapDataStore.add(key,value,now);
    onStore(record);
    record=createRecord(key,value,ttl,now);
    records.put(key,record);
    updateSizeEstimator(calculateRecordHeapCost(record));
    updateExpiryTime(record,ttl,mapContainer.getMaxIdleMillis());
  }
  saveIndex(record);
  return oldValue;
}

Fixed version (ground truth):
@Override public Object putIfAbsent(Data key,Object value,long ttl){
  checkIfLoaded();
  final long now=getNow();
  markRecordStoreExpirable(ttl);
  Record record=getRecordOrNull(key,now,false);
  Object oldValue;
  if (record == null) {
    oldValue=mapDataStore.load(key);
    if (oldValue != null) {
      record=createRecord(key,oldValue,now);
      records.put(key,record);
      updateSizeEstimator(calculateRecordHeapCost(record));
    }
  }
 else {
    accessRecord(record,now);
    oldValue=record.getValue();
  }
  if (oldValue == null) {
    value=mapServiceContext.interceptPut(name,null,value);
    value=mapDataStore.add(key,value,now);
    onStore(record);
    record=createRecord(key,value,ttl,now);
    records.put(key,record);
    updateSizeEstimator(calculateRecordHeapCost(record));
    updateExpiryTime(record,ttl,mapContainer.getMapConfig());
  }
  saveIndex(record);
  return oldValue;
}
Program: 47189
Project: 47189
Buggy source:
/** 
 * Updates records TTL and expiration time.
 */
public static void updateExpiryTime(Record record,long ttl,long maxIdleMillis){
  if (ttl < 0) {
    return;
  }
  ttl=checkedTime(ttl);
  record.setTtl(ttl);
  setExpirationTime(record,maxIdleMillis);
}

Fixed version (ground truth):
/** 
 * Updates records TTL and expiration time.
 */
public static void updateExpiryTime(Record record,long ttl,MapConfig mapConfig){
  if (ttl < 0) {
    return;
  }
  ttl=checkedTime(ttl);
  record.setTtl(ttl);
  long maxIdleMillis=calculateMaxIdleMillis(mapConfig);
  setExpirationTime(record,maxIdleMillis);
}
Program: 47190
Project: 47190
Buggy source:
/** 
 * Operations which are done in this constructor should obey the rules defined in the method comment   {@link com.hazelcast.spi.PostJoinAwareService#getPostJoinOperation()}Otherwise undesired situations, like deadlocks, may appear.
 */
public MapContainer(final String name,final MapConfig mapConfig,final MapServiceContext mapServiceContext){
  this.name=name;
  this.mapConfig=mapConfig;
  this.maxIdleMillis=calculateMaxIdleMillis(mapConfig);
  this.ttlMillisFromConfig=calculateTTLMillis(mapConfig);
  this.mapServiceContext=mapServiceContext;
  this.partitioningStrategy=createPartitioningStrategy();
  this.quorumName=mapConfig.getQuorumName();
  final NodeEngine nodeEngine=mapServiceContext.getNodeEngine();
  recordFactory=createRecordFactory(nodeEngine);
  initWanReplication(nodeEngine);
  interceptors=new CopyOnWriteArrayList<MapInterceptor>();
  interceptorMap=new ConcurrentHashMap<String,MapInterceptor>();
  nearCacheSizeEstimator=createNearCacheSizeEstimator();
  mapStoreContext=createMapStoreContext(this);
  mapStoreContext.start();
}

Fixed version (ground truth):
/** 
 * Operations which are done in this constructor should obey the rules defined in the method comment   {@link com.hazelcast.spi.PostJoinAwareService#getPostJoinOperation()}Otherwise undesired situations, like deadlocks, may appear.
 */
public MapContainer(final String name,final MapConfig mapConfig,final MapServiceContext mapServiceContext){
  this.name=name;
  this.mapConfig=mapConfig;
  this.mapServiceContext=mapServiceContext;
  this.partitioningStrategy=createPartitioningStrategy();
  this.quorumName=mapConfig.getQuorumName();
  final NodeEngine nodeEngine=mapServiceContext.getNodeEngine();
  recordFactory=createRecordFactory(nodeEngine);
  initWanReplication(nodeEngine);
  interceptors=new CopyOnWriteArrayList<MapInterceptor>();
  interceptorMap=new ConcurrentHashMap<String,MapInterceptor>();
  nearCacheSizeEstimator=createNearCacheSizeEstimator();
  mapStoreContext=createMapStoreContext(this);
  mapStoreContext.start();
}
Program: 47191
Project: 47191
Buggy source:
public Record createRecord(Data key,Object value,long ttlMillis,long now){
  Record record=getRecordFactory().newRecord(key,value);
  record.setLastAccessTime(now);
  record.setLastUpdateTime(now);
  record.setCreationTime(now);
  final long ttlMillisFromConfig=getTtlMillisFromConfig();
  final long ttl=pickTTL(ttlMillis,ttlMillisFromConfig);
  record.setTtl(ttl);
  final long maxIdleMillis=getMaxIdleMillis();
  setExpirationTime(record,maxIdleMillis);
  return record;
}

Fixed version (ground truth):
public Record createRecord(Data key,Object value,long ttlMillis,long now){
  Record record=getRecordFactory().newRecord(key,value);
  record.setLastAccessTime(now);
  record.setLastUpdateTime(now);
  record.setCreationTime(now);
  final long ttlMillisFromConfig=calculateTTLMillis(mapConfig);
  final long ttl=pickTTL(ttlMillis,ttlMillisFromConfig);
  record.setTtl(ttl);
  final long maxIdleMillis=calculateMaxIdleMillis(mapConfig);
  setExpirationTime(record,maxIdleMillis);
  return record;
}
Program: 47192
Project: 47192
Buggy source:
public void setAttribute(final String name,final Object value){
  if (name == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (value == null) {
    removeAttribute(name);
    return;
  }
  boolean transientEntry=false;
  if (transientAttributes.contains(name)) {
    transientEntry=true;
  }
  LocalCacheEntry entry=localCache.get(name);
  if (entry == null || entry == WebFilter.NULL_ENTRY) {
    entry=new LocalCacheEntry(transientEntry);
    localCache.put(name,entry);
  }
  entry.setValue(value);
  entry.setDirty(true);
  entry.setRemoved(false);
  if (!deferredWrite && !transientEntry) {
    try {
      webFilter.getClusteredSessionService().setAttribute(id,name,value);
      entry.setDirty(false);
    }
 catch (    Exception ignored) {
      EmptyStatement.ignore(ignored);
    }
  }
}

Fixed version (ground truth):
public void setAttribute(final String name,final Object value){
  if (name == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (value == null) {
    removeAttribute(name);
    return;
  }
  boolean transientEntry=false;
  if (transientAttributes.contains(name)) {
    transientEntry=true;
  }
  LocalCacheEntry entry=localCache.get(name);
  if (entry == null || entry == WebFilter.NULL_ENTRY) {
    entry=new LocalCacheEntry(transientEntry);
    localCache.put(name,entry);
  }
  entry.setValue(value);
  entry.setDirty(true);
  entry.setRemoved(false);
  entry.setReload(false);
  if (!deferredWrite && !transientEntry) {
    try {
      webFilter.getClusteredSessionService().setAttribute(id,name,value);
      entry.setDirty(false);
    }
 catch (    Exception ignored) {
      EmptyStatement.ignore(ignored);
    }
  }
}
Program: 47193
Project: 47193
Buggy source:
public void removeAttribute(final String name){
  LocalCacheEntry entry=localCache.get(name);
  if (entry != null && entry != WebFilter.NULL_ENTRY) {
    entry.setValue(null);
    entry.setRemoved(true);
    entry.setDirty(true);
  }
  if (!deferredWrite) {
    try {
      webFilter.getClusteredSessionService().deleteAttribute(id,name);
    }
 catch (    Exception ignored) {
      EmptyStatement.ignore(ignored);
    }
  }
}

Fixed version (ground truth):
public void removeAttribute(final String name){
  LocalCacheEntry entry=localCache.get(name);
  if (entry != null && entry != WebFilter.NULL_ENTRY) {
    entry.setValue(null);
    entry.setRemoved(true);
    entry.setDirty(true);
    entry.setReload(false);
  }
  if (!deferredWrite) {
    try {
      webFilter.getClusteredSessionService().deleteAttribute(id,name);
    }
 catch (    Exception ignored) {
      EmptyStatement.ignore(ignored);
    }
  }
}
Program: 47194
Project: 47194
Buggy source:
public final void doFilter(ServletRequest req,ServletResponse res,final FilterChain chain) throws IOException, ServletException {
  if (!(req instanceof HttpServletRequest)) {
    chain.doFilter(req,res);
  }
 else {
    if (req instanceof RequestWrapper) {
      LOGGER.finest("String_Node_Str");
      chain.doFilter(req,res);
      return;
    }
    HttpServletRequest httpReq=(HttpServletRequest)req;
    RequestWrapper existingReq=(RequestWrapper)req.getAttribute(HAZELCAST_REQUEST);
    final ResponseWrapper resWrapper=new ResponseWrapper((HttpServletResponse)res);
    final RequestWrapper reqWrapper=new RequestWrapper(httpReq,resWrapper);
    if (existingReq != null) {
      reqWrapper.setHazelcastSession(existingReq.hazelcastSession,existingReq.requestedSessionId);
    }
    chain.doFilter(reqWrapper,resWrapper);
    if (existingReq != null) {
      return;
    }
    HazelcastHttpSession session=reqWrapper.getSession(false);
    if (session != null && session.isValid()) {
      if (LOGGER.isFinestEnabled()) {
        LOGGER.finest("String_Node_Str" + session.getId());
      }
      if (deferredWrite) {
        session.sessionDeferredWrite();
      }
    }
  }
}

Fixed version (ground truth):
public final void doFilter(ServletRequest req,ServletResponse res,final FilterChain chain) throws IOException, ServletException {
  if (!(req instanceof HttpServletRequest)) {
    chain.doFilter(req,res);
  }
 else {
    if (req instanceof RequestWrapper) {
      LOGGER.finest("String_Node_Str");
      chain.doFilter(req,res);
      return;
    }
    HttpServletRequest httpReq=(HttpServletRequest)req;
    RequestWrapper existingReq=(RequestWrapper)req.getAttribute(HAZELCAST_REQUEST);
    final ResponseWrapper resWrapper=new ResponseWrapper((HttpServletResponse)res);
    final RequestWrapper reqWrapper=new RequestWrapper(httpReq,resWrapper);
    if (existingReq != null) {
      reqWrapper.setHazelcastSession(existingReq.hazelcastSession,existingReq.clusteredSessionId);
    }
    chain.doFilter(reqWrapper,resWrapper);
    if (existingReq != null) {
      return;
    }
    HazelcastHttpSession session=reqWrapper.getSession(false);
    if (session != null && session.isValid()) {
      if (LOGGER.isFinestEnabled()) {
        LOGGER.finest("String_Node_Str" + session.getId());
      }
      if (deferredWrite) {
        session.sessionDeferredWrite();
      }
    }
  }
}
Program: 47195
Project: 47195
Buggy source:
public HazelcastHttpSession getOrCreateHazelcastSession(){
  if (requestedSessionId == null) {
    requestedSessionId=getSessionCookie(this);
    if (requestedSessionId == null) {
      requestedSessionId=getParameter(HAZELCAST_SESSION_COOKIE_NAME);
    }
  }
  if (requestedSessionId != null) {
    hazelcastSession=getSessionWithId(requestedSessionId);
  }
  if (hazelcastSession == null && !res.isCommitted()) {
    hazelcastSession=createNewSession(RequestWrapper.this,requestedSessionId);
  }
  return hazelcastSession;
}

Fixed version (ground truth):
public HazelcastHttpSession getOrCreateHazelcastSession(){
  if (hazelcastSession == null && !res.isCommitted()) {
    hazelcastSession=createNewSession(RequestWrapper.this,clusteredSessionId);
  }
  return hazelcastSession;
}
Program: 47196
Project: 47196
Buggy source:
private HazelcastHttpSession readSessionFromLocal(){
  if (hazelcastSession != null && !hazelcastSession.isValid()) {
    LOGGER.finest("String_Node_Str");
    destroySession(hazelcastSession,true);
    hazelcastSession=null;
  }
 else   if (hazelcastSession != null) {
    if (!hazelcastSession.isStickySession()) {
      hazelcastSession.updateReloadFlag();
    }
    return hazelcastSession;
  }
  HttpSession originalSession=getOriginalSession(false);
  if (originalSession != null) {
    String hazelcastSessionId=originalSessions.get(originalSession.getId());
    if (hazelcastSessionId != null) {
      hazelcastSession=sessions.get(hazelcastSessionId);
      if (!hazelcastSession.isStickySession()) {
        hazelcastSession.updateReloadFlag();
      }
      return hazelcastSession;
    }
    originalSessions.remove(originalSession.getId());
    originalSession.invalidate();
  }
  if (requestedSessionId != null) {
    hazelcastSession=sessions.get(requestedSessionId);
  }
  return null;
}

Fixed version (ground truth):
private HazelcastHttpSession readSessionFromLocal(){
  if (hazelcastSession != null && !hazelcastSession.isValid()) {
    LOGGER.finest("String_Node_Str");
    destroySession(hazelcastSession,true);
    hazelcastSession=null;
  }
 else   if (hazelcastSession != null) {
    return hazelcastSession;
  }
  HttpSession originalSession=getOriginalSession(false);
  if (originalSession != null) {
    String hazelcastSessionId=originalSessions.get(originalSession.getId());
    if (hazelcastSessionId != null) {
      hazelcastSession=sessions.get(hazelcastSessionId);
      if (!hazelcastSession.isStickySession()) {
        hazelcastSession.updateReloadFlag();
      }
      return hazelcastSession;
    }
    originalSessions.remove(originalSession.getId());
    originalSession.invalidate();
  }
  if (clusteredSessionId != null) {
    hazelcastSession=sessions.get(clusteredSessionId);
  }
  return readFromCookie();
}
Program: 47197
Project: 47197
Buggy source:
public void setHazelcastSession(HazelcastHttpSession hazelcastSession,String requestedSessionId){
  this.hazelcastSession=hazelcastSession;
  this.requestedSessionId=requestedSessionId;
}

Fixed version (ground truth):
public void setHazelcastSession(HazelcastHttpSession hazelcastSession,String requestedSessionId){
  this.hazelcastSession=hazelcastSession;
  this.clusteredSessionId=requestedSessionId;
}
Program: 47199
Project: 47199
Buggy source:
/** 
 * Iterates through all bundles to get the available   {@link ScriptEngineFactory} classes
 * @return the names of the available ScriptEngineFactory classes
 * @throws IOException
 */
private List<String> findFactoryCandidates(BundleContext context) throws IOException {
  Bundle[] bundles=context.getBundles();
  List<String> factoryCandidates=new ArrayList<String>();
  for (  Bundle bundle : bundles) {
    if (bundle == null) {
      continue;
    }
    if ("String_Node_Str".equals(bundle.getSymbolicName())) {
      continue;
    }
    Enumeration urls=bundle.findEntries("String_Node_Str","String_Node_Str",false);
    if (urls == null) {
      continue;
    }
    while (urls.hasMoreElements()) {
      URL u=(URL)urls.nextElement();
      BufferedReader reader=new BufferedReader(new InputStreamReader(u.openStream(),"String_Node_Str"));
      String line;
      while ((line=reader.readLine()) != null) {
        line=line.trim();
        if (!line.startsWith("String_Node_Str") && line.length() > 0) {
          factoryCandidates.add(line);
        }
      }
      reader.close();
    }
  }
  if (isClassDefined(RHINO_SCRIPT_ENGINE_FACTORY)) {
    factoryCandidates.add(RHINO_SCRIPT_ENGINE_FACTORY);
  }
 else   if (isClassDefined(NASHORN_SCRIPT_ENGINE_FACTORY)) {
    factoryCandidates.add(NASHORN_SCRIPT_ENGINE_FACTORY);
  }
 else {
    logger.warning("String_Node_Str");
  }
  return factoryCandidates;
}

Fixed version (ground truth):
/** 
 * Iterates through all bundles to get the available   {@link ScriptEngineFactory} classes
 * @return the names of the available ScriptEngineFactory classes
 * @throws IOException
 */
private List<String> findFactoryCandidates(BundleContext context) throws IOException {
  Bundle[] bundles=context.getBundles();
  List<String> factoryCandidates=new ArrayList<String>();
  for (  Bundle bundle : bundles) {
    if (bundle == null) {
      continue;
    }
    if ("String_Node_Str".equals(bundle.getSymbolicName())) {
      continue;
    }
    Enumeration urls=bundle.findEntries("String_Node_Str","String_Node_Str",false);
    if (urls == null) {
      continue;
    }
    while (urls.hasMoreElements()) {
      URL u=(URL)urls.nextElement();
      BufferedReader reader=new BufferedReader(new InputStreamReader(u.openStream(),"String_Node_Str"));
      String line;
      while ((line=reader.readLine()) != null) {
        line=line.trim();
        if (!line.startsWith("String_Node_Str") && line.length() > 0) {
          factoryCandidates.add(line);
        }
      }
      reader.close();
    }
  }
  addJavaScriptEngine(factoryCandidates);
  return factoryCandidates;
}
Program: 47200
Project: 47200
Buggy source:
/** 
 * Tries to load the given class.
 * @param className Name of the class to load
 * @return Loaded class
 * @throws ClassNotFoundException when the class is not found
 */
private static Class<?> tryLoadClass(String className) throws ClassNotFoundException {
  try {
    return Class.forName(className);
  }
 catch (  ClassNotFoundException e) {
    return Thread.currentThread().getContextClassLoader().loadClass(className);
  }
}

Fixed version (ground truth):
/** 
 * Tries to load the given class.
 * @param className Name of the class to load
 * @return Loaded class
 * @throws ClassNotFoundException when the class is not found
 */
private static Class<?> tryLoadClass(String className) throws ClassNotFoundException {
  try {
    return Class.forName(className);
  }
 catch (  ClassNotFoundException e) {
    ClassLoader contextClassLoader=Thread.currentThread().getContextClassLoader();
    return contextClassLoader.loadClass(className);
  }
}
Program: 47201
Project: 47201
Buggy source:
private boolean isJoinRequestFromAnExistingMember(JoinRequest joinRequest,Connection connection){
  MemberImpl member=getMember(joinRequest.getAddress());
  if (member == null) {
    return false;
  }
  Address target=member.getAddress();
  if (joinRequest.getUuid().equals(member.getUuid())) {
    if (node.isMaster()) {
      if (logger.isFinestEnabled()) {
        String message="String_Node_Str" + joinRequest;
        logger.finest(message);
      }
      final Operation[] postJoinOps=nodeEngine.getPostJoinOperations();
      final PostJoinOperation postJoinOp=postJoinOps != null && postJoinOps.length > 0 ? new PostJoinOperation(postJoinOps) : null;
      Operation op=new FinalizeJoinOperation(createMemberInfos(getMemberList()),postJoinOp,getClusterTime(),false);
      nodeEngine.getOperationService().send(op,target);
    }
 else {
      sendMasterAnswer(target);
    }
    return true;
  }
  if (node.isMaster() || target.equals(node.getMasterAddress())) {
    logger.warning("String_Node_Str" + member + "String_Node_Str");
    doRemoveAddress(target,false);
    Connection existing=node.connectionManager.getConnection(target);
    if (existing != connection) {
      node.connectionManager.destroyConnection(existing);
      node.connectionManager.registerConnection(target,connection);
    }
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean isJoinRequestFromAnExistingMember(JoinRequest joinRequest,Connection connection){
  MemberImpl member=getMember(joinRequest.getAddress());
  if (member == null) {
    return false;
  }
  Address target=member.getAddress();
  if (joinRequest.getUuid().equals(member.getUuid())) {
    if (node.isMaster()) {
      if (logger.isFinestEnabled()) {
        String message="String_Node_Str" + joinRequest;
        logger.finest(message);
      }
      final Operation[] postJoinOps=nodeEngine.getPostJoinOperations();
      final PostJoinOperation postJoinOp=postJoinOps != null && postJoinOps.length > 0 ? new PostJoinOperation(postJoinOps) : null;
      Operation op=new FinalizeJoinOperation(createMemberInfoList(getMemberList()),postJoinOp,getClusterTime(),false);
      nodeEngine.getOperationService().send(op,target);
    }
 else {
      sendMasterAnswer(target);
    }
    return true;
  }
  if (node.isMaster() || target.equals(node.getMasterAddress())) {
    logger.warning("String_Node_Str" + member + "String_Node_Str");
    doRemoveAddress(target,false);
    Connection existing=node.connectionManager.getConnection(target);
    if (existing != connection) {
      node.connectionManager.destroyConnection(existing);
      node.connectionManager.registerConnection(target,connection);
    }
    return false;
  }
  return true;
}
Program: 47202
Project: 47202
Buggy source:
private void startJoin(){
  logger.finest("String_Node_Str");
  lock.lock();
  try {
    try {
      joinInProgress=true;
      node.getPartitionService().pauseMigration();
      final Collection<MemberImpl> members=getMemberList();
      final Collection<MemberInfo> memberInfos=createMemberInfos(members);
      for (      MemberInfo memberJoining : setJoins) {
        memberInfos.add(memberJoining);
      }
      final long time=getClusterTime();
      final Operation[] postJoinOps=nodeEngine.getPostJoinOperations();
      final PostJoinOperation postJoinOp=postJoinOps != null && postJoinOps.length > 0 ? new PostJoinOperation(postJoinOps) : null;
      final int count=members.size() - 1 + setJoins.size();
      final List<Future> calls=new ArrayList<Future>(count);
      for (      MemberInfo member : setJoins) {
        calls.add(invokeClusterOperation(new FinalizeJoinOperation(memberInfos,postJoinOp,time),member.getAddress()));
      }
      for (      MemberImpl member : members) {
        if (!member.getAddress().equals(thisAddress)) {
          calls.add(invokeClusterOperation(new MemberInfoUpdateOperation(memberInfos,time,true),member.getAddress()));
        }
      }
      updateMembers(memberInfos);
      int timeout=Math.min(calls.size() * FINALIZE_JOIN_TIMEOUT_FACTOR,FINALIZE_JOIN_MAX_TIMEOUT);
      waitWithDeadline(calls,timeout,TimeUnit.SECONDS,whileFinalizeJoinsExceptionHandler);
    }
  finally {
      node.getPartitionService().resumeMigration();
    }
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
private void startJoin(){
  logger.finest("String_Node_Str");
  lock.lock();
  try {
    try {
      joinInProgress=true;
      node.getPartitionService().pauseMigration();
      final Collection<MemberImpl> members=getMemberList();
      final Collection<MemberInfo> memberInfos=createMemberInfoList(members);
      for (      MemberInfo memberJoining : setJoins) {
        memberInfos.add(memberJoining);
      }
      final long time=getClusterTime();
      final Operation[] postJoinOps=nodeEngine.getPostJoinOperations();
      final PostJoinOperation postJoinOp=postJoinOps != null && postJoinOps.length > 0 ? new PostJoinOperation(postJoinOps) : null;
      final int count=members.size() - 1 + setJoins.size();
      final List<Future> calls=new ArrayList<Future>(count);
      for (      MemberInfo member : setJoins) {
        calls.add(invokeClusterOperation(new FinalizeJoinOperation(memberInfos,postJoinOp,time),member.getAddress()));
      }
      for (      MemberImpl member : members) {
        if (!member.getAddress().equals(thisAddress)) {
          calls.add(invokeClusterOperation(new MemberInfoUpdateOperation(memberInfos,time,true),member.getAddress()));
        }
      }
      updateMembers(memberInfos);
      int timeout=Math.min(calls.size() * FINALIZE_JOIN_TIMEOUT_FACTOR,FINALIZE_JOIN_MAX_TIMEOUT);
      waitWithDeadline(calls,timeout,TimeUnit.SECONDS,whileFinalizeJoinsExceptionHandler);
    }
  finally {
      node.getPartitionService().resumeMigration();
    }
  }
  finally {
    lock.unlock();
  }
}
Program: 47203
Project: 47203
Buggy source:
private void sendMemberListToOthers(){
  if (!isMaster()) {
    return;
  }
  final Collection<MemberImpl> members=getMemberList();
  MemberInfoUpdateOperation op=new MemberInfoUpdateOperation(createMemberInfos(members),getClusterTime(),false);
  for (  MemberImpl member : members) {
    if (member.equals(thisMember)) {
      continue;
    }
    nodeEngine.getOperationService().send(op,member.getAddress());
  }
}

Fixed version (ground truth):
private void sendMemberListToOthers(){
  if (!isMaster()) {
    return;
  }
  final Collection<MemberImpl> members=getMemberList();
  MemberInfoUpdateOperation op=new MemberInfoUpdateOperation(createMemberInfoList(members),getClusterTime(),false);
  for (  MemberImpl member : members) {
    if (member.equals(thisMember)) {
      continue;
    }
    nodeEngine.getOperationService().send(op,member.getAddress());
  }
}