nus-yam/ex-repair huggingface dataset:
Program: 47570
Project: 47570
Buggy source:
private void sendInternal(ClientCallFuture future,ClientConnection connection,int partitionId){
  connection.registerCallId(future);
  future.setConnection(connection);
  final SerializationService ss=client.getSerializationService();
  final ClientRequest request=future.getRequest();
  final Data data=ss.toData(request);
  Packet packet=new Packet(data,partitionId,ss.getPortableContext());
  if (!isAllowedToSendRequest(connection,request) || !connection.write(packet)) {
    final int callId=request.getCallId();
    connection.deRegisterCallId(callId);
    connection.deRegisterEventHandler(callId);
    future.notify(new TargetNotMemberException("String_Node_Str" + connection.getRemoteEndpoint()));
  }
}

Fixed version (ground truth):
private void sendInternal(ClientCallFuture future,ClientConnection connection,int partitionId){
  if (connection == null || !connection.isAlive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  connection.registerCallId(future);
  future.setConnection(connection);
  final SerializationService ss=client.getSerializationService();
  final ClientRequest request=future.getRequest();
  final Data data=ss.toData(request);
  Packet packet=new Packet(data,partitionId,ss.getPortableContext());
  if (!isAllowedToSendRequest(connection,request) || !connection.write(packet)) {
    final int callId=request.getCallId();
    connection.deRegisterCallId(callId);
    connection.deRegisterEventHandler(callId);
    future.notify(new TargetNotMemberException("String_Node_Str" + connection.getRemoteEndpoint()));
  }
}
Program: 47571
Project: 47571
Buggy source:
public boolean isHeartBeating(){
  return heartBeating;
}

Fixed version (ground truth):
public boolean isHeartBeating(){
  return live && heartBeating;
}
Program: 47572
Project: 47572
Buggy source:
private boolean isConnectionHealthy(long elapsed){
  if (elapsed >= heartBeatInterval) {
    return connection.isAlive() && connection.isHeartBeating();
  }
  return true;
}

Fixed version (ground truth):
private boolean isConnectionHealthy(long elapsed){
  if (elapsed >= heartBeatInterval) {
    return connection.isHeartBeating();
  }
  return true;
}
Program: 47573
Project: 47573
Buggy source:
private void sendInternal(ClientCallFuture future,ClientConnection connection,int partitionId){
  if (connection == null || !connection.isAlive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  connection.registerCallId(future);
  future.setConnection(connection);
  final SerializationService ss=client.getSerializationService();
  final ClientRequest request=future.getRequest();
  final Data data=ss.toData(request);
  Packet packet=new Packet(data,partitionId,ss.getPortableContext());
  if (!isAllowedToSendRequest(connection,request) || !connection.write(packet)) {
    final int callId=request.getCallId();
    connection.deRegisterCallId(callId);
    connection.deRegisterEventHandler(callId);
    future.notify(new TargetNotMemberException("String_Node_Str" + connection.getRemoteEndpoint()));
  }
}

Fixed version (ground truth):
private void sendInternal(ClientCallFuture future,ClientConnection connection,int partitionId){
  connection.registerCallId(future);
  future.setConnection(connection);
  final SerializationService ss=client.getSerializationService();
  final ClientRequest request=future.getRequest();
  final Data data=ss.toData(request);
  Packet packet=new Packet(data,partitionId,ss.getPortableContext());
  if (!isAllowedToSendRequest(connection,request) || !connection.write(packet)) {
    final int callId=request.getCallId();
    connection.deRegisterCallId(callId);
    connection.deRegisterEventHandler(callId);
    future.notify(new TargetNotMemberException("String_Node_Str" + connection.getRemoteEndpoint()));
  }
}
Program: 47574
Project: 47574
Buggy source:
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!clientContext.isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}

Fixed version (ground truth):
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!clientContext.isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
 else       if (isClosed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
 else       if (isDestroyed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}
Program: 47575
Project: 47575
Buggy source:
/** 
 * Directly access to local Cache Statistics.
 * @return CacheStatistics instance or an empty statistics if not enabled
 */
CacheStatistics getLocalCacheStatistics();

Fixed version (ground truth):
CacheStatistics getLocalCacheStatistics();
Program: 47576
Project: 47576
Buggy source:
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!getNodeEngine().isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}

Fixed version (ground truth):
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!getNodeEngine().isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
 else       if (isClosed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
 else       if (isDestroyed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}
Program: 47577
Project: 47577
Buggy source:
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!clientContext.isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}

Fixed version (ground truth):
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!clientContext.isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
 else       if (isClosed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
 else       if (isDestroyed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}
Program: 47578
Project: 47578
Buggy source:
/** 
 * Directly access to local Cache Statistics.
 * @return CacheStatistics instance or an empty statistics if not enabled
 */
CacheStatistics getLocalCacheStatistics();

Fixed version (ground truth):
CacheStatistics getLocalCacheStatistics();
Program: 47579
Project: 47579
Buggy source:
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!getNodeEngine().isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}

Fixed version (ground truth):
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!getNodeEngine().isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
 else       if (isClosed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
 else       if (isDestroyed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}
Program: 47580
Project: 47580
Buggy source:
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!clientContext.isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}

Fixed version (ground truth):
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!clientContext.isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
 else       if (isClosed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
 else       if (isDestroyed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}
Program: 47581
Project: 47581
Buggy source:
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!getNodeEngine().isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}

Fixed version (ground truth):
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!getNodeEngine().isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
 else       if (isClosed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
 else       if (isDestroyed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}
Program: 47582
Project: 47582
Buggy source:
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!clientContext.isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}

Fixed version (ground truth):
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!clientContext.isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
 else       if (isClosed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
 else       if (isDestroyed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}
Program: 47583
Project: 47583
Buggy source:
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!getNodeEngine().isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}

Fixed version (ground truth):
private void awaitLatch(CountDownLatch countDownLatch){
  try {
    long currentTimeoutMs=MAX_COMPLETION_LATCH_WAIT_TIME;
    while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP,TimeUnit.MILLISECONDS)) {
      currentTimeoutMs-=COMPLETION_LATCH_WAIT_TIME_STEP;
      if (!getNodeEngine().isActive()) {
        throw new HazelcastInstanceNotActiveException();
      }
 else       if (isClosed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
 else       if (isDestroyed()) {
        throw new IllegalStateException("String_Node_Str" + nameWithPrefix + "String_Node_Str");
      }
    }
  }
 catch (  InterruptedException e) {
    ExceptionUtil.sneakyThrow(e);
  }
}
Program: 47584
Project: 47584
Buggy source:
public ClientConnectionManagerImpl(HazelcastClientInstanceImpl client,AddressTranslator addressTranslator){
  this.client=client;
  this.addressTranslator=addressTranslator;
  final ClientConfig config=client.getClientConfig();
  final ClientNetworkConfig networkConfig=config.getNetworkConfig();
  final int connTimeout=networkConfig.getConnectionTimeout();
  connectionTimeout=connTimeout == 0 ? Integer.MAX_VALUE : connTimeout;
  final ClientProperties clientProperties=client.getClientProperties();
  int timeout=clientProperties.getHeartbeatTimeout().getInteger();
  this.heartBeatTimeout=timeout > 0 ? timeout : Integer.parseInt(PROP_HEARTBEAT_TIMEOUT_DEFAULT);
  int interval=clientProperties.getHeartbeatInterval().getInteger();
  heartBeatInterval=interval > 0 ? interval : Integer.parseInt(PROP_HEARTBEAT_INTERVAL_DEFAULT);
  executionService=(ClientExecutionServiceImpl)client.getClientExecutionService();
  inSelector=new InSelectorImpl(client.getThreadGroup(),"String_Node_Str",Logger.getLogger(InSelectorImpl.class),OUT_OF_MEMORY_HANDLER);
  outSelector=new OutSelectorImpl(client.getThreadGroup(),"String_Node_Str",Logger.getLogger(OutSelectorImpl.class),OUT_OF_MEMORY_HANDLER);
  socketOptions=networkConfig.getSocketOptions();
  ClientExtension clientExtension=client.getClientExtension();
  socketChannelWrapperFactory=clientExtension.getSocketChannelWrapperFactory();
  socketInterceptor=initSocketInterceptor(networkConfig.getSocketInterceptorConfig());
}

Fixed version (ground truth):
public ClientConnectionManagerImpl(HazelcastClientInstanceImpl client,AddressTranslator addressTranslator){
  this.client=client;
  this.addressTranslator=addressTranslator;
  final ClientConfig config=client.getClientConfig();
  final ClientNetworkConfig networkConfig=config.getNetworkConfig();
  final int connTimeout=networkConfig.getConnectionTimeout();
  connectionTimeout=connTimeout == 0 ? Integer.MAX_VALUE : connTimeout;
  final ClientProperties clientProperties=client.getClientProperties();
  int timeout=clientProperties.getHeartbeatTimeout().getInteger();
  this.heartBeatTimeout=timeout > 0 ? timeout : Integer.parseInt(PROP_HEARTBEAT_TIMEOUT_DEFAULT);
  int interval=clientProperties.getHeartbeatInterval().getInteger();
  heartBeatInterval=interval > 0 ? interval : Integer.parseInt(PROP_HEARTBEAT_INTERVAL_DEFAULT);
  executionService=(ClientExecutionServiceImpl)client.getClientExecutionService();
  inSelector=new InSelectorImpl(client.getThreadGroup(),"String_Node_Str",Logger.getLogger(InSelectorImpl.class),OUT_OF_MEMORY_HANDLER);
  outSelector=new ClientOutSelectorImpl(client.getThreadGroup(),"String_Node_Str",Logger.getLogger(ClientOutSelectorImpl.class),OUT_OF_MEMORY_HANDLER);
  socketOptions=networkConfig.getSocketOptions();
  ClientExtension clientExtension=client.getClientExtension();
  socketChannelWrapperFactory=clientExtension.getSocketChannelWrapperFactory();
  socketInterceptor=initSocketInterceptor(networkConfig.getSocketInterceptorConfig());
}
Program: 47585
Project: 47585
Buggy source:
public void enqueueSocketWritable(SocketWritable socketWritable){
  writeQueue.offer(socketWritable);
  if (informSelector.compareAndSet(true,false)) {
    ioSelector.addTask(this);
    ioSelector.wakeup();
  }
}

Fixed version (ground truth):
public void enqueueSocketWritable(SocketWritable socketWritable){
  writeQueue.offer(socketWritable);
  if (informSelector.compareAndSet(true,false)) {
    register();
  }
}
Program: 47586
Project: 47586
Buggy source:
@Test(timeout=60000) public void testOperationRedo() throws Exception {
  final HazelcastInstance hz1=Hazelcast.newHazelcastInstance();
  final HazelcastInstance hz2=Hazelcast.newHazelcastInstance();
  ClientConfig clientConfig=new ClientConfig();
  clientConfig.setRedoOperation(true);
  HazelcastInstance client=HazelcastClient.newHazelcastClient(clientConfig);
  final Thread thread=new Thread(){
    public void run(){
      try {
        Thread.sleep(100);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
      hz1.getLifecycleService().shutdown();
    }
  }
;
  final IMap map=client.getMap("String_Node_Str");
  thread.start();
  int expected=1000;
  for (int i=0; i < expected; i++) {
    map.put(i,"String_Node_Str" + i);
  }
  thread.join();
  assertEquals(expected,map.size());
}

Fixed version (ground truth):
@Test(timeout=60000) public void testOperationRedo() throws Exception {
  final HazelcastInstance hz1=Hazelcast.newHazelcastInstance();
  Hazelcast.newHazelcastInstance();
  ClientConfig clientConfig=new ClientConfig();
  clientConfig.getNetworkConfig().setRedoOperation(true);
  HazelcastInstance client=HazelcastClient.newHazelcastClient(clientConfig);
  final Thread thread=new Thread(){
    public void run(){
      try {
        Thread.sleep(100);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
      hz1.getLifecycleService().shutdown();
    }
  }
;
  final IMap map=client.getMap("String_Node_Str");
  thread.start();
  int expected=1000;
  for (int i=0; i < expected; i++) {
    map.put(i,"String_Node_Str" + i);
  }
  thread.join();
  assertEquals(expected,map.size());
}
Program: 47587
Project: 47587
Buggy source:
@Test public void testCompletionTest() throws InterruptedException {
  String cacheName="String_Node_Str";
  CacheManager cacheManager=cachingProvider1.getCacheManager();
  CacheConfig<Integer,String> config=new CacheConfig<Integer,String>();
  SimpleEntryListener<Integer,String> listener=new SimpleEntryListener<Integer,String>();
  MutableCacheEntryListenerConfiguration<Integer,String> listenerConfiguration=new MutableCacheEntryListenerConfiguration<Integer,String>(FactoryBuilder.factoryOf(listener),null,true,true);
  config.addCacheEntryListenerConfiguration(listenerConfiguration);
  Cache<Integer,String> cache=cacheManager.createCache(cacheName,config);
  assertNotNull(cache);
  Integer key1=1;
  String value1="String_Node_Str";
  cache.put(key1,value1);
  assertEquals(1,listener.created.get());
  Integer key2=2;
  String value2="String_Node_Str";
  cache.put(key2,value2);
  assertEquals(2,listener.created.get());
  Set<Integer> keys=new HashSet<Integer>();
  keys.add(key1);
  keys.add(key2);
  cache.removeAll(keys);
  assertEquals(2,listener.removed.get());
}

Fixed version (ground truth):
@Test public void testCompletionTest() throws InterruptedException {
  String cacheName="String_Node_Str";
  CacheManager cacheManager=cachingProvider1.getCacheManager();
  CacheConfig<Integer,String> config=new CacheConfig<Integer,String>();
  final SimpleEntryListener<Integer,String> listener=new SimpleEntryListener<Integer,String>();
  MutableCacheEntryListenerConfiguration<Integer,String> listenerConfiguration=new MutableCacheEntryListenerConfiguration<Integer,String>(FactoryBuilder.factoryOf(listener),null,true,true);
  config.addCacheEntryListenerConfiguration(listenerConfiguration);
  Cache<Integer,String> cache=cacheManager.createCache(cacheName,config);
  assertNotNull(cache);
  Integer key1=1;
  String value1="String_Node_Str";
  cache.put(key1,value1);
  assertTrueEventually(new AssertTask(){
    @Override public void run() throws Exception {
      assertEquals(1,listener.created.get());
    }
  }
);
  Integer key2=2;
  String value2="String_Node_Str";
  cache.put(key2,value2);
  assertTrueEventually(new AssertTask(){
    @Override public void run() throws Exception {
      assertEquals(2,listener.created.get());
    }
  }
);
  Set<Integer> keys=new HashSet<Integer>();
  keys.add(key1);
  keys.add(key2);
  cache.removeAll(keys);
  assertTrueEventually(new AssertTask(){
    @Override public void run() throws Exception {
      assertEquals(2,listener.removed.get());
    }
  }
);
}
Program: 47588
Project: 47588
Buggy source:
@Override public void onCreated(Iterable<CacheEntryEvent<? extends K,? extends V>> cacheEntryEvents) throws CacheEntryListenerException {
  try {
    Thread.sleep(3000);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
  for (  CacheEntryEvent<? extends K,? extends V> cacheEntryEvent : cacheEntryEvents) {
    created.incrementAndGet();
  }
}

Fixed version (ground truth):
@Override public void onCreated(Iterable<CacheEntryEvent<? extends K,? extends V>> cacheEntryEvents) throws CacheEntryListenerException {
  for (  CacheEntryEvent<? extends K,? extends V> cacheEntryEvent : cacheEntryEvents) {
    created.incrementAndGet();
  }
}
Program: 47589
Project: 47589
Buggy source:
@Override public JsonObject toJson(){
  if (lastAccessNanos < 0) {
    return null;
  }
  JsonObject root=new JsonObject();
  root.add("String_Node_Str",id);
  root.add("String_Node_Str",startedAt);
  root.add("String_Node_Str",durationNanos);
  return root;
}

Fixed version (ground truth):
@Override public JsonObject toJson(){
}
Program: 47590
Project: 47590
Buggy source:
@Override public String toString(){
  if (lastAccessNanos < 0) {
    return null;
  }
  return "String_Node_Str" + "String_Node_Str" + id + "String_Node_Str"+ startedAt+ "String_Node_Str"+ durationNanos+ '}';
}

Fixed version (ground truth):
@Override public String toString(){
}
Program: 47591
Project: 47591
Buggy source:
Invocation getOrCreateInvocation(int operationHashCode,long lastDurationNanos,long nowNanos,long nowMillis){
  totalInvocations++;
  Invocation invocation=ConcurrencyUtil.getOrPutIfAbsent(invocations,operationHashCode,INVOCATION_CONSTRUCTOR_FUNCTION);
  invocation.id=operationHashCode;
  invocation.startedAt=nowMillis - invocation.durationNanos;
  invocation.durationNanos=TimeUnit.NANOSECONDS.toMillis(lastDurationNanos);
  invocation.lastAccessNanos=nowNanos;
  return invocation;
}

Fixed version (ground truth):
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="String_Node_Str",justification="String_Node_Str") Invocation getOrCreateInvocation(int operationHashCode,long lastDurationNanos,long nowNanos,long nowMillis){
  totalInvocations++;
  Invocation invocation=ConcurrencyUtil.getOrPutIfAbsent(invocations,operationHashCode,INVOCATION_CONSTRUCTOR_FUNCTION);
  invocation.id=operationHashCode;
  invocation.startedAt=nowMillis - invocation.durationNanos;
  invocation.durationNanos=TimeUnit.NANOSECONDS.toMillis(lastDurationNanos);
  invocation.lastAccessNanos=nowNanos;
  return invocation;
}
Program: 47592
Project: 47592
Buggy source:
public void entryAdded(EntryEvent<K,V> event){
  addedCount++;
}

Fixed version (ground truth):
public void entryAdded(EntryEvent<K,V> event){
  addedCount.incrementAndGet();
}
Program: 47593
Project: 47593
Buggy source:
@Test public void testListener() throws InterruptedException {
  String mapName="String_Node_Str";
  long key=1L;
  String value="String_Node_Str";
  String value2="String_Node_Str";
  final TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(2);
  HazelcastInstance instance1=factory.newHazelcastInstance();
  HazelcastInstance instance2=factory.newHazelcastInstance();
  CountingEntryListener<Object,Object> listener=new CountingEntryListener<Object,Object>();
  MultiMap<Object,Object> map=instance1.getMultiMap(mapName);
  map.addEntryListener(listener,true);
  TransactionContext ctx1=instance2.newTransactionContext();
  ctx1.beginTransaction();
  ctx1.getMultiMap(mapName).put(key,value);
  ctx1.commitTransaction();
  TransactionContext ctx2=instance2.newTransactionContext();
  ctx2.beginTransaction();
  ctx2.getMultiMap(mapName).remove(key,value);
  ctx2.commitTransaction();
  TransactionContext ctx3=instance2.newTransactionContext();
  ctx3.beginTransaction();
  ctx3.getMultiMap(mapName).put(key,value2);
  ctx3.commitTransaction();
  TransactionContext ctx4=instance1.newTransactionContext();
  ctx4.beginTransaction();
  ctx4.getMultiMap(mapName).remove(key,value2);
  ctx4.commitTransaction();
  Thread.sleep(100);
  assertEquals(2,listener.addedCount);
  assertEquals(2,listener.removedCount);
}

Fixed version (ground truth):
@Test public void testListener() throws InterruptedException {
  String mapName="String_Node_Str";
  long key=1L;
  String value="String_Node_Str";
  String value2="String_Node_Str";
  final TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(2);
  HazelcastInstance instance1=factory.newHazelcastInstance();
  HazelcastInstance instance2=factory.newHazelcastInstance();
  CountingEntryListener<Object,Object> listener=new CountingEntryListener<Object,Object>();
  MultiMap<Object,Object> map=instance1.getMultiMap(mapName);
  map.addEntryListener(listener,true);
  TransactionContext ctx1=instance2.newTransactionContext();
  ctx1.beginTransaction();
  ctx1.getMultiMap(mapName).put(key,value);
  ctx1.commitTransaction();
  TransactionContext ctx2=instance2.newTransactionContext();
  ctx2.beginTransaction();
  ctx2.getMultiMap(mapName).remove(key,value);
  ctx2.commitTransaction();
  TransactionContext ctx3=instance2.newTransactionContext();
  ctx3.beginTransaction();
  ctx3.getMultiMap(mapName).put(key,value2);
  ctx3.commitTransaction();
  TransactionContext ctx4=instance1.newTransactionContext();
  ctx4.beginTransaction();
  ctx4.getMultiMap(mapName).remove(key,value2);
  ctx4.commitTransaction();
  Thread.sleep(100);
  assertEquals(2,listener.getAddedCount());
  assertEquals(2,listener.getRemovedCount());
}
Program: 47594
Project: 47594
Buggy source:
public void entryRemoved(EntryEvent<K,V> event){
  removedCount++;
}

Fixed version (ground truth):
public void entryRemoved(EntryEvent<K,V> event){
  removedCount.incrementAndGet();
}
Program: 47595
Project: 47595
Buggy source:
@Override public OperationHandler[] getPartitionOperationHandlers(){
  return partitionOperationHandlers;
}

Fixed version (ground truth):
@edu.umd.cs.findbugs.annotations.SuppressWarnings({"String_Node_Str"}) @Override public OperationHandler[] getPartitionOperationHandlers(){
  return partitionOperationHandlers;
}
Program: 47596
Project: 47596
Buggy source:
@Override public OperationHandler[] getGenericOperationHandlers(){
  return genericOperationHandlers;
}

Fixed version (ground truth):
@edu.umd.cs.findbugs.annotations.SuppressWarnings({"String_Node_Str"}) @Override public OperationHandler[] getGenericOperationHandlers(){
  return genericOperationHandlers;
}
Program: 47597
Project: 47597
Buggy source:
public PartitionOperationThread(String name,int threadId,ScheduleQueue scheduleQueue,ILogger logger,HazelcastThreadGroup threadGroup,NodeExtension nodeExtension,OperationHandler[] partitionOperationHandlers){
  super(name,threadId,scheduleQueue,logger,threadGroup,nodeExtension);
  this.partitionOperationHandlers=partitionOperationHandlers;
}

Fixed version (ground truth):
@edu.umd.cs.findbugs.annotations.SuppressWarnings({"String_Node_Str"}) public PartitionOperationThread(String name,int threadId,ScheduleQueue scheduleQueue,ILogger logger,HazelcastThreadGroup threadGroup,NodeExtension nodeExtension,OperationHandler[] partitionOperationHandlers){
  super(name,threadId,scheduleQueue,logger,threadGroup,nodeExtension);
  this.partitionOperationHandlers=partitionOperationHandlers;
}
Program: 47598
Project: 47598
Buggy source:
@Override public void readData(ObjectDataInput in) throws IOException {
  name=in.readUTF();
  evictionPolicy=in.readUTF();
  timeToLiveSeconds=in.readInt();
  maxSize=in.readInt();
  maxSize=in.readInt();
  invalidateOnChange=in.readBoolean();
  cacheLocalEntries=in.readBoolean();
  final int inMemoryFormatInt=in.readInt();
  inMemoryFormat=InMemoryFormat.values()[inMemoryFormatInt];
  final int localUpdatePolicyInt=in.readInt();
  localUpdatePolicy=LocalUpdatePolicy.values()[localUpdatePolicyInt];
}

Fixed version (ground truth):
@Override public void readData(ObjectDataInput in) throws IOException {
  name=in.readUTF();
  evictionPolicy=in.readUTF();
  timeToLiveSeconds=in.readInt();
  maxSize=in.readInt();
  invalidateOnChange=in.readBoolean();
  cacheLocalEntries=in.readBoolean();
  final int inMemoryFormatInt=in.readInt();
  inMemoryFormat=InMemoryFormat.values()[inMemoryFormatInt];
  final int localUpdatePolicyInt=in.readInt();
  localUpdatePolicy=LocalUpdatePolicy.values()[localUpdatePolicyInt];
}
Program: 47599
Project: 47599
Buggy source:
@Override public void readData(ObjectDataInput in) throws IOException {
  name=in.readUTF();
  evictionPolicy=in.readUTF();
  timeToLiveSeconds=in.readInt();
  maxSize=in.readInt();
  maxSize=in.readInt();
  invalidateOnChange=in.readBoolean();
  cacheLocalEntries=in.readBoolean();
  final int inMemoryFormatInt=in.readInt();
  inMemoryFormat=InMemoryFormat.values()[inMemoryFormatInt];
  final int localUpdatePolicyInt=in.readInt();
  localUpdatePolicy=LocalUpdatePolicy.values()[localUpdatePolicyInt];
}

Fixed version (ground truth):
@Override public void readData(ObjectDataInput in) throws IOException {
  name=in.readUTF();
  evictionPolicy=in.readUTF();
  timeToLiveSeconds=in.readInt();
  maxSize=in.readInt();
  invalidateOnChange=in.readBoolean();
  cacheLocalEntries=in.readBoolean();
  final int inMemoryFormatInt=in.readInt();
  inMemoryFormat=InMemoryFormat.values()[inMemoryFormatInt];
  final int localUpdatePolicyInt=in.readInt();
  localUpdatePolicy=LocalUpdatePolicy.values()[localUpdatePolicyInt];
}
Program: 47600
Project: 47600
Buggy source:
public void shutdown(){
  internalExecutor.shutdown();
  try {
    boolean success=internalExecutor.awaitTermination(terminateTimeoutSeconds,TimeUnit.SECONDS);
    if (!success) {
      LOGGER.warning("String_Node_Str" + terminateTimeoutSeconds + "String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    LOGGER.warning("String_Node_Str",e);
  }
  scheduledExecutor.shutdownNow();
  executor.shutdown();
  try {
    boolean success=executor.awaitTermination(terminateTimeoutSeconds,TimeUnit.SECONDS);
    if (!success) {
      LOGGER.warning("String_Node_Str" + terminateTimeoutSeconds + "String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    LOGGER.warning("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void shutdown(){
  internalExecutor.shutdown();
  try {
    boolean success=internalExecutor.awaitTermination(TERMINATE_TIMEOUT_SECONDS,TimeUnit.SECONDS);
    if (!success) {
      LOGGER.warning("String_Node_Str" + TERMINATE_TIMEOUT_SECONDS + "String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    LOGGER.warning("String_Node_Str",e);
  }
  scheduledExecutor.shutdownNow();
  executor.shutdown();
  try {
    boolean success=executor.awaitTermination(TERMINATE_TIMEOUT_SECONDS,TimeUnit.SECONDS);
    if (!success) {
      LOGGER.warning("String_Node_Str" + TERMINATE_TIMEOUT_SECONDS + "String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    LOGGER.warning("String_Node_Str",e);
  }
}
Program: 47601
Project: 47601
Buggy source:
public void shutdown(){
  internalExecutor.shutdown();
  try {
    boolean success=internalExecutor.awaitTermination(terminateTimeoutSeconds,TimeUnit.SECONDS);
    if (!success) {
      LOGGER.warning("String_Node_Str" + terminateTimeoutSeconds + "String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    LOGGER.warning("String_Node_Str",e);
  }
  scheduledExecutor.shutdownNow();
  executor.shutdown();
  try {
    boolean success=executor.awaitTermination(terminateTimeoutSeconds,TimeUnit.SECONDS);
    if (!success) {
      LOGGER.warning("String_Node_Str" + terminateTimeoutSeconds + "String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    LOGGER.warning("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void shutdown(){
  internalExecutor.shutdown();
  try {
    boolean success=internalExecutor.awaitTermination(TERMINATE_TIMEOUT_SECONDS,TimeUnit.SECONDS);
    if (!success) {
      LOGGER.warning("String_Node_Str" + TERMINATE_TIMEOUT_SECONDS + "String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    LOGGER.warning("String_Node_Str",e);
  }
  scheduledExecutor.shutdownNow();
  executor.shutdown();
  try {
    boolean success=executor.awaitTermination(TERMINATE_TIMEOUT_SECONDS,TimeUnit.SECONDS);
    if (!success) {
      LOGGER.warning("String_Node_Str" + TERMINATE_TIMEOUT_SECONDS + "String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    LOGGER.warning("String_Node_Str",e);
  }
}
Program: 47602
Project: 47602
Buggy source:
public String createFormattedCredential(){
  return config.getAccessKey() + "String_Node_Str" + timestamp.substring(0,lastIndex)+ "String_Node_Str"+ config.getRegion()+ "String_Node_Str"+ "String_Node_Str";
}

Fixed version (ground truth):
public String createFormattedCredential(){
  return config.getAccessKey() + "String_Node_Str" + timestamp.substring(0,LAST_INDEX)+ "String_Node_Str"+ config.getRegion()+ "String_Node_Str"+ "String_Node_Str";
}
Program: 47603
Project: 47603
Buggy source:
CacheOperationProvider getOperationProvider(){
  ICacheService service=getService();
  CacheConfig cacheConfig=service.getCacheConfig(name);
  return service.getCacheOperationProvider(name,cacheConfig.getInMemoryFormat());
}

Fixed version (ground truth):
CacheOperationProvider getOperationProvider(){
  ICacheService service=getService();
  CacheConfig cacheConfig=service.getCacheConfig(name);
  if (cacheConfig == null) {
    throw new RetryableHazelcastException("String_Node_Str" + name + "String_Node_Str");
  }
  return service.getCacheOperationProvider(name,cacheConfig.getInMemoryFormat());
}
Program: 47604
Project: 47604
Buggy source:
CacheOperationProvider getOperationProvider(){
  ICacheService service=getService();
  CacheConfig cacheConfig=service.getCacheConfig(name);
  return service.getCacheOperationProvider(name,cacheConfig.getInMemoryFormat());
}

Fixed version (ground truth):
CacheOperationProvider getOperationProvider(){
  ICacheService service=getService();
  CacheConfig cacheConfig=service.getCacheConfig(name);
  if (cacheConfig == null) {
    throw new RetryableHazelcastException("String_Node_Str" + name + "String_Node_Str");
  }
  return service.getCacheOperationProvider(name,cacheConfig.getInMemoryFormat());
}
Program: 47605
Project: 47605
Buggy source:
public void run(){
  try {
    lastCleanup=Clock.currentTimeMillis();
    for (    Map.Entry<K,CacheRecord<K>> entry : cache.entrySet()) {
      if (entry.getValue().expired()) {
        cache.remove(entry.getKey());
      }
    }
  }
  finally {
    canCleanUp.set(true);
  }
}

Fixed version (ground truth):
public void run(){
  try {
    lastCleanup=Clock.currentTimeMillis();
    for (    Map.Entry<K,NearCacheRecord> entry : cache.entrySet()) {
      if (entry.getValue().isExpired(maxIdleMillis,timeToLiveMillis)) {
        cache.remove(entry.getKey());
      }
    }
  }
  finally {
    canCleanUp.set(true);
  }
}
Program: 47606
Project: 47606
Buggy source:
public ClientHeapNearCache(String mapName,ClientContext context,NearCacheConfig nearCacheConfig){
  this.mapName=mapName;
  this.context=context;
  maxSize=nearCacheConfig.getMaxSize();
  maxIdleMillis=nearCacheConfig.getMaxIdleSeconds() * SEC_TO_MILLISEC;
  inMemoryFormat=nearCacheConfig.getInMemoryFormat();
  if (inMemoryFormat != InMemoryFormat.BINARY && inMemoryFormat != InMemoryFormat.OBJECT) {
    throw new IllegalArgumentException("String_Node_Str" + inMemoryFormat);
  }
  timeToLiveMillis=nearCacheConfig.getTimeToLiveSeconds() * SEC_TO_MILLISEC;
  invalidateOnChange=nearCacheConfig.isInvalidateOnChange();
  evictionPolicy=EvictionPolicy.valueOf(nearCacheConfig.getEvictionPolicy());
  cache=new ConcurrentHashMap<K,CacheRecord<K>>();
  canCleanUp=new AtomicBoolean(true);
  canEvict=new AtomicBoolean(true);
  lastCleanup=Clock.currentTimeMillis();
  stats=new NearCacheStatsImpl();
}

Fixed version (ground truth):
public ClientHeapNearCache(String mapName,ClientContext context,NearCacheConfig nearCacheConfig){
  this.mapName=mapName;
  this.context=context;
  maxSize=nearCacheConfig.getMaxSize();
  maxIdleMillis=TimeUnit.SECONDS.toMillis(nearCacheConfig.getMaxIdleSeconds());
  inMemoryFormat=nearCacheConfig.getInMemoryFormat();
  if (inMemoryFormat != InMemoryFormat.BINARY && inMemoryFormat != InMemoryFormat.OBJECT) {
    throw new IllegalArgumentException("String_Node_Str" + inMemoryFormat);
  }
  timeToLiveMillis=TimeUnit.SECONDS.toMillis(nearCacheConfig.getTimeToLiveSeconds());
  invalidateOnChange=nearCacheConfig.isInvalidateOnChange();
  evictionPolicy=EvictionPolicy.valueOf(nearCacheConfig.getEvictionPolicy());
  selectedComparator=NearCacheRecord.getComparator(evictionPolicy);
  cache=new ConcurrentHashMap<K,NearCacheRecord>();
  canCleanUp=new AtomicBoolean(true);
  canEvict=new AtomicBoolean(true);
  lastCleanup=Clock.currentTimeMillis();
  stats=new NearCacheStatsImpl();
}
Program: 47607
Project: 47607
Buggy source:
public void put(K key,Object object){
  fireTtlCleanup();
  if (evictionPolicy == EvictionPolicy.NONE && cache.size() >= maxSize) {
    return;
  }
  if (evictionPolicy != EvictionPolicy.NONE && cache.size() >= maxSize) {
    fireEvictCache();
  }
  Object value;
  if (object == null) {
    value=NULL_OBJECT;
  }
 else {
    SerializationService serializationService=context.getSerializationService();
    if (inMemoryFormat == InMemoryFormat.BINARY) {
      value=serializationService.toData(object);
    }
 else     if (inMemoryFormat == InMemoryFormat.OBJECT) {
      value=serializationService.toObject(object);
    }
 else {
      throw new IllegalArgumentException();
    }
  }
  cache.put(key,new CacheRecord<K>(key,value));
}

Fixed version (ground truth):
public void put(K key,Object object){
  fireTtlCleanup();
  if (evictionPolicy == EvictionPolicy.NONE && cache.size() >= maxSize) {
    return;
  }
  if (evictionPolicy != EvictionPolicy.NONE && cache.size() >= maxSize) {
    fireEvictCache();
  }
  Object value;
  if (object == null) {
    value=NULL_OBJECT;
  }
 else {
    SerializationService serializationService=context.getSerializationService();
    if (inMemoryFormat == InMemoryFormat.BINARY) {
      value=serializationService.toData(object);
    }
 else     if (inMemoryFormat == InMemoryFormat.OBJECT) {
      value=serializationService.toObject(object);
    }
 else {
      throw new IllegalArgumentException();
    }
  }
  cache.put(key,new NearCacheRecord(key,value));
}
Program: 47608
Project: 47608
Buggy source:
private void fireEvictCache(){
  if (canEvict.compareAndSet(true,false)) {
    try {
      context.getExecutionService().execute(new Runnable(){
        public void run(){
          try {
            TreeSet<CacheRecord<K>> records=new TreeSet<CacheRecord<K>>(comparator);
            records.addAll(cache.values());
            int evictSize=cache.size() * EVICTION_PERCENTAGE / HUNDRED_PERCENTAGE;
            int i=0;
            for (            CacheRecord<K> record : records) {
              cache.remove(record.key);
              if (++i > evictSize) {
                break;
              }
            }
          }
  finally {
            canEvict.set(true);
          }
        }
      }
);
    }
 catch (    RejectedExecutionException e) {
      canEvict.set(true);
    }
catch (    Exception e) {
      throw ExceptionUtil.rethrow(e);
    }
  }
}

Fixed version (ground truth):
private void fireEvictCache(){
  if (canEvict.compareAndSet(true,false)) {
    try {
      context.getExecutionService().execute(new Runnable(){
        public void run(){
          try {
            TreeSet<NearCacheRecord> records=new TreeSet<NearCacheRecord>(selectedComparator);
            records.addAll(cache.values());
            int evictSize=cache.size() * EVICTION_PERCENTAGE / HUNDRED_PERCENTAGE;
            int i=0;
            for (            NearCacheRecord record : records) {
              cache.remove(record.getKey());
              if (++i > evictSize) {
                break;
              }
            }
          }
  finally {
            canEvict.set(true);
          }
        }
      }
);
    }
 catch (    RejectedExecutionException e) {
      canEvict.set(true);
    }
catch (    Exception e) {
      throw ExceptionUtil.rethrow(e);
    }
  }
}
Program: 47609
Project: 47609
Buggy source:
public Object get(K key){
  fireTtlCleanup();
  CacheRecord<K> record=cache.get(key);
  if (record != null) {
    record.access();
    if (record.expired()) {
      cache.remove(key);
      stats.incrementMisses();
      return null;
    }
    if (record.value.equals(NULL_OBJECT)) {
      stats.incrementMisses();
      return NULL_OBJECT;
    }
    stats.incrementHits();
    return inMemoryFormat.equals(InMemoryFormat.BINARY) ? context.getSerializationService().toObject(record.value) : record.value;
  }
 else {
    stats.incrementMisses();
    return null;
  }
}

Fixed version (ground truth):
public Object get(K key){
  fireTtlCleanup();
  NearCacheRecord record=cache.get(key);
  if (record != null) {
    record.access();
    if (record.isExpired(maxIdleMillis,timeToLiveMillis)) {
      cache.remove(key);
      stats.incrementMisses();
      return null;
    }
    if (record.getValue().equals(NULL_OBJECT)) {
      stats.incrementMisses();
      return NULL_OBJECT;
    }
    stats.incrementHits();
    return inMemoryFormat.equals(InMemoryFormat.BINARY) ? context.getSerializationService().toObject(record.getValue()) : record.getValue();
  }
 else {
    stats.incrementMisses();
    return null;
  }
}
Program: 47610
Project: 47610
Buggy source:
private void fireTtlCleanup(){
  if (Clock.currentTimeMillis() < (lastCleanup + TTL_CLEANUP_INTERVAL_MILLS)) {
    return;
  }
  if (canCleanUp.compareAndSet(true,false)) {
    try {
      context.getExecutionService().execute(new Runnable(){
        public void run(){
          try {
            lastCleanup=Clock.currentTimeMillis();
            for (            Map.Entry<K,CacheRecord<K>> entry : cache.entrySet()) {
              if (entry.getValue().expired()) {
                cache.remove(entry.getKey());
              }
            }
          }
  finally {
            canCleanUp.set(true);
          }
        }
      }
);
    }
 catch (    RejectedExecutionException e) {
      canCleanUp.set(true);
    }
catch (    Exception e) {
      throw ExceptionUtil.rethrow(e);
    }
  }
}

Fixed version (ground truth):
private void fireTtlCleanup(){
  if (Clock.currentTimeMillis() < (lastCleanup + TTL_CLEANUP_INTERVAL_MILLS)) {
    return;
  }
  if (canCleanUp.compareAndSet(true,false)) {
    try {
      context.getExecutionService().execute(new Runnable(){
        public void run(){
          try {
            lastCleanup=Clock.currentTimeMillis();
            for (            Map.Entry<K,NearCacheRecord> entry : cache.entrySet()) {
              if (entry.getValue().isExpired(maxIdleMillis,timeToLiveMillis)) {
                cache.remove(entry.getKey());
              }
            }
          }
  finally {
            canCleanUp.set(true);
          }
        }
      }
);
    }
 catch (    RejectedExecutionException e) {
      canCleanUp.set(true);
    }
catch (    Exception e) {
      throw ExceptionUtil.rethrow(e);
    }
  }
}
Program: 47611
Project: 47611
Buggy source:
public NearCacheStatsImpl getNearCacheStats(){
  long ownedEntryCount=0;
  long ownedEntryMemory=0;
  for (  CacheRecord record : cache.values()) {
    ownedEntryCount++;
    ownedEntryMemory+=record.getCost();
  }
  stats.setOwnedEntryCount(ownedEntryCount);
  stats.setOwnedEntryMemoryCost(ownedEntryMemory);
  return stats;
}

Fixed version (ground truth):
public NearCacheStatsImpl getNearCacheStats(){
  long ownedEntryCount=0;
  long ownedEntryMemory=0;
  for (  NearCacheRecord record : cache.values()) {
    ownedEntryCount++;
    ownedEntryMemory+=record.getCost();
  }
  stats.setOwnedEntryCount(ownedEntryCount);
  stats.setOwnedEntryMemoryCost(ownedEntryMemory);
  return stats;
}
Program: 47612
Project: 47612
Buggy source:
@Override public void run() throws Exception {
  final LocalMapStats localMapStats=clientMap.getLocalMapStats();
  NearCacheStats stats=localMapStats.getNearCacheStats();
  assertEquals(1,stats.getOwnedEntryCount());
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  assertTrue(MAX_CACHE_SIZE > stats.getOwnedEntryCount());
}
Program: 47614
Project: 47614
Buggy source:
public int compare(CacheRecord<K> o1,CacheRecord<K> o2){
  if (EvictionPolicy.LRU.equals(evictionPolicy)) {
    return ((Long)o1.lastAccessTime).compareTo((o2.lastAccessTime));
  }
 else   if (EvictionPolicy.LFU.equals(evictionPolicy)) {
    return ((Long)o1.hit.get()).compareTo((o2.hit.get()));
  }
  return 0;
}

Fixed version (ground truth):
public int compare(CacheRecord<K> o1,CacheRecord<K> o2){
  return QuickMath.compareIntegers(o1.key.hashCode(),o2.key.hashCode());
}