nus-yam/ex-repair huggingface dataset:
Program: 46632
Project: 46632
Buggy source:
protected void deleteAllCacheEntry(Set<Data> keys){
  if (isWriteThrough() && cacheWriter != null && keys != null && !keys.isEmpty()) {
    Map<Object,Data> keysToDelete=new HashMap<Object,Data>();
    for (    Data key : keys) {
      final Object localKeyObj=dataToValue(key);
      keysToDelete.put(localKeyObj,key);
    }
    final Set<Object> keysObject=keysToDelete.keySet();
    try {
      cacheWriter.deleteAll(keysObject);
    }
 catch (    Exception e) {
      if (!(e instanceof CacheWriterException)) {
        throw new CacheWriterException("String_Node_Str",e);
      }
 else {
        throw (CacheWriterException)e;
      }
    }
 finally {
      for (      Object undeletedKey : keysObject) {
        final Data undeletedKeyData=keysToDelete.get(undeletedKey);
        keys.remove(undeletedKeyData);
      }
    }
  }
}

Fixed version (ground truth):
@SuppressFBWarnings("String_Node_Str") protected void deleteAllCacheEntry(Set<Data> keys){
  if (isWriteThrough() && cacheWriter != null && keys != null && !keys.isEmpty()) {
    Map<Object,Data> keysToDelete=new HashMap<Object,Data>();
    for (    Data key : keys) {
      final Object localKeyObj=dataToValue(key);
      keysToDelete.put(localKeyObj,key);
    }
    final Set<Object> keysObject=keysToDelete.keySet();
    try {
      cacheWriter.deleteAll(keysObject);
    }
 catch (    Exception e) {
      if (!(e instanceof CacheWriterException)) {
        throw new CacheWriterException("String_Node_Str",e);
      }
 else {
        throw (CacheWriterException)e;
      }
    }
 finally {
      for (      Object undeletedKey : keysObject) {
        final Data undeletedKeyData=keysToDelete.get(undeletedKey);
        keys.remove(undeletedKeyData);
      }
    }
  }
}
Program: 46633
Project: 46633
Buggy source:
@Override public Operation prepareReplicationOperation(PartitionReplicationEvent event){
  if (event.getReplicaIndex() > 1) {
    return null;
  }
  Map<String,Long> data=new HashMap<String,Long>();
  int partitionId=event.getPartitionId();
  for (  String name : containers.keySet()) {
    if (partitionId == getPartitionId(name)) {
      AtomicLongContainer container=containers.get(name);
      data.put(name,container.get());
    }
  }
  return data.isEmpty() ? null : new AtomicLongReplicationOperation(data);
}

Fixed version (ground truth):
@Override public Operation prepareReplicationOperation(PartitionReplicationEvent event){
  if (event.getReplicaIndex() > 1) {
    return null;
  }
  Map<String,Long> data=new HashMap<String,Long>();
  int partitionId=event.getPartitionId();
  for (  Map.Entry<String,AtomicLongContainer> containerEntry : containers.entrySet()) {
    String name=containerEntry.getKey();
    if (partitionId == getPartitionId(name)) {
      AtomicLongContainer container=containerEntry.getValue();
      data.put(name,container.get());
    }
  }
  return data.isEmpty() ? null : new AtomicLongReplicationOperation(data);
}
Program: 46634
Project: 46634
Buggy source:
@Override public Operation prepareReplicationOperation(PartitionReplicationEvent event){
  if (event.getReplicaIndex() > 1) {
    return null;
  }
  Map<String,Data> data=new HashMap<String,Data>();
  int partitionId=event.getPartitionId();
  for (  String name : containers.keySet()) {
    if (partitionId == getPartitionId(name)) {
      AtomicReferenceContainer atomicReferenceContainer=containers.get(name);
      Data value=atomicReferenceContainer.get();
      data.put(name,value);
    }
  }
  return data.isEmpty() ? null : new AtomicReferenceReplicationOperation(data);
}

Fixed version (ground truth):
@Override public Operation prepareReplicationOperation(PartitionReplicationEvent event){
  if (event.getReplicaIndex() > 1) {
    return null;
  }
  Map<String,Data> data=new HashMap<String,Data>();
  int partitionId=event.getPartitionId();
  for (  Map.Entry<String,AtomicReferenceContainer> containerEntry : containers.entrySet()) {
    String name=containerEntry.getKey();
    if (partitionId == getPartitionId(name)) {
      AtomicReferenceContainer atomicReferenceContainer=containerEntry.getValue();
      Data value=atomicReferenceContainer.get();
      data.put(name,value);
    }
  }
  return data.isEmpty() ? null : new AtomicReferenceReplicationOperation(data);
}
Program: 46635
Project: 46635
Buggy source:
private void setMembersRef(Map<Address,MemberImpl> memberMap){
  memberMap=unmodifiableMap(memberMap);
  memberMap.values();
  memberMap.keySet();
  memberMap.entrySet();
  membersMapRef.set(memberMap);
  membersRef.set(unmodifiableSet(new LinkedHashSet<MemberImpl>(memberMap.values())));
}

Fixed version (ground truth):
@SuppressFBWarnings("String_Node_Str") private void setMembersRef(Map<Address,MemberImpl> memberMap){
  memberMap=unmodifiableMap(memberMap);
  memberMap.values();
  memberMap.keySet();
  memberMap.entrySet();
  membersMapRef.set(memberMap);
  membersRef.set(unmodifiableSet(new LinkedHashSet<MemberImpl>(memberMap.values())));
}
Program: 46637
Project: 46637
Buggy source:
@Override public Set<QueryableEntry> getSubRecords(ComparisonType comparisonType,Comparable searchedValue){
  takeReadLock();
  try {
    MultiResultSet results=createMultiResultSet();
    Set<Comparable> values=recordMap.keySet();
    for (    Comparable value : values) {
      boolean valid;
      int result=searchedValue.compareTo(value);
switch (comparisonType) {
case LESSER:
        valid=result > 0;
      break;
case LESSER_EQUAL:
    valid=result >= 0;
  break;
case GREATER:
valid=result < 0;
break;
case GREATER_EQUAL:
valid=result <= 0;
break;
case NOT_EQUAL:
valid=result != 0;
break;
default :
throw new IllegalStateException("String_Node_Str" + comparisonType);
}
if (valid) {
ConcurrentMap<Data,QueryableEntry> records=recordMap.get(value);
if (records != null) {
results.addResultSet(records);
}
}
}
return results;
}
  finally {
releaseReadLock();
}
}

Fixed version (ground truth):
@Override public Set<QueryableEntry> getSubRecords(ComparisonType comparisonType,Comparable searchedValue){
  takeReadLock();
  try {
    MultiResultSet results=createMultiResultSet();
    for (    Map.Entry<Comparable,ConcurrentMap<Data,QueryableEntry>> recordMapEntry : recordMap.entrySet()) {
      Comparable value=recordMapEntry.getKey();
      boolean valid;
      int result=searchedValue.compareTo(value);
switch (comparisonType) {
case LESSER:
        valid=result > 0;
      break;
case LESSER_EQUAL:
    valid=result >= 0;
  break;
case GREATER:
valid=result < 0;
break;
case GREATER_EQUAL:
valid=result <= 0;
break;
case NOT_EQUAL:
valid=result != 0;
break;
default :
throw new IllegalStateException("String_Node_Str" + comparisonType);
}
if (valid) {
ConcurrentMap<Data,QueryableEntry> records=recordMapEntry.getValue();
if (records != null) {
results.addResultSet(records);
}
}
}
return results;
}
  finally {
releaseReadLock();
}
}
Program: 46638
Project: 46638
Buggy source:
@Override public Set<QueryableEntry> getSubRecordsBetween(Comparable from,Comparable to){
  takeReadLock();
  try {
    MultiResultSet results=createMultiResultSet();
    Comparable paramFrom=from;
    Comparable paramTo=to;
    int trend=paramFrom.compareTo(paramTo);
    if (trend == 0) {
      ConcurrentMap<Data,QueryableEntry> records=recordMap.get(paramFrom);
      if (records != null) {
        results.addResultSet(records);
      }
      return results;
    }
    if (trend < 0) {
      Comparable oldFrom=paramFrom;
      paramFrom=to;
      paramTo=oldFrom;
    }
    Set<Comparable> values=recordMap.keySet();
    for (    Comparable value : values) {
      if (value.compareTo(paramFrom) <= 0 && value.compareTo(paramTo) >= 0) {
        ConcurrentMap<Data,QueryableEntry> records=recordMap.get(value);
        if (records != null) {
          results.addResultSet(records);
        }
      }
    }
    return results;
  }
  finally {
    releaseReadLock();
  }
}

Fixed version (ground truth):
@Override public Set<QueryableEntry> getSubRecordsBetween(Comparable from,Comparable to){
  takeReadLock();
  try {
    MultiResultSet results=createMultiResultSet();
    Comparable paramFrom=from;
    Comparable paramTo=to;
    int trend=paramFrom.compareTo(paramTo);
    if (trend == 0) {
      ConcurrentMap<Data,QueryableEntry> records=recordMap.get(paramFrom);
      if (records != null) {
        results.addResultSet(records);
      }
      return results;
    }
    if (trend < 0) {
      Comparable oldFrom=paramFrom;
      paramFrom=to;
      paramTo=oldFrom;
    }
    for (    Map.Entry<Comparable,ConcurrentMap<Data,QueryableEntry>> recordMapEntry : recordMap.entrySet()) {
      Comparable value=recordMapEntry.getKey();
      if (value.compareTo(paramFrom) <= 0 && value.compareTo(paramTo) >= 0) {
        ConcurrentMap<Data,QueryableEntry> records=recordMapEntry.getValue();
        if (records != null) {
          results.addResultSet(records);
        }
      }
    }
    return results;
  }
  finally {
    releaseReadLock();
  }
}
Program: 46639
Project: 46639
Buggy source:
@Override public boolean shouldWait(){
  WriteBehindQueue<DelayedEntry> writeBehindQueue=store.getWriteBehindQueue();
  int size=writeBehindQueue.size();
  if (size == 0) {
    return false;
  }
  DelayedEntry entry=writeBehindQueue.peek();
  long currentSequence=entry.getSequence();
  return entry != null && currentSequence <= this.sequence && size + currentSequence - 1 >= this.sequence;
}

Fixed version (ground truth):
@Override public boolean shouldWait(){
  WriteBehindQueue<DelayedEntry> writeBehindQueue=store.getWriteBehindQueue();
  DelayedEntry entry=writeBehindQueue.peek();
  if (entry == null) {
    return false;
  }
  long currentSequence=entry.getSequence();
  return currentSequence <= this.sequence && writeBehindQueue.size() + currentSequence - 1 >= this.sequence;
}
Program: 46641
Project: 46641
Buggy source:
@Test public void cacheManagerByInstanceNameTest() throws URISyntaxException {
  final String instanceName="String_Node_Str";
  Config config=new Config();
  config.setInstanceName(instanceName);
  Hazelcast.newHazelcastInstance(config);
  URI uri1=new URI("String_Node_Str");
  Properties properties=new Properties();
  properties.setProperty(HazelcastCachingProvider.HAZELCAST_INSTANCE_NAME,instanceName);
  CacheManager cacheManager=Caching.getCachingProvider().getCacheManager(uri1,null,properties);
  assertNotNull(cacheManager);
  assertEquals(1,Hazelcast.getAllHazelcastInstances().size());
}

Fixed version (ground truth):
@Test public void cacheManagerByInstanceNameTest() throws URISyntaxException {
  final String instanceName=randomName();
  Config config=new Config();
  config.setInstanceName(instanceName);
  Hazelcast.newHazelcastInstance(config);
  URI uri1=new URI("String_Node_Str");
  Properties properties=new Properties();
  properties.setProperty(HazelcastCachingProvider.HAZELCAST_INSTANCE_NAME,instanceName);
  CacheManager cacheManager=Caching.getCachingProvider().getCacheManager(uri1,null,properties);
  assertNotNull(cacheManager);
  assertEquals(1,Hazelcast.getAllHazelcastInstances().size());
}
Program: 46643
Project: 46643
Buggy source:
@Test public void cacheManagerByInstanceNameTest() throws URISyntaxException {
  final String instanceName="String_Node_Str";
  Config config=new Config();
  config.setInstanceName(instanceName);
  Hazelcast.newHazelcastInstance(config);
  URI uri1=new URI("String_Node_Str");
  Properties properties=new Properties();
  properties.setProperty(HazelcastCachingProvider.HAZELCAST_INSTANCE_NAME,instanceName);
  CacheManager cacheManager=Caching.getCachingProvider().getCacheManager(uri1,null,properties);
  assertNotNull(cacheManager);
  assertEquals(1,Hazelcast.getAllHazelcastInstances().size());
}

Fixed version (ground truth):
@Test public void cacheManagerByInstanceNameTest() throws URISyntaxException {
  final String instanceName=randomName();
  Config config=new Config();
  config.setInstanceName(instanceName);
  Hazelcast.newHazelcastInstance(config);
  URI uri1=new URI("String_Node_Str");
  Properties properties=new Properties();
  properties.setProperty(HazelcastCachingProvider.HAZELCAST_INSTANCE_NAME,instanceName);
  CacheManager cacheManager=Caching.getCachingProvider().getCacheManager(uri1,null,properties);
  assertNotNull(cacheManager);
  assertEquals(1,Hazelcast.getAllHazelcastInstances().size());
}
Program: 46644
Project: 46644
Buggy source:
public void updateReloadFlag(){
  for (  Map.Entry<String,LocalCacheEntry> entry : localCache.entrySet()) {
    entry.getValue().setReload(true);
  }
}

Fixed version (ground truth):
public void updateReloadFlag(){
  for (  Map.Entry<String,LocalCacheEntry> entry : localCache.entrySet()) {
    if (!entry.getValue().isDirty()) {
      entry.getValue().setReload(true);
    }
  }
}
Program: 46646
Project: 46646
Buggy source:
@Override protected void onSetup(){
  super.onSetup();
  instanceFactory.newHazelcastInstance(createConfig());
  ClientConfig clientConfig=createClientConfig();
  client=instanceFactory.newHazelcastClient(clientConfig);
}

Fixed version (ground truth):
@Override protected void onSetup(){
  super.onSetup();
  getHazelcastInstance();
  ClientConfig clientConfig=createClientConfig();
  client=instanceFactory.newHazelcastClient(clientConfig);
}
Program: 46647
Project: 46647
Buggy source:
@Override protected void onSetup(){
  super.onSetup();
  instanceFactory.newHazelcastInstance(createConfig());
  ClientConfig clientConfig=createClientConfig();
  client=instanceFactory.newHazelcastClient(clientConfig);
}

Fixed version (ground truth):
@Override protected void onSetup(){
  super.onSetup();
  getHazelcastInstance();
  ClientConfig clientConfig=createClientConfig();
  client=instanceFactory.newHazelcastClient(clientConfig);
}
Program: 46648
Project: 46648
Buggy source:
@Override public void init(){
  primary=isPrimary();
}

Fixed version (ground truth):
@Override public void init(){
  primary=isPrimary();
  records.setEntryCounting(primary);
}
Program: 46649
Project: 46649
Buggy source:
public CacheRecordHashMap(int initialCapacity,float loadFactor,int concurrencyLevel,ConcurrentReferenceHashMap.ReferenceType keyType,ConcurrentReferenceHashMap.ReferenceType valueType,EnumSet<Option> options,CacheContext cacheContext){
  super(initialCapacity,loadFactor,concurrencyLevel,keyType,valueType,options);
  this.cacheContext=cacheContext;
}

Fixed version (ground truth):
public CacheRecordHashMap(int initialCapacity,CacheContext cacheContext){
  super(initialCapacity);
  this.cacheContext=cacheContext;
}
Program: 46650
Project: 46650
Buggy source:
@Override public void clear(){
  final int sizeBeforeClear=size();
  super.clear();
  cacheContext.decreaseEntryCount(sizeBeforeClear);
}

Fixed version (ground truth):
@Override public void clear(){
  final int sizeBeforeClear=size();
  super.clear();
  if (entryCountingEnable) {
    cacheContext.decreaseEntryCount(sizeBeforeClear);
  }
}
Program: 46651
Project: 46651
Buggy source:
@Override public CacheRecord putIfAbsent(Data key,CacheRecord value){
  CacheRecord oldRecord=super.putIfAbsent(key,value);
  if (oldRecord == null) {
    cacheContext.increaseEntryCount();
  }
  return oldRecord;
}

Fixed version (ground truth):
@Override public CacheRecord putIfAbsent(Data key,CacheRecord value){
  CacheRecord oldRecord=super.putIfAbsent(key,value);
  if (oldRecord == null && entryCountingEnable) {
    cacheContext.increaseEntryCount();
  }
  return oldRecord;
}
Program: 46652
Project: 46652
Buggy source:
@Override public CacheRecord put(Data key,CacheRecord value){
  CacheRecord oldRecord=super.put(key,value);
  if (oldRecord == null) {
    cacheContext.increaseEntryCount();
  }
  return oldRecord;
}

Fixed version (ground truth):
@Override public CacheRecord put(Data key,CacheRecord value){
  CacheRecord oldRecord=super.put(key,value);
  if (oldRecord == null && entryCountingEnable) {
    cacheContext.increaseEntryCount();
  }
  return oldRecord;
}
Program: 46653
Project: 46653
Buggy source:
@Override public boolean remove(Object key,Object value){
  boolean removed=super.remove(key,value);
  if (removed) {
    cacheContext.decreaseEntryCount();
  }
  return removed;
}

Fixed version (ground truth):
@Override public boolean remove(Object key,Object value){
  boolean removed=super.remove(key,value);
  if (removed && entryCountingEnable) {
    cacheContext.decreaseEntryCount();
  }
  return removed;
}
Program: 46654
Project: 46654
Buggy source:
CacheKeyIteratorResult fetchNext(int nextTableIndex,int size);

Fixed version (ground truth):
/** 
 * Fetches keys in bulk as specified <tt>size</tt> at most.
 * @param nextTableIndex starting point for fetching
 * @param size maximum bulk size to fetch the keys
 * @return the {@link CacheKeyIteratorResult} instance contains fetched keys
 */
CacheKeyIteratorResult fetchNext(int nextTableIndex,int size);
Program: 46655
Project: 46655
Buggy source:
protected CachingProvider getCachingProvider(){
  return HazelcastServerCachingProvider.createCachingProvider(getHazelcastInstance());
}

Fixed version (ground truth):
protected CachingProvider getCachingProvider(HazelcastInstance instance){
  return HazelcastServerCachingProvider.createCachingProvider(instance);
}
Program: 46656
Project: 46656
Buggy source:
@Override public void run() throws Exception {
  assertEquals(0,stats.getOwnedEntryCount());
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  assertEquals(0,getOwnedEntryCount(allStatistics));
}
Program: 46657
Project: 46657
Buggy source:
@Test public void testLargePackets() throws Exception {
  makePayloads(10000);
  test();
}

Fixed version (ground truth):
@Test(timeout=10 * 60 * 1000) public void testLargePackets() throws Exception {
  makePayloads(10000);
  testPackets((10 * 60 * 1000) - (WRITER_THREAD_RUNNING_TIME_IN_SECONDS * 1000));
}
Program: 46658
Project: 46658
Buggy source:
@Test public void testSmallPackets() throws Exception {
  makePayloads(100);
  test();
}

Fixed version (ground truth):
@Test public void testSmallPackets() throws Exception {
  makePayloads(100);
  testPackets();
}
Program: 46659
Project: 46659
Buggy source:
@Test public void testSemiRealisticPackets() throws Exception {
  makeSemiRealisticPayloads();
  test();
}

Fixed version (ground truth):
@Test public void testSemiRealisticPackets() throws Exception {
  makeSemiRealisticPayloads();
  testPackets();
}
Program: 46660
Project: 46660
Buggy source:
@Test public void testMediumPackets() throws Exception {
  makePayloads(1000);
  test();
}

Fixed version (ground truth):
@Test public void testMediumPackets() throws Exception {
  makePayloads(1000);
  testPackets();
}
Program: 46661
Project: 46661
Buggy source:
@Override public void run() throws Exception {
  assertEquals(expectedNormalPackets,XReadHandler.getNormalFramesReadCounter().get());
  assertEquals(expectedUrgentPackets,XReadHandler.getPriorityFramesReadCounter().get());
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  logger.info("String_Node_Str" + writer.totalFramesPending());
  logger.info("String_Node_Str" + writer.getLastWriteTimeMillis());
  logger.info("String_Node_Str" + reader.getNormalFramesReadCounter().get() + reader.getPriorityFramesReadCounter().get());
  logger.info("String_Node_Str" + reader.getLastReadTimeMillis());
  assertEquals(expectedNormalPackets,reader.getNormalFramesReadCounter().get());
  assertEquals(expectedUrgentPackets,reader.getPriorityFramesReadCounter().get());
}
Program: 46662
Project: 46662
Buggy source:
@Test public void testTinyPackets() throws Exception {
  makePayloads(10);
  test();
}

Fixed version (ground truth):
@Test public void testTinyPackets() throws Exception {
  makePayloads(10);
  testPackets();
}
Program: 46663
Project: 46663
Buggy source:
protected String generateThreadDump(){
  StringBuilder dump=new StringBuilder();
  ThreadMXBean threadMXBean=ManagementFactory.getThreadMXBean();
  ThreadInfo[] threadInfos=threadMXBean.dumpAllThreads(true,true);
  long currentThreadId=Thread.currentThread().getId();
  for (  ThreadInfo threadInfo : threadInfos) {
    if (threadInfo.getThreadId() == currentThreadId) {
      continue;
    }
    dump.append('"');
    dump.append(threadInfo.getThreadName());
    dump.append("String_Node_Str");
    Thread.State state=threadInfo.getThreadState();
    dump.append("String_Node_Str");
    dump.append(state);
    if (threadInfo.getLockName() != null) {
      dump.append("String_Node_Str").append(threadInfo.getLockName());
    }
    if (threadInfo.getLockOwnerName() != null) {
      dump.append("String_Node_Str").append(threadInfo.getLockOwnerName());
      dump.append("String_Node_Str").append(threadInfo.getLockOwnerId());
    }
    StackTraceElement[] stackTraceElements=threadInfo.getStackTrace();
    for (    StackTraceElement stackTraceElement : stackTraceElements) {
      dump.append("String_Node_Str");
      dump.append(stackTraceElement);
    }
    dump.append("String_Node_Str");
  }
  return dump.toString();
}

Fixed version (ground truth):
protected String generateThreadDump(){
  StringBuilder dump=new StringBuilder();
  ThreadMXBean threadMXBean=ManagementFactory.getThreadMXBean();
  ThreadInfo[] threadInfos=threadMXBean.dumpAllThreads(true,true);
  long currentThreadId=Thread.currentThread().getId();
  for (  ThreadInfo threadInfo : threadInfos) {
    long threadId=threadInfo.getThreadId();
    if (threadId == currentThreadId) {
      continue;
    }
    dump.append('"');
    dump.append(threadInfo.getThreadName());
    dump.append("String_Node_Str");
    Thread.State state=threadInfo.getThreadState();
    dump.append("String_Node_Str");
    dump.append(state);
    if (threadInfo.getLockName() != null) {
      dump.append("String_Node_Str").append(threadInfo.getLockName());
    }
    if (threadInfo.getLockOwnerName() != null) {
      dump.append("String_Node_Str").append(threadInfo.getLockOwnerName());
      dump.append("String_Node_Str").append(threadInfo.getLockOwnerId());
    }
    if (THREAD_CPU_TIME_INFO_AVAILABLE) {
      dump.append("String_Node_Str").append(threadMXBean.getThreadCpuTime(threadId)).append("String_Node_Str");
      dump.append("String_Node_Str").append(threadMXBean.getThreadUserTime(threadId)).append("String_Node_Str");
    }
    if (THREAD_CONTENTION_INFO_AVAILABLE) {
      dump.append("String_Node_Str").append(threadInfo.getBlockedTime()).append("String_Node_Str");
      dump.append("String_Node_Str").append(threadInfo.getWaitedTime()).append("String_Node_Str");
    }
    StackTraceElement[] stackTraceElements=threadInfo.getStackTrace();
    for (    StackTraceElement stackTraceElement : stackTraceElements) {
      dump.append("String_Node_Str");
      dump.append(stackTraceElement);
    }
    dump.append("String_Node_Str");
  }
  return dump.toString();
}
Program: 46664
Project: 46664
Buggy source:
@Override protected void onSetup(){
  super.onSetup();
  instanceFactory.newHazelcastInstance(createConfig());
  ClientConfig clientConfig=createClientConfig();
  client=instanceFactory.newHazelcastClient(clientConfig);
}

Fixed version (ground truth):
@Override protected void onSetup(){
  super.onSetup();
  getHazelcastInstance();
  ClientConfig clientConfig=createClientConfig();
  client=instanceFactory.newHazelcastClient(clientConfig);
}
Program: 46665
Project: 46665
Buggy source:
@Override public void init(){
  primary=isPrimary();
}

Fixed version (ground truth):
@Override public void init(){
  primary=isPrimary();
  records.setEntryCounting(primary);
}
Program: 46666
Project: 46666
Buggy source:
public CacheRecordHashMap(int initialCapacity,float loadFactor,int concurrencyLevel,ConcurrentReferenceHashMap.ReferenceType keyType,ConcurrentReferenceHashMap.ReferenceType valueType,EnumSet<Option> options,CacheContext cacheContext){
  super(initialCapacity,loadFactor,concurrencyLevel,keyType,valueType,options);
  this.cacheContext=cacheContext;
}

Fixed version (ground truth):
public CacheRecordHashMap(int initialCapacity,CacheContext cacheContext){
  super(initialCapacity);
  this.cacheContext=cacheContext;
}
Program: 46667
Project: 46667
Buggy source:
@Override public void clear(){
  final int sizeBeforeClear=size();
  super.clear();
  cacheContext.decreaseEntryCount(sizeBeforeClear);
}

Fixed version (ground truth):
@Override public void clear(){
  final int sizeBeforeClear=size();
  super.clear();
  if (entryCountingEnable) {
    cacheContext.decreaseEntryCount(sizeBeforeClear);
  }
}
Program: 46668
Project: 46668
Buggy source:
@Override public CacheRecord putIfAbsent(Data key,CacheRecord value){
  CacheRecord oldRecord=super.putIfAbsent(key,value);
  if (oldRecord == null) {
    cacheContext.increaseEntryCount();
  }
  return oldRecord;
}

Fixed version (ground truth):
@Override public CacheRecord putIfAbsent(Data key,CacheRecord value){
  CacheRecord oldRecord=super.putIfAbsent(key,value);
  if (oldRecord == null && entryCountingEnable) {
    cacheContext.increaseEntryCount();
  }
  return oldRecord;
}
Program: 46669
Project: 46669
Buggy source:
@Override public CacheRecord put(Data key,CacheRecord value){
  CacheRecord oldRecord=super.put(key,value);
  if (oldRecord == null) {
    cacheContext.increaseEntryCount();
  }
  return oldRecord;
}

Fixed version (ground truth):
@Override public CacheRecord put(Data key,CacheRecord value){
  CacheRecord oldRecord=super.put(key,value);
  if (oldRecord == null && entryCountingEnable) {
    cacheContext.increaseEntryCount();
  }
  return oldRecord;
}
Program: 46670
Project: 46670
Buggy source:
@Override public boolean remove(Object key,Object value){
  boolean removed=super.remove(key,value);
  if (removed) {
    cacheContext.decreaseEntryCount();
  }
  return removed;
}

Fixed version (ground truth):
@Override public boolean remove(Object key,Object value){
  boolean removed=super.remove(key,value);
  if (removed && entryCountingEnable) {
    cacheContext.decreaseEntryCount();
  }
  return removed;
}
Program: 46671
Project: 46671
Buggy source:
CacheKeyIteratorResult fetchNext(int nextTableIndex,int size);

Fixed version (ground truth):
/** 
 * Fetches keys in bulk as specified <tt>size</tt> at most.
 * @param nextTableIndex starting point for fetching
 * @param size maximum bulk size to fetch the keys
 * @return the {@link CacheKeyIteratorResult} instance contains fetched keys
 */
CacheKeyIteratorResult fetchNext(int nextTableIndex,int size);
Program: 46672
Project: 46672
Buggy source:
protected CachingProvider getCachingProvider(){
  return HazelcastServerCachingProvider.createCachingProvider(getHazelcastInstance());
}

Fixed version (ground truth):
protected CachingProvider getCachingProvider(HazelcastInstance instance){
  return HazelcastServerCachingProvider.createCachingProvider(instance);
}
Program: 46673
Project: 46673
Buggy source:
@Override public void run() throws Exception {
  assertEquals(0,stats.getOwnedEntryCount());
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  assertEquals(0,getOwnedEntryCount(allStatistics));
}
Program: 46674
Project: 46674
Buggy source:
@Test public void testLargePackets() throws Exception {
  makePayloads(10000);
  test();
}

Fixed version (ground truth):
@Test(timeout=10 * 60 * 1000) public void testLargePackets() throws Exception {
  makePayloads(10000);
  testPackets((10 * 60 * 1000) - (WRITER_THREAD_RUNNING_TIME_IN_SECONDS * 1000));
}
Program: 46675
Project: 46675
Buggy source:
@Test public void testSmallPackets() throws Exception {
  makePayloads(100);
  test();
}

Fixed version (ground truth):
@Test public void testSmallPackets() throws Exception {
  makePayloads(100);
  testPackets();
}
Program: 46676
Project: 46676
Buggy source:
@Test public void testSemiRealisticPackets() throws Exception {
  makeSemiRealisticPayloads();
  test();
}

Fixed version (ground truth):
@Test public void testSemiRealisticPackets() throws Exception {
  makeSemiRealisticPayloads();
  testPackets();
}
Program: 46677
Project: 46677
Buggy source:
@Test public void testMediumPackets() throws Exception {
  makePayloads(1000);
  test();
}

Fixed version (ground truth):
@Test public void testMediumPackets() throws Exception {
  makePayloads(1000);
  testPackets();
}
Program: 46678
Project: 46678
Buggy source:
@Override public void run() throws Exception {
  assertEquals(expectedNormalPackets,XReadHandler.getNormalFramesReadCounter().get());
  assertEquals(expectedUrgentPackets,XReadHandler.getPriorityFramesReadCounter().get());
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  logger.info("String_Node_Str" + writer.totalFramesPending());
  logger.info("String_Node_Str" + writer.getLastWriteTimeMillis());
  logger.info("String_Node_Str" + reader.getNormalFramesReadCounter().get() + reader.getPriorityFramesReadCounter().get());
  logger.info("String_Node_Str" + reader.getLastReadTimeMillis());
  assertEquals(expectedNormalPackets,reader.getNormalFramesReadCounter().get());
  assertEquals(expectedUrgentPackets,reader.getPriorityFramesReadCounter().get());
}
Program: 46679
Project: 46679
Buggy source:
@Test public void testTinyPackets() throws Exception {
  makePayloads(10);
  test();
}

Fixed version (ground truth):
@Test public void testTinyPackets() throws Exception {
  makePayloads(10);
  testPackets();
}
Program: 46680
Project: 46680
Buggy source:
protected String generateThreadDump(){
  StringBuilder dump=new StringBuilder();
  ThreadMXBean threadMXBean=ManagementFactory.getThreadMXBean();
  ThreadInfo[] threadInfos=threadMXBean.dumpAllThreads(true,true);
  long currentThreadId=Thread.currentThread().getId();
  for (  ThreadInfo threadInfo : threadInfos) {
    if (threadInfo.getThreadId() == currentThreadId) {
      continue;
    }
    dump.append('"');
    dump.append(threadInfo.getThreadName());
    dump.append("String_Node_Str");
    Thread.State state=threadInfo.getThreadState();
    dump.append("String_Node_Str");
    dump.append(state);
    if (threadInfo.getLockName() != null) {
      dump.append("String_Node_Str").append(threadInfo.getLockName());
    }
    if (threadInfo.getLockOwnerName() != null) {
      dump.append("String_Node_Str").append(threadInfo.getLockOwnerName());
      dump.append("String_Node_Str").append(threadInfo.getLockOwnerId());
    }
    StackTraceElement[] stackTraceElements=threadInfo.getStackTrace();
    for (    StackTraceElement stackTraceElement : stackTraceElements) {
      dump.append("String_Node_Str");
      dump.append(stackTraceElement);
    }
    dump.append("String_Node_Str");
  }
  return dump.toString();
}

Fixed version (ground truth):
protected String generateThreadDump(){
  StringBuilder dump=new StringBuilder();
  ThreadMXBean threadMXBean=ManagementFactory.getThreadMXBean();
  ThreadInfo[] threadInfos=threadMXBean.dumpAllThreads(true,true);
  long currentThreadId=Thread.currentThread().getId();
  for (  ThreadInfo threadInfo : threadInfos) {
    long threadId=threadInfo.getThreadId();
    if (threadId == currentThreadId) {
      continue;
    }
    dump.append('"');
    dump.append(threadInfo.getThreadName());
    dump.append("String_Node_Str");
    Thread.State state=threadInfo.getThreadState();
    dump.append("String_Node_Str");
    dump.append(state);
    if (threadInfo.getLockName() != null) {
      dump.append("String_Node_Str").append(threadInfo.getLockName());
    }
    if (threadInfo.getLockOwnerName() != null) {
      dump.append("String_Node_Str").append(threadInfo.getLockOwnerName());
      dump.append("String_Node_Str").append(threadInfo.getLockOwnerId());
    }
    if (THREAD_CPU_TIME_INFO_AVAILABLE) {
      dump.append("String_Node_Str").append(threadMXBean.getThreadCpuTime(threadId)).append("String_Node_Str");
      dump.append("String_Node_Str").append(threadMXBean.getThreadUserTime(threadId)).append("String_Node_Str");
    }
    if (THREAD_CONTENTION_INFO_AVAILABLE) {
      dump.append("String_Node_Str").append(threadInfo.getBlockedTime()).append("String_Node_Str");
      dump.append("String_Node_Str").append(threadInfo.getWaitedTime()).append("String_Node_Str");
    }
    StackTraceElement[] stackTraceElements=threadInfo.getStackTrace();
    for (    StackTraceElement stackTraceElement : stackTraceElements) {
      dump.append("String_Node_Str");
      dump.append(stackTraceElement);
    }
    dump.append("String_Node_Str");
  }
  return dump.toString();
}
Program: 46681
Project: 46681
Buggy source:
private Collection<AddressProvider> createAddressProviders(AddressProvider externalAddressProvider){
  ClientNetworkConfig networkConfig=getClientConfig().getNetworkConfig();
  final ClientAwsConfig awsConfig=networkConfig.getAwsConfig();
  Collection<AddressProvider> addressProviders=new LinkedList<AddressProvider>();
  addressProviders.add(new DefaultAddressProvider(networkConfig));
  if (externalAddressProvider != null) {
    addressProviders.add(externalAddressProvider);
  }
  if (discoveryService != null) {
    addressProviders.add(new DiscoveryAddressProvider(discoveryService));
  }
  if (awsConfig != null && awsConfig.isEnabled()) {
    try {
      addressProviders.add(new AwsAddressProvider(awsConfig));
    }
 catch (    NoClassDefFoundError e) {
      LOGGER.log(Level.WARNING,"String_Node_Str");
      throw e;
    }
  }
  return addressProviders;
}

Fixed version (ground truth):
private Collection<AddressProvider> createAddressProviders(AddressProvider externalAddressProvider){
  ClientNetworkConfig networkConfig=getClientConfig().getNetworkConfig();
  final ClientAwsConfig awsConfig=networkConfig.getAwsConfig();
  Collection<AddressProvider> addressProviders=new LinkedList<AddressProvider>();
  addressProviders.add(new DefaultAddressProvider(networkConfig));
  if (externalAddressProvider != null) {
    addressProviders.add(externalAddressProvider);
  }
  if (discoveryService != null) {
    addressProviders.add(new DiscoveryAddressProvider(discoveryService));
  }
  if (clientProperties.getBoolean(ClientProperty.DISCOVERY_SPI_ENABLED)) {
    discoveryService.start();
  }
  if (awsConfig != null && awsConfig.isEnabled()) {
    try {
      addressProviders.add(new AwsAddressProvider(awsConfig));
    }
 catch (    NoClassDefFoundError e) {
      LOGGER.log(Level.WARNING,"String_Node_Str");
      throw e;
    }
  }
  return addressProviders;
}
Program: 46682
Project: 46682
Buggy source:
public void doShutdown(){
  proxyManager.destroy();
  clusterService.shutdown();
  executionService.shutdown();
  partitionService.stop();
  transactionManager.shutdown();
  connectionManager.shutdown();
  invocationService.shutdown();
  listenerService.shutdown();
  serializationService.destroy();
  nearCacheManager.destroyAllNearCaches();
}

Fixed version (ground truth):
public void doShutdown(){
  proxyManager.destroy();
  clusterService.shutdown();
  executionService.shutdown();
  partitionService.stop();
  transactionManager.shutdown();
  connectionManager.shutdown();
  invocationService.shutdown();
  listenerService.shutdown();
  serializationService.destroy();
  nearCacheManager.destroyAllNearCaches();
  if (discoveryService != null) {
    discoveryService.destroy();
  }
}
Program: 46683
Project: 46683
Buggy source:
@Override public void start(){
  super.start();
  discoveryNodes.add(discoveryNode);
  getLogger();
  getProperties();
}

Fixed version (ground truth):
@Override public void start(){
  super.start();
  startLatch.countDown();
  if (discoveryNode != null) {
    discoveryNodes.add(discoveryNode);
  }
}
Program: 46684
Project: 46684
Buggy source:
@Override public void destroy(){
  super.destroy();
  discoveryNodes.remove(discoveryNode);
}

Fixed version (ground truth):
@Override public void destroy(){
  super.destroy();
  stopLatch.countDown();
  discoveryNodes.remove(discoveryNode);
}
Program: 46685
Project: 46685
Buggy source:
@Override public Class<? extends DiscoveryStrategy> getDiscoveryStrategyType(){
  return CollectingDiscoveryStrategy.class;
}

Fixed version (ground truth):
@Override public Class<? extends DiscoveryStrategy> getDiscoveryStrategyType(){
  return LifecycleDiscoveryStrategy.class;
}
Program: 46686
Project: 46686
Buggy source:
@Override public DiscoveryStrategy newDiscoveryStrategy(DiscoveryNode discoveryNode,ILogger logger,Map<String,Comparable> properties){
  return new CollectingDiscoveryStrategy(discoveryNode,discoveryNodes,logger,properties);
}

Fixed version (ground truth):
@Override public DiscoveryStrategy newDiscoveryStrategy(DiscoveryNode discoveryNode,ILogger logger,Map<String,Comparable> properties){
  return new LifecycleDiscoveryStrategy(startLatch,stopLatch,discoveryNode,discoveryNodes,logger,properties);
}
Program: 46687
Project: 46687
Buggy source:
private static Set<URLDefinition> collectFactoryUrls(String factoryId,ClassLoader classLoader){
  final String resourceName="String_Node_Str" + factoryId;
  try {
    final Enumeration<URL> configs;
    if (classLoader != null) {
      configs=classLoader.getResources(resourceName);
    }
 else {
      configs=ClassLoader.getSystemResources(resourceName);
    }
    Set<URLDefinition> urlDefinitions=new HashSet<URLDefinition>();
    while (configs.hasMoreElements()) {
      URL url=configs.nextElement();
      final URI uri=url.toURI();
      ClassLoader highestClassLoader=findHighestReachableClassLoader(url,classLoader,resourceName);
      if (!highestClassLoader.getClass().getName().equals(IGNORED_GLASSFISH_MAGIC_CLASSLOADER)) {
        urlDefinitions.add(new URLDefinition(uri,highestClassLoader));
      }
    }
    return urlDefinitions;
  }
 catch (  Exception e) {
    LOGGER.severe(e);
  }
  return Collections.emptySet();
}

Fixed version (ground truth):
private static Set<URLDefinition> collectFactoryUrls(String factoryId,ClassLoader classLoader){
  final String resourceName="String_Node_Str" + factoryId;
  try {
    final Enumeration<URL> configs;
    if (classLoader != null) {
      configs=classLoader.getResources(resourceName);
    }
 else {
      configs=ClassLoader.getSystemResources(resourceName);
    }
    Set<URLDefinition> urlDefinitions=new HashSet<URLDefinition>();
    while (configs.hasMoreElements()) {
      URL url=configs.nextElement();
      final URI uri=new URI(url.toExternalForm().replace("String_Node_Str","String_Node_Str"));
      ClassLoader highestClassLoader=findHighestReachableClassLoader(url,classLoader,resourceName);
      if (!highestClassLoader.getClass().getName().equals(IGNORED_GLASSFISH_MAGIC_CLASSLOADER)) {
        urlDefinitions.add(new URLDefinition(uri,highestClassLoader));
      }
    }
    return urlDefinitions;
  }
 catch (  Exception e) {
    LOGGER.severe(e);
  }
  return Collections.emptySet();
}
Program: 46688
Project: 46688
Buggy source:
@Test public void testGetAll() throws Exception {
  int mapSize=1000;
  int expectedNearCacheHits=400;
  String mapName="String_Node_Str";
  Config config=getConfig();
  NearCacheConfig nearCacheConfig=newNearCacheConfig();
  config.getMapConfig(mapName).setNearCacheConfig(nearCacheConfig);
  TestHazelcastInstanceFactory hazelcastInstanceFactory=createHazelcastInstanceFactory(2);
  HazelcastInstance[] instances=hazelcastInstanceFactory.newInstances(config);
  IMap<Integer,Integer> map=instances[0].getMap(mapName);
  HashSet<Integer> keys=new HashSet<Integer>();
  for (int i=0; i < mapSize; i++) {
    map.put(i,i);
    keys.add(i);
  }
  for (int i=0; i < mapSize; i++) {
    map.get(i);
  }
  Map<Integer,Integer> allEntries=map.getAll(keys);
  for (int i=0; i < mapSize; i++) {
    assertEquals(i,(int)allEntries.get(i));
  }
  NearCacheStats stats=map.getLocalMapStats().getNearCacheStats();
  assertTrue(String.format("String_Node_Str",expectedNearCacheHits,stats.getHits()),stats.getHits() > expectedNearCacheHits);
}

Fixed version (ground truth):
@Test public void testGetAll() throws Exception {
  int mapSize=1000;
  int expectedNearCacheHits=0;
  String mapName="String_Node_Str";
  Config config=getConfig();
  NearCacheConfig nearCacheConfig=newNearCacheConfig();
  config.getMapConfig(mapName).setNearCacheConfig(nearCacheConfig);
  TestHazelcastInstanceFactory hazelcastInstanceFactory=createHazelcastInstanceFactory(2);
  HazelcastInstance[] instances=hazelcastInstanceFactory.newInstances(config);
  warmUpPartitions(instances);
  HazelcastInstance hazelcastInstance=instances[0];
  Node node=TestUtil.getNode(hazelcastInstance);
  InternalPartitionService partitionService=node.getNodeEngine().getPartitionService();
  IMap<Integer,Integer> map=hazelcastInstance.getMap(mapName);
  HashSet<Integer> keys=new HashSet<Integer>();
  for (int i=0; i < mapSize; i++) {
    map.put(i,i);
    keys.add(i);
  }
  for (int i=0; i < mapSize; i++) {
    map.get(i);
    int partitionId=partitionService.getPartitionId(i);
    if (!partitionService.isPartitionOwner(partitionId)) {
      expectedNearCacheHits++;
    }
  }
  Map<Integer,Integer> allEntries=map.getAll(keys);
  for (int i=0; i < mapSize; i++) {
    assertEquals(i,(int)allEntries.get(i));
  }
  NearCacheStats stats=map.getLocalMapStats().getNearCacheStats();
  assertEquals(String.format("String_Node_Str",expectedNearCacheHits,stats.getHits()),expectedNearCacheHits,stats.getHits());
}
Program: 46689
Project: 46689
Buggy source:
@Override public void run() throws Exception {
  final ICacheService service=getService();
  final CacheConfig cacheConfig=service.getCacheConfig(name);
  if (cacheConfig == null) {
    CacheSimpleConfig simpleConfig=service.findCacheConfig(simpleName);
    if (simpleConfig != null) {
      try {
        CacheConfig cacheConfigFromSimpleConfig=new CacheConfig(simpleConfig);
        cacheConfigFromSimpleConfig.setName(simpleName);
        cacheConfigFromSimpleConfig.setManagerPrefix(name.substring(0,name.lastIndexOf(simpleName)));
        if (service.putCacheConfigIfAbsent(cacheConfigFromSimpleConfig) == null) {
          response=cacheConfigFromSimpleConfig;
          return;
        }
      }
 catch (      Exception e) {
        throw new CacheException(e);
      }
    }
  }
  response=cacheConfig;
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  final ICacheService service=getService();
  CacheConfig cacheConfig=service.getCacheConfig(name);
  if (cacheConfig == null) {
    CacheSimpleConfig simpleConfig=service.findCacheConfig(simpleName);
    if (simpleConfig != null) {
      try {
        cacheConfig=new CacheConfig(simpleConfig);
        cacheConfig.setName(simpleName);
        cacheConfig.setManagerPrefix(name.substring(0,name.lastIndexOf(simpleName)));
        CacheConfig existingCacheConfig=service.putCacheConfigIfAbsent(cacheConfig);
        if (existingCacheConfig != null) {
          cacheConfig=existingCacheConfig;
        }
      }
 catch (      Exception e) {
        throw new CacheException(e);
      }
    }
  }
  response=cacheConfig;
}
Program: 46690
Project: 46690
Buggy source:
@Override public void run() throws Exception {
  final CacheService service=getService();
  final CacheConfig cacheConfig=service.getCacheConfig(name);
  if (cacheConfig == null) {
    CacheSimpleConfig simpleConfig=service.findCacheConfig(simpleName);
    if (simpleConfig != null) {
      try {
        CacheConfig cacheConfigFromSimpleConfig=new CacheConfig(simpleConfig);
        cacheConfigFromSimpleConfig.setName(simpleName);
        cacheConfigFromSimpleConfig.setManagerPrefix(name.substring(0,name.lastIndexOf(simpleName)));
        if (service.createCacheConfigIfAbsent(cacheConfigFromSimpleConfig) == null) {
          response=cacheConfigFromSimpleConfig;
          return;
        }
      }
 catch (      Exception e) {
        throw new CacheException(e);
      }
    }
  }
  response=cacheConfig;
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  final CacheService service=getService();
  CacheConfig cacheConfig=service.getCacheConfig(name);
  if (cacheConfig == null) {
    CacheSimpleConfig simpleConfig=service.findCacheConfig(simpleName);
    if (simpleConfig != null) {
      try {
        cacheConfig=new CacheConfig(simpleConfig);
        cacheConfig.setName(simpleName);
        cacheConfig.setManagerPrefix(name.substring(0,name.lastIndexOf(simpleName)));
        CacheConfig existingCacheConfig=service.createCacheConfigIfAbsent(cacheConfig);
        if (existingCacheConfig != null) {
          cacheConfig=existingCacheConfig;
        }
      }
 catch (      Exception e) {
        throw new CacheException(e);
      }
    }
  }
  response=cacheConfig;
}
Program: 46691
Project: 46691
Buggy source:
@Override public void partitionLost(MapPartitionLostEvent event){
  this.events.add(event);
}

Fixed version (ground truth):
@Override public synchronized void partitionLost(MapPartitionLostEvent event){
  this.events.add(event);
}
Program: 46692
Project: 46692
Buggy source:
public List<MapPartitionLostEvent> getEvents(){
synchronized (events) {
    return new ArrayList<MapPartitionLostEvent>(events);
  }
}

Fixed version (ground truth):
public synchronized List<MapPartitionLostEvent> getEvents(){
  return new ArrayList<MapPartitionLostEvent>(events);
}
Program: 46693
Project: 46693
Buggy source:
@Override public void partitionLost(MapPartitionLostEvent event){
  this.events.add(event);
}

Fixed version (ground truth):
@Override public synchronized void partitionLost(MapPartitionLostEvent event){
  this.events.add(event);
}
Program: 46694
Project: 46694
Buggy source:
public List<MapPartitionLostEvent> getEvents(){
synchronized (events) {
    return new ArrayList<MapPartitionLostEvent>(events);
  }
}

Fixed version (ground truth):
public synchronized List<MapPartitionLostEvent> getEvents(){
  return new ArrayList<MapPartitionLostEvent>(events);
}
Program: 46695
Project: 46695
Buggy source:
protected long updateAccessDuration(Data key,R record,ExpiryPolicy expiryPolicy,long now){
  long expiryTime=-1L;
  try {
    Duration expiryDuration=expiryPolicy.getExpiryForAccess();
    if (expiryDuration != null) {
      expiryTime=expiryDuration.getAdjustedTime(now);
      record.setExpirationTime(expiryTime);
      if (isEventsEnabled()) {
        CacheEventContext cacheEventContext=createBaseEventContext(CacheEventType.EXPIRATION_TIME_UPDATED,toEventData(key),toEventData(record.getValue()),expiryTime,null,IGNORE_COMPLETION);
        cacheEventContext.setAccessHit(record.getAccessHit());
        publishEvent(cacheEventContext);
      }
    }
  }
 catch (  Exception e) {
    EmptyStatement.ignore(e);
  }
  return expiryTime;
}

Fixed version (ground truth):
protected long updateAccessDuration(Data key,R record,ExpiryPolicy expiryPolicy,long now){
  long expiryTime=CacheRecord.TIME_NOT_AVAILABLE;
  try {
    Duration expiryDuration=expiryPolicy.getExpiryForAccess();
    if (expiryDuration != null) {
      expiryTime=expiryDuration.getAdjustedTime(now);
      record.setExpirationTime(expiryTime);
      if (isEventsEnabled()) {
        CacheEventContext cacheEventContext=createBaseEventContext(CacheEventType.EXPIRATION_TIME_UPDATED,toEventData(key),toEventData(record.getValue()),expiryTime,null,IGNORE_COMPLETION);
        cacheEventContext.setAccessHit(record.getAccessHit());
        publishEvent(cacheEventContext);
      }
    }
  }
 catch (  Exception e) {
    EmptyStatement.ignore(e);
  }
  return expiryTime;
}