nus-yam/ex-repair huggingface dataset:
Program: 47523
Project: 47523
Buggy source:
public void run(){
  long lastLogPurge=System.nanoTime();
  while (running) {
    long nowNanos=System.nanoTime();
    long nowMillis=System.currentTimeMillis();
    scan(nowNanos,nowMillis,genericOperationRunners,genericCurrentOperationData);
    scan(nowNanos,nowMillis,partitionOperationRunners,partitionCurrentOperationData);
    if (purge(nowNanos,lastLogPurge)) {
      lastLogPurge=nowNanos;
    }
    sleepInterval(nowNanos);
  }
}

Fixed version (ground truth):
public void run(){
  long lastLogPurge=System.nanoTime();
  while (running) {
    long nowNanos=System.nanoTime();
    long nowMillis=System.currentTimeMillis();
    scan(nowNanos,nowMillis,genericOperationRunners,genericCurrentOperationData);
    scan(nowNanos,nowMillis,partitionOperationRunners,partitionCurrentOperationData);
    if (purge(nowNanos,lastLogPurge)) {
      lastLogPurge=nowNanos;
    }
    if (running) {
      sleepInterval(nowNanos);
    }
  }
}
Program: 47524
Project: 47524
Buggy source:
private boolean purge(long nowNanos,long lastLogPurge){
  if (nowNanos - lastLogPurge <= logPurgeIntervalNanos) {
    return false;
  }
  for (  SlowOperationLog log : slowOperationLogs.values()) {
    log.purgeInvocations(nowNanos,logRetentionNanos);
    if (log.isEmpty()) {
      slowOperationLogs.remove(log.getStackTrace().hashCode());
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean purge(long nowNanos,long lastLogPurge){
  if (nowNanos - lastLogPurge <= logPurgeIntervalNanos) {
    return false;
  }
  for (  SlowOperationLog log : slowOperationLogs.values()) {
    if (!running) {
      return false;
    }
    log.purgeInvocations(nowNanos,logRetentionNanos);
    if (log.isEmpty()) {
      slowOperationLogs.remove(log.getStackTrace().hashCode());
    }
  }
  return true;
}
Program: 47525
Project: 47525
Buggy source:
void shutdown(){
  running=false;
}

Fixed version (ground truth):
void shutdown(){
  running=false;
  try {
    slowOperationDetectorThread.join(SLOW_OPERATION_THREAD_MAX_WAIT_TIME_TO_FINISH);
  }
 catch (  InterruptedException e) {
    EmptyStatement.ignore(e);
  }
}
Program: 47526
Project: 47526
Buggy source:
public boolean isHeartBeating(){
  return heartBeating;
}

Fixed version (ground truth):
public boolean isHeartBeating(){
  return live.get() && heartBeating;
}
Program: 47527
Project: 47527
Buggy source:
private void getPartitionsBlocking(){
  while (!getPartitions()) {
    try {
      Thread.sleep(PARTITION_WAIT_TIME);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
private void getPartitionsBlocking(){
  while (!getPartitions() && client.getConnectionManager().isAlive()) {
    try {
      Thread.sleep(PARTITION_WAIT_TIME);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}
Program: 47528
Project: 47528
Buggy source:
public boolean isHeartBeating(){
  return heartBeating;
}

Fixed version (ground truth):
public boolean isHeartBeating(){
  return live.get() && heartBeating;
}
Program: 47529
Project: 47529
Buggy source:
private void getPartitionsBlocking(){
  while (!getPartitions()) {
    try {
      Thread.sleep(PARTITION_WAIT_TIME);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
private void getPartitionsBlocking(){
  while (!getPartitions() && client.getConnectionManager().isAlive()) {
    try {
      Thread.sleep(PARTITION_WAIT_TIME);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}
Program: 47530
Project: 47530
Buggy source:
@Override public void run(){
  try {
    while (!shutdown) {
      scanHandleOperationTimeout();
      backPressureService.cleanup();
      sleep();
    }
  }
 catch (  Throwable t) {
    inspectOutputMemoryError(t);
    logger.severe("String_Node_Str",t);
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    while (!shutdown) {
      scanHandleOperationTimeout();
      if (!shutdown) {
        backPressureService.cleanup();
      }
      if (!shutdown) {
        sleep();
      }
    }
  }
 catch (  Throwable t) {
    inspectOutputMemoryError(t);
    logger.severe("String_Node_Str",t);
  }
}
Program: 47531
Project: 47531
Buggy source:
private void scanHandleOperationTimeout(){
  if (invocations.isEmpty()) {
    return;
  }
  for (  BasicInvocation invocation : invocations.values()) {
    try {
      invocation.handleOperationTimeout();
    }
 catch (    Throwable t) {
      inspectOutputMemoryError(t);
      logger.severe("String_Node_Str" + invocation,t);
    }
    try {
      invocation.handleBackupTimeout(backupOperationTimeoutMillis);
    }
 catch (    Throwable t) {
      inspectOutputMemoryError(t);
      logger.severe("String_Node_Str" + invocation,t);
    }
  }
}

Fixed version (ground truth):
private void scanHandleOperationTimeout(){
  if (invocations.isEmpty()) {
    return;
  }
  for (  BasicInvocation invocation : invocations.values()) {
    if (shutdown) {
      return;
    }
    try {
      invocation.handleOperationTimeout();
    }
 catch (    Throwable t) {
      inspectOutputMemoryError(t);
      logger.severe("String_Node_Str" + invocation,t);
    }
    try {
      invocation.handleBackupTimeout(backupOperationTimeoutMillis);
    }
 catch (    Throwable t) {
      inspectOutputMemoryError(t);
      logger.severe("String_Node_Str" + invocation,t);
    }
  }
}
Program: 47532
Project: 47532
Buggy source:
@Override public void shutdown(){
  shutdown=true;
  logger.finest("String_Node_Str");
  for (  BasicInvocation invocation : invocations.values()) {
    try {
      invocation.notify(new HazelcastInstanceNotActiveException());
    }
 catch (    Throwable e) {
      logger.warning(invocation + "String_Node_Str" + e.getMessage());
    }
  }
  invocations.clear();
  scheduler.shutdown();
}

Fixed version (ground truth):
@Override public void shutdown(){
  shutdown=true;
  logger.finest("String_Node_Str");
  for (  BasicInvocation invocation : invocations.values()) {
    try {
      invocation.notify(new HazelcastInstanceNotActiveException());
    }
 catch (    Throwable e) {
      logger.warning(invocation + "String_Node_Str" + e.getMessage());
    }
  }
  invocations.clear();
  scheduler.shutdown();
  try {
    cleanupThread.join(CLEANUP_THREAD_MAX_WAIT_TIME_TO_FINISH);
  }
 catch (  InterruptedException e) {
    EmptyStatement.ignore(e);
  }
}
Program: 47533
Project: 47533
Buggy source:
BasicOperationService(NodeEngineImpl nodeEngine){
  this.nodeEngine=nodeEngine;
  this.node=nodeEngine.getNode();
  this.logger=node.getLogger(OperationService.class);
  this.invocationLogger=nodeEngine.getLogger(BasicInvocation.class);
  this.defaultCallTimeoutMillis=node.getGroupProperties().OPERATION_CALL_TIMEOUT_MILLIS.getLong();
  this.backupOperationTimeoutMillis=node.getGroupProperties().OPERATION_BACKUP_TIMEOUT_MILLIS.getLong();
  this.executionService=nodeEngine.getExecutionService();
  this.backPressureService=new BasicBackPressureService(node.getGroupProperties(),logger);
  int coreSize=Runtime.getRuntime().availableProcessors();
  boolean reallyMultiCore=coreSize >= CORE_SIZE_CHECK;
  int concurrencyLevel=reallyMultiCore ? coreSize * CORE_SIZE_FACTOR : CONCURRENCY_LEVEL;
  this.executingCalls=new ConcurrentHashMap<RemoteCallKey,RemoteCallKey>(INITIAL_CAPACITY,LOAD_FACTOR,concurrencyLevel);
  this.invocations=new ConcurrentHashMap<Long,BasicInvocation>(INITIAL_CAPACITY,LOAD_FACTOR,concurrencyLevel);
  this.scheduler=new BasicOperationScheduler(node,executionService,new BasicDispatcherImpl());
  this.operationHandler=new OperationHandler();
  this.operationBackupHandler=new OperationBackupHandler();
  this.operationPacketHandler=new OperationPacketHandler();
  this.responsePacketHandler=new ResponsePacketHandler();
  this.asyncExecutor=executionService.register(ExecutionService.ASYNC_EXECUTOR,coreSize,ASYNC_QUEUE_CAPACITY,ExecutorType.CONCRETE);
  startCleanupThread();
}

Fixed version (ground truth):
BasicOperationService(NodeEngineImpl nodeEngine){
  this.nodeEngine=nodeEngine;
  this.node=nodeEngine.getNode();
  this.logger=node.getLogger(OperationService.class);
  this.invocationLogger=nodeEngine.getLogger(BasicInvocation.class);
  this.defaultCallTimeoutMillis=node.getGroupProperties().OPERATION_CALL_TIMEOUT_MILLIS.getLong();
  this.backupOperationTimeoutMillis=node.getGroupProperties().OPERATION_BACKUP_TIMEOUT_MILLIS.getLong();
  this.executionService=nodeEngine.getExecutionService();
  this.backPressureService=new BasicBackPressureService(node.getGroupProperties(),logger);
  int coreSize=Runtime.getRuntime().availableProcessors();
  boolean reallyMultiCore=coreSize >= CORE_SIZE_CHECK;
  int concurrencyLevel=reallyMultiCore ? coreSize * CORE_SIZE_FACTOR : CONCURRENCY_LEVEL;
  this.executingCalls=new ConcurrentHashMap<RemoteCallKey,RemoteCallKey>(INITIAL_CAPACITY,LOAD_FACTOR,concurrencyLevel);
  this.invocations=new ConcurrentHashMap<Long,BasicInvocation>(INITIAL_CAPACITY,LOAD_FACTOR,concurrencyLevel);
  this.scheduler=new BasicOperationScheduler(node,executionService,new BasicDispatcherImpl());
  this.operationHandler=new OperationHandler();
  this.operationBackupHandler=new OperationBackupHandler();
  this.operationPacketHandler=new OperationPacketHandler();
  this.responsePacketHandler=new ResponsePacketHandler();
  this.asyncExecutor=executionService.register(ExecutionService.ASYNC_EXECUTOR,coreSize,ASYNC_QUEUE_CAPACITY,ExecutorType.CONCRETE);
  this.cleanupThread=new CleanupThread();
  this.cleanupThread.start();
}
Program: 47534
Project: 47534
Buggy source:
public boolean isHeartBeating(){
  return heartBeating;
}

Fixed version (ground truth):
public boolean isHeartBeating(){
  return live && heartBeating;
}
Program: 47535
Project: 47535
Buggy source:
@Override public void run(){
  try {
    while (!shutdown) {
      scanHandleOperationTimeout();
      backPressureService.cleanup();
      sleep();
    }
  }
 catch (  Throwable t) {
    inspectOutputMemoryError(t);
    logger.severe("String_Node_Str",t);
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    while (!shutdown) {
      scanHandleOperationTimeout();
      if (!shutdown) {
        backPressureService.cleanup();
      }
      if (!shutdown) {
        sleep();
      }
    }
  }
 catch (  Throwable t) {
    inspectOutputMemoryError(t);
    logger.severe("String_Node_Str",t);
  }
}
Program: 47536
Project: 47536
Buggy source:
private void scanHandleOperationTimeout(){
  if (invocations.isEmpty()) {
    return;
  }
  for (  BasicInvocation invocation : invocations.values()) {
    try {
      invocation.handleOperationTimeout();
    }
 catch (    Throwable t) {
      inspectOutputMemoryError(t);
      logger.severe("String_Node_Str" + invocation,t);
    }
    try {
      invocation.handleBackupTimeout(backupOperationTimeoutMillis);
    }
 catch (    Throwable t) {
      inspectOutputMemoryError(t);
      logger.severe("String_Node_Str" + invocation,t);
    }
  }
}

Fixed version (ground truth):
private void scanHandleOperationTimeout(){
  if (invocations.isEmpty()) {
    return;
  }
  for (  BasicInvocation invocation : invocations.values()) {
    if (shutdown) {
      return;
    }
    try {
      invocation.handleOperationTimeout();
    }
 catch (    Throwable t) {
      inspectOutputMemoryError(t);
      logger.severe("String_Node_Str" + invocation,t);
    }
    try {
      invocation.handleBackupTimeout(backupOperationTimeoutMillis);
    }
 catch (    Throwable t) {
      inspectOutputMemoryError(t);
      logger.severe("String_Node_Str" + invocation,t);
    }
  }
}
Program: 47537
Project: 47537
Buggy source:
@Override public void shutdown(){
  shutdown=true;
  logger.finest("String_Node_Str");
  for (  BasicInvocation invocation : invocations.values()) {
    try {
      invocation.notify(new HazelcastInstanceNotActiveException());
    }
 catch (    Throwable e) {
      logger.warning(invocation + "String_Node_Str" + e.getMessage());
    }
  }
  invocations.clear();
  scheduler.shutdown();
}

Fixed version (ground truth):
@Override public void shutdown(){
  shutdown=true;
  logger.finest("String_Node_Str");
  for (  BasicInvocation invocation : invocations.values()) {
    try {
      invocation.notify(new HazelcastInstanceNotActiveException());
    }
 catch (    Throwable e) {
      logger.warning(invocation + "String_Node_Str" + e.getMessage());
    }
  }
  invocations.clear();
  scheduler.shutdown();
  try {
    cleanupThread.join(CLEANUP_THREAD_MAX_WAIT_TIME_TO_FINISH);
  }
 catch (  InterruptedException e) {
    EmptyStatement.ignore(e);
  }
}
Program: 47538
Project: 47538
Buggy source:
BasicOperationService(NodeEngineImpl nodeEngine){
  this.nodeEngine=nodeEngine;
  this.node=nodeEngine.getNode();
  this.logger=node.getLogger(OperationService.class);
  this.invocationLogger=nodeEngine.getLogger(BasicInvocation.class);
  this.defaultCallTimeoutMillis=node.getGroupProperties().OPERATION_CALL_TIMEOUT_MILLIS.getLong();
  this.backupOperationTimeoutMillis=node.getGroupProperties().OPERATION_BACKUP_TIMEOUT_MILLIS.getLong();
  this.executionService=nodeEngine.getExecutionService();
  this.backPressureService=new BasicBackPressureService(node.getGroupProperties(),logger);
  int coreSize=Runtime.getRuntime().availableProcessors();
  boolean reallyMultiCore=coreSize >= CORE_SIZE_CHECK;
  int concurrencyLevel=reallyMultiCore ? coreSize * CORE_SIZE_FACTOR : CONCURRENCY_LEVEL;
  this.executingCalls=new ConcurrentHashMap<RemoteCallKey,RemoteCallKey>(INITIAL_CAPACITY,LOAD_FACTOR,concurrencyLevel);
  this.invocations=new ConcurrentHashMap<Long,BasicInvocation>(INITIAL_CAPACITY,LOAD_FACTOR,concurrencyLevel);
  this.scheduler=new BasicOperationScheduler(node,executionService,new BasicDispatcherImpl());
  this.operationHandler=new OperationHandler();
  this.operationBackupHandler=new OperationBackupHandler();
  this.operationPacketHandler=new OperationPacketHandler();
  this.responsePacketHandler=new ResponsePacketHandler();
  this.asyncExecutor=executionService.register(ExecutionService.ASYNC_EXECUTOR,coreSize,ASYNC_QUEUE_CAPACITY,ExecutorType.CONCRETE);
  startCleanupThread();
}

Fixed version (ground truth):
BasicOperationService(NodeEngineImpl nodeEngine){
  this.nodeEngine=nodeEngine;
  this.node=nodeEngine.getNode();
  this.logger=node.getLogger(OperationService.class);
  this.invocationLogger=nodeEngine.getLogger(BasicInvocation.class);
  this.defaultCallTimeoutMillis=node.getGroupProperties().OPERATION_CALL_TIMEOUT_MILLIS.getLong();
  this.backupOperationTimeoutMillis=node.getGroupProperties().OPERATION_BACKUP_TIMEOUT_MILLIS.getLong();
  this.executionService=nodeEngine.getExecutionService();
  this.backPressureService=new BasicBackPressureService(node.getGroupProperties(),logger);
  int coreSize=Runtime.getRuntime().availableProcessors();
  boolean reallyMultiCore=coreSize >= CORE_SIZE_CHECK;
  int concurrencyLevel=reallyMultiCore ? coreSize * CORE_SIZE_FACTOR : CONCURRENCY_LEVEL;
  this.executingCalls=new ConcurrentHashMap<RemoteCallKey,RemoteCallKey>(INITIAL_CAPACITY,LOAD_FACTOR,concurrencyLevel);
  this.invocations=new ConcurrentHashMap<Long,BasicInvocation>(INITIAL_CAPACITY,LOAD_FACTOR,concurrencyLevel);
  this.scheduler=new BasicOperationScheduler(node,executionService,new BasicDispatcherImpl());
  this.operationHandler=new OperationHandler();
  this.operationBackupHandler=new OperationBackupHandler();
  this.operationPacketHandler=new OperationPacketHandler();
  this.responsePacketHandler=new ResponsePacketHandler();
  this.asyncExecutor=executionService.register(ExecutionService.ASYNC_EXECUTOR,coreSize,ASYNC_QUEUE_CAPACITY,ExecutorType.CONCRETE);
  this.cleanupThread=new CleanupThread();
  this.cleanupThread.start();
}
Program: 47540
Project: 47540
Buggy source:
public LocalOperationStatsImpl(Node node){
  this.logs=((InternalOperationService)node.nodeEngine.getOperationService()).getSlowOperationLogs();
  this.maxVisibleSlowOperationCount=node.groupProperties.MC_MAX_SLOW_OPERATION_COUNT.getInteger();
}

Fixed version (ground truth):
public LocalOperationStatsImpl(Node node){
  InternalOperationService operationService=(InternalOperationService)node.nodeEngine.getOperationService();
  this.slowOperations=operationService.getSlowOperations();
  this.maxVisibleSlowOperationCount=node.groupProperties.MC_MAX_SLOW_OPERATION_COUNT.getInteger();
}
Program: 47541
Project: 47541
Buggy source:
@Override public JsonObject toJson(){
  JsonObject root=new JsonObject();
  root.add("String_Node_Str",creationTime);
  root.add("String_Node_Str",maxVisibleSlowOperationCount);
  JsonArray slowOperationLogs=new JsonArray();
  int logCount=0;
  for (  SlowOperationLog log : logs) {
    if (logCount++ < maxVisibleSlowOperationCount) {
      slowOperationLogs.add(log.toJson());
    }
  }
  root.add("String_Node_Str",slowOperationLogs);
  return root;
}

Fixed version (ground truth):
@Override public JsonObject toJson(){
  JsonObject root=new JsonObject();
  root.add("String_Node_Str",creationTime);
  root.add("String_Node_Str",maxVisibleSlowOperationCount);
  JsonArray slowOperationArray=new JsonArray();
  int logCount=0;
  for (  JsonSerializable slowOperation : slowOperations) {
    if (logCount++ < maxVisibleSlowOperationCount) {
      slowOperationArray.add(slowOperation.toJson());
    }
  }
  root.add("String_Node_Str",slowOperationArray);
  return root;
}
Program: 47542
Project: 47542
Buggy source:
@Override public int hashCode(){
  int result=logs != null ? logs.hashCode() : 0;
  result=31 * result + (int)(creationTime ^ (creationTime >>> 32));
  result=31 * result + (int)(maxVisibleSlowOperationCount ^ (maxVisibleSlowOperationCount >>> 32));
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int result=slowOperations != null ? slowOperations.hashCode() : 0;
  result=31 * result + (int)(creationTime ^ (creationTime >>> 32));
  result=31 * result + (int)(maxVisibleSlowOperationCount ^ (maxVisibleSlowOperationCount >>> 32));
  return result;
}
Program: 47543
Project: 47543
Buggy source:
@Override public boolean equals(Object o){
  if (this == o) {
    return true;
  }
  if (!(o instanceof LocalOperationStatsImpl)) {
    return false;
  }
  LocalOperationStatsImpl that=(LocalOperationStatsImpl)o;
  if (creationTime != that.creationTime) {
    return false;
  }
  if (maxVisibleSlowOperationCount != that.maxVisibleSlowOperationCount) {
    return false;
  }
  if (logs != null ? !isEqualLogs(that.logs) : that.logs != null) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o) {
    return true;
  }
  if (!(o instanceof LocalOperationStatsImpl)) {
    return false;
  }
  LocalOperationStatsImpl that=(LocalOperationStatsImpl)o;
  if (creationTime != that.creationTime) {
    return false;
  }
  if (maxVisibleSlowOperationCount != that.maxVisibleSlowOperationCount) {
    return false;
  }
  if (slowOperations != null ? !isEqualSlowOperations(that.slowOperations) : that.slowOperations != null) {
    return false;
  }
  return true;
}
Program: 47544
Project: 47544
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + creationTime + "String_Node_Str"+ logs+ "String_Node_Str"+ maxVisibleSlowOperationCount+ '}';
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + creationTime + "String_Node_Str"+ slowOperations+ "String_Node_Str"+ maxVisibleSlowOperationCount+ '}';
}
Program: 47545
Project: 47545
Buggy source:
BasicOperationService(NodeEngineImpl nodeEngine){
  this.nodeEngine=nodeEngine;
  this.node=nodeEngine.getNode();
  this.logger=node.getLogger(OperationService.class);
  this.invocationLogger=nodeEngine.getLogger(BasicInvocation.class);
  this.defaultCallTimeoutMillis=node.getGroupProperties().OPERATION_CALL_TIMEOUT_MILLIS.getLong();
  this.backupOperationTimeoutMillis=node.getGroupProperties().OPERATION_BACKUP_TIMEOUT_MILLIS.getLong();
  this.backPressureService=new BasicBackPressureService(node.getGroupProperties(),logger);
  int coreSize=Runtime.getRuntime().availableProcessors();
  boolean reallyMultiCore=coreSize >= CORE_SIZE_CHECK;
  int concurrencyLevel=reallyMultiCore ? coreSize * CORE_SIZE_FACTOR : CONCURRENCY_LEVEL;
  this.invocations=new ConcurrentHashMap<Long,BasicInvocation>(INITIAL_CAPACITY,LOAD_FACTOR,concurrencyLevel);
  this.operationBackupHandler=new OperationBackupHandler();
  this.operationExecutor=new ClassicOperationExecutor(node.getGroupProperties(),node.loggingService,node.getThisAddress(),new BasicOperationRunnerFactory(),new BasicResponsePacketHandler(),node.getHazelcastThreadGroup(),node.getNodeExtension());
  ExecutionService executionService=nodeEngine.getExecutionService();
  this.asyncExecutor=executionService.register(ExecutionService.ASYNC_EXECUTOR,coreSize,ASYNC_QUEUE_CAPACITY,ExecutorType.CONCRETE);
  this.slowOperationDetector=new SlowOperationDetector(operationExecutor.getGenericOperationRunners(),operationExecutor.getPartitionOperationRunners(),node.groupProperties,node.getHazelcastThreadGroup());
  this.cleanupThread=new CleanupThread();
  this.cleanupThread.start();
}

Fixed version (ground truth):
BasicOperationService(NodeEngineImpl nodeEngine){
  this.nodeEngine=nodeEngine;
  this.node=nodeEngine.getNode();
  this.logger=node.getLogger(OperationService.class);
  this.invocationLogger=nodeEngine.getLogger(BasicInvocation.class);
  this.defaultCallTimeoutMillis=node.getGroupProperties().OPERATION_CALL_TIMEOUT_MILLIS.getLong();
  this.backupOperationTimeoutMillis=node.getGroupProperties().OPERATION_BACKUP_TIMEOUT_MILLIS.getLong();
  this.backPressureService=new BasicBackPressureService(node.getGroupProperties(),logger);
  int coreSize=Runtime.getRuntime().availableProcessors();
  boolean reallyMultiCore=coreSize >= CORE_SIZE_CHECK;
  int concurrencyLevel=reallyMultiCore ? coreSize * CORE_SIZE_FACTOR : CONCURRENCY_LEVEL;
  this.invocations=new ConcurrentHashMap<Long,BasicInvocation>(INITIAL_CAPACITY,LOAD_FACTOR,concurrencyLevel);
  this.operationBackupHandler=new OperationBackupHandler();
  this.operationExecutor=new ClassicOperationExecutor(node.getGroupProperties(),node.loggingService,node.getThisAddress(),new BasicOperationRunnerFactory(),new BasicResponsePacketHandler(),node.getHazelcastThreadGroup(),node.getNodeExtension());
  ExecutionService executionService=nodeEngine.getExecutionService();
  this.asyncExecutor=executionService.register(ExecutionService.ASYNC_EXECUTOR,coreSize,ASYNC_QUEUE_CAPACITY,ExecutorType.CONCRETE);
  this.slowOperationDetector=initSlowOperationDetector();
  this.cleanupThread=new CleanupThread();
  this.cleanupThread.start();
}
Program: 47546
Project: 47546
Buggy source:
public boolean isHeartBeating(){
  return heartBeating;
}

Fixed version (ground truth):
public boolean isHeartBeating(){
  return live.get() && heartBeating;
}
Program: 47547
Project: 47547
Buggy source:
private void getPartitionsBlocking(){
  while (!getPartitions()) {
    try {
      Thread.sleep(PARTITION_WAIT_TIME);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
private void getPartitionsBlocking(){
  while (!getPartitions() && client.getConnectionManager().isAlive()) {
    try {
      Thread.sleep(PARTITION_WAIT_TIME);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}
Program: 47548
Project: 47548
Buggy source:
public boolean isHeartBeating(){
  return heartBeating;
}

Fixed version (ground truth):
public boolean isHeartBeating(){
  return live.get() && heartBeating;
}
Program: 47549
Project: 47549
Buggy source:
boolean isConnectionHealthy(long elapsed){
  if (elapsed >= heartBeatInterval) {
    if (sendConnection != null) {
      return sendConnection.isAlive() && sendConnection.isHeartBeating();
    }
 else {
      return true;
    }
  }
  return true;
}

Fixed version (ground truth):
boolean isConnectionHealthy(long elapsed){
  if (elapsed >= heartBeatInterval) {
    if (sendConnection != null) {
      return sendConnection.isHeartBeating();
    }
 else {
      return true;
    }
  }
  return true;
}
Program: 47550
Project: 47550
Buggy source:
@Override public void invokeOnConnection(ClientInvocation invocation,ClientConnection connection) throws IOException {
  if (connection == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (!connection.isAlive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  send(invocation,connection);
}

Fixed version (ground truth):
@Override public void invokeOnConnection(ClientInvocation invocation,ClientConnection connection) throws IOException {
  if (connection == null) {
    throw new NullPointerException("String_Node_Str");
  }
  send(invocation,connection);
}
Program: 47551
Project: 47551
Buggy source:
public void invokeOnPartitionOwner(ClientInvocation invocation,int partitionId) throws IOException {
  final Address owner=partitionService.getPartitionOwner(partitionId);
  if (owner == null) {
    throw new IOException("String_Node_Str" + partitionId);
  }
  ClientConnection connection=(ClientConnection)connectionManager.getOrConnect(owner,authenticator);
  if (connection == null || !connection.isAlive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  send(invocation,connection);
}

Fixed version (ground truth):
public void invokeOnPartitionOwner(ClientInvocation invocation,int partitionId) throws IOException {
  final Address owner=partitionService.getPartitionOwner(partitionId);
  if (owner == null) {
    throw new IOException("String_Node_Str" + partitionId);
  }
  ClientConnection connection=(ClientConnection)connectionManager.getOrConnect(owner,authenticator);
  send(invocation,connection);
}
Program: 47552
Project: 47552
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: 47553
Project: 47553
Buggy source:
@Override public void run(){
  long start=System.currentTimeMillis();
  String testName=method.getMethod().getDeclaringClass().getSimpleName() + "String_Node_Str" + method.getName();
  System.out.println("String_Node_Str" + testName);
  HazelcastParallelClassRunner.super.runChild(method,notifier);
  numThreads.decrementAndGet();
  float took=(float)(System.currentTimeMillis() - start) / 1000;
  System.out.println(String.format("String_Node_Str",testName,took));
}

Fixed version (ground truth):
@Override public void run(){
  FRAMEWORK_METHOD_THREAD_LOCAL.set(method);
  try {
    long start=System.currentTimeMillis();
    String testName=method.getMethod().getDeclaringClass().getSimpleName() + "String_Node_Str" + method.getName();
    System.out.println("String_Node_Str" + testName);
    HazelcastParallelClassRunner.super.runChild(method,notifier);
    numThreads.decrementAndGet();
    float took=(float)(System.currentTimeMillis() - start) / 1000;
    System.out.println(String.format("String_Node_Str",testName,took));
  }
  finally {
    FRAMEWORK_METHOD_THREAD_LOCAL.remove();
  }
}
Program: 47554
Project: 47554
Buggy source:
@Override protected void runChild(FrameworkMethod method,RunNotifier notifier){
  long start=System.currentTimeMillis();
  String testName=method.getMethod().getDeclaringClass().getSimpleName() + "String_Node_Str" + method.getName();
  System.out.println("String_Node_Str" + testName);
  super.runChild(method,notifier);
  float took=(float)(System.currentTimeMillis() - start) / 1000;
  System.out.println(String.format("String_Node_Str",testName,took));
}

Fixed version (ground truth):
@Override protected void runChild(FrameworkMethod method,RunNotifier notifier){
  FRAMEWORK_METHOD_THREAD_LOCAL.set(method);
  try {
    long start=System.currentTimeMillis();
    String testName=method.getMethod().getDeclaringClass().getSimpleName() + "String_Node_Str" + method.getName();
    System.out.println("String_Node_Str" + testName);
    super.runChild(method,notifier);
    float took=(float)(System.currentTimeMillis() - start) / 1000;
    System.out.println(String.format("String_Node_Str",testName,took));
  }
  finally {
    FRAMEWORK_METHOD_THREAD_LOCAL.remove();
  }
}
Program: 47555
Project: 47555
Buggy source:
/** 
 * This method executes the normal assertEquals with expected and actual values. In addition it formats the given string with those values to provide a good assert message.
 * @param message     assert message which is formatted with expected and actual values
 * @param expected    expected value which is used for assert
 * @param actual      actual value which is used for assert
 */
public static void assertEqualsStringFormat(String message,Object expected,Object actual){
  assertEquals(String.format(message,expected,actual),expected,actual);
}

Fixed version (ground truth):
/** 
 * This method executes the normal assertEquals with expected and actual values. In addition it formats the given string with those values to provide a good assert message.
 * @param message  assert message which is formatted with expected and actual values
 * @param expected expected value which is used for assert
 * @param actual   actual value which is used for assert
 */
public static void assertEqualsStringFormat(String message,Object expected,Object actual){
  assertEquals(String.format(message,expected,actual),expected,actual);
}
Program: 47556
Project: 47556
Buggy source:
public static String randomMapName(String mapNamePrefix){
  return mapNamePrefix + randomString();
}

Fixed version (ground truth):
public static String randomMapName(String namePrefix){
  return namePrefix + randomString();
}
Program: 47557
Project: 47557
Buggy source:
boolean isConnectionHealthy(long elapsed){
  if (elapsed >= heartBeatInterval) {
    if (sendConnection != null) {
      return sendConnection.isHeartBeating();
    }
 else {
      return true;
    }
  }
  return true;
}

Fixed version (ground truth):
boolean isConnectionHealthy(long elapsed){
  if (elapsed >= heartBeatInterval) {
    if (sendConnection != null) {
      return sendConnection.isAlive() && sendConnection.isHeartBeating();
    }
 else {
      return true;
    }
  }
  return true;
}
Program: 47558
Project: 47558
Buggy source:
@Override public void invokeOnConnection(ClientInvocation invocation,ClientConnection connection) throws IOException {
  if (connection == null) {
    throw new NullPointerException("String_Node_Str");
  }
  send(invocation,connection);
}

Fixed version (ground truth):
@Override public void invokeOnConnection(ClientInvocation invocation,ClientConnection connection) throws IOException {
  if (connection == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (!connection.isAlive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  send(invocation,connection);
}
Program: 47559
Project: 47559
Buggy source:
private void getPartitionsBlocking(){
  while (!getPartitions()) {
    try {
      Thread.sleep(PARTITION_WAIT_TIME);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
private void getPartitionsBlocking(){
  while (!getPartitions() && client.getConnectionManager().isAlive()) {
    try {
      Thread.sleep(PARTITION_WAIT_TIME);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}
Program: 47560
Project: 47560
Buggy source:
public void invokeOnPartitionOwner(ClientInvocation invocation,int partitionId) throws IOException {
  final Address owner=partitionService.getPartitionOwner(partitionId);
  if (owner == null) {
    throw new IOException("String_Node_Str" + partitionId);
  }
  ClientConnection connection=(ClientConnection)connectionManager.getOrConnect(owner,authenticator);
  send(invocation,connection);
}

Fixed version (ground truth):
public void invokeOnPartitionOwner(ClientInvocation invocation,int partitionId) throws IOException {
  final Address owner=partitionService.getPartitionOwner(partitionId);
  if (owner == null) {
    throw new IOException("String_Node_Str" + partitionId);
  }
  ClientConnection connection=(ClientConnection)connectionManager.getOrConnect(owner,authenticator);
  if (connection == null || !connection.isAlive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  send(invocation,connection);
}
Program: 47561
Project: 47561
Buggy source:
public static String randomNameOwnedBy(HazelcastInstance instance,String prefix){
  Cluster cluster=instance.getCluster();
  Member localMember=cluster.getLocalMember();
  PartitionService partitionService=instance.getPartitionService();
  for (; ; ) {
    String id=prefix + randomString();
    Partition partition=partitionService.getPartition(id);
    if (comparePartitionOwnership(true,localMember,partition)) {
      return id;
    }
  }
}

Fixed version (ground truth):
public static String randomNameOwnedBy(HazelcastInstance instance,String prefix){
  Cluster cluster=instance.getCluster();
  Member localMember=cluster.getLocalMember();
  PartitionService partitionService=instance.getPartitionService();
  for (; ; ) {
    String id=prefix + randomString();
    Partition partition=partitionService.getPartition(id);
    if (comparePartitionOwnership(false,localMember,partition)) {
      return id;
    }
  }
}
Program: 47562
Project: 47562
Buggy source:
@Test public void testMapStatistics_withClientOperations(){
  final String mapName=randomString();
  final IMap map=client.getMap(mapName);
  final int operationCount=1123;
  for (int i=0; i < operationCount; i++) {
    map.put(i,i);
    map.get(i);
    map.remove(i);
  }
  final LocalMapStats serverMapStats=server.getMap(mapName).getLocalMapStats();
  assertEquals("String_Node_Str",operationCount,serverMapStats.getPutOperationCount());
  assertEquals("String_Node_Str",operationCount,serverMapStats.getGetOperationCount());
  assertEquals("String_Node_Str",operationCount,serverMapStats.getRemoveOperationCount());
  assertTrue("String_Node_Str",0 < serverMapStats.getTotalPutLatency());
  assertTrue("String_Node_Str",0 < serverMapStats.getTotalGetLatency());
  assertTrue("String_Node_Str",0 < serverMapStats.getTotalRemoveLatency());
}

Fixed version (ground truth):
@Test public void testMapStatistics_withClientOperations(){
  final String mapName=randomString();
  final IMap map=client.getMap(mapName);
  final LocalMapStats serverMapStats=server.getMap(mapName).getLocalMapStats();
  final int operationCount=1123;
  for (int i=0; i < operationCount; i++) {
    map.put(i,i);
    map.get(i);
    map.remove(i);
  }
  assertEquals("String_Node_Str",operationCount,serverMapStats.getPutOperationCount());
  assertEquals("String_Node_Str",operationCount,serverMapStats.getGetOperationCount());
  assertEquals("String_Node_Str",operationCount,serverMapStats.getRemoveOperationCount());
  assertTrue("String_Node_Str",0 < serverMapStats.getTotalPutLatency());
  assertTrue("String_Node_Str",0 < serverMapStats.getTotalGetLatency());
  assertTrue("String_Node_Str",0 < serverMapStats.getTotalRemoveLatency());
}
Program: 47563
Project: 47563
Buggy source:
@Test public void testMapStatistics() throws Exception {
  String name=randomString();
  final IMap map=client.getMap(name);
  final int operationCount=1000;
  for (int i=0; i < operationCount; i++) {
    map.put(i,i);
    map.get(i);
    map.remove(i);
  }
  final LocalMapStats localMapStats=server.getMap(name).getLocalMapStats();
  assertEquals("String_Node_Str",operationCount,localMapStats.getPutOperationCount());
  assertEquals("String_Node_Str",operationCount,localMapStats.getGetOperationCount());
  assertEquals("String_Node_Str",operationCount,localMapStats.getRemoveOperationCount());
  assertTrue("String_Node_Str",0 < localMapStats.getTotalPutLatency());
  assertTrue("String_Node_Str",0 < localMapStats.getTotalGetLatency());
  assertTrue("String_Node_Str",0 < localMapStats.getTotalRemoveLatency());
}

Fixed version (ground truth):
@Test public void testMapStatistics() throws Exception {
  String name=randomString();
  final IMap map=client.getMap(name);
  final LocalMapStats localMapStats=server.getMap(name).getLocalMapStats();
  final int operationCount=1000;
  for (int i=0; i < operationCount; i++) {
    map.put(i,i);
    map.get(i);
    map.remove(i);
  }
  assertEquals("String_Node_Str",operationCount,localMapStats.getPutOperationCount());
  assertEquals("String_Node_Str",operationCount,localMapStats.getGetOperationCount());
  assertEquals("String_Node_Str",operationCount,localMapStats.getRemoveOperationCount());
  assertTrue("String_Node_Str",0 < localMapStats.getTotalPutLatency());
  assertTrue("String_Node_Str",0 < localMapStats.getTotalGetLatency());
  assertTrue("String_Node_Str",0 < localMapStats.getTotalRemoveLatency());
}
Program: 47564
Project: 47564
Buggy source:
/** 
 * Calculates and adds owner partition stats.
 */
private void addOwnerPartitionStats(LocalMapStatsImpl localMapStats,String mapName,int partitionId){
  final RecordStore recordStore=getRecordStoreOrNull(mapName,partitionId);
  if (!hasRecords(recordStore)) {
    return;
  }
  int lockedEntryCount=0;
  long lastAccessTime=0;
  long lastUpdateTime=0;
  long ownedEntryMemoryCost=0;
  long hits=0;
  final Iterator<Record> iterator=recordStore.iterator();
  while (iterator.hasNext()) {
    final Record record=iterator.next();
    hits+=getHits(record);
    ownedEntryMemoryCost+=record.getCost();
    lockedEntryCount+=isLocked(record,recordStore);
    lastAccessTime=Math.max(lastAccessTime,record.getLastAccessTime());
    lastUpdateTime=Math.max(lastUpdateTime,record.getLastUpdateTime());
  }
  localMapStats.incrementOwnedEntryMemoryCost(ownedEntryMemoryCost);
  localMapStats.incrementLockedEntryCount(lockedEntryCount);
  localMapStats.incrementHits(hits);
  localMapStats.incrementDirtyEntryCount(recordStore.getMapDataStore().notFinishedOperationsCount());
  localMapStats.setLastAccessTime(lastAccessTime);
  localMapStats.setLastUpdateTime(lastUpdateTime);
  localMapStats.incrementHeapCost(recordStore.getHeapCost());
  localMapStats.incrementOwnedEntryCount(recordStore.size());
}

Fixed version (ground truth):
/** 
 * Calculates and adds owner partition stats.
 */
private void addOwnerPartitionStats(LocalMapStatsImpl localMapStats,LocalMapOnDemandCalculatedStats localMapOnDemandCalculatedStats,String mapName,int partitionId){
  final RecordStore recordStore=getRecordStoreOrNull(mapName,partitionId);
  if (!hasRecords(recordStore)) {
    return;
  }
  int lockedEntryCount=0;
  long lastAccessTime=0;
  long lastUpdateTime=0;
  long ownedEntryMemoryCost=0;
  long hits=0;
  final Iterator<Record> iterator=recordStore.iterator();
  while (iterator.hasNext()) {
    final Record record=iterator.next();
    hits+=getHits(record);
    ownedEntryMemoryCost+=record.getCost();
    lockedEntryCount+=isLocked(record,recordStore);
    lastAccessTime=Math.max(lastAccessTime,record.getLastAccessTime());
    lastUpdateTime=Math.max(lastUpdateTime,record.getLastUpdateTime());
  }
  localMapOnDemandCalculatedStats.incrementOwnedEntryMemoryCost(ownedEntryMemoryCost);
  localMapOnDemandCalculatedStats.incrementLockedEntryCount(lockedEntryCount);
  localMapOnDemandCalculatedStats.incrementHits(hits);
  localMapOnDemandCalculatedStats.incrementDirtyEntryCount(recordStore.getMapDataStore().notFinishedOperationsCount());
  localMapStats.setLastAccessTime(lastAccessTime);
  localMapStats.setLastUpdateTime(lastUpdateTime);
  localMapOnDemandCalculatedStats.incrementHeapCost(recordStore.getHeapCost());
  localMapOnDemandCalculatedStats.incrementOwnedEntryCount(recordStore.size());
}
Program: 47565
Project: 47565
Buggy source:
public LocalMapStatsImpl createLocalMapStats(String mapName){
  final NodeEngine nodeEngine=this.nodeEngine;
  final MapContainer mapContainer=mapServiceContext.getMapContainer(mapName);
  final LocalMapStatsImpl localMapStats=new LocalMapStatsImpl(getLocalMapStatsImpl(mapName));
  if (!mapContainer.getMapConfig().isStatisticsEnabled()) {
    return localMapStats;
  }
  final int backupCount=mapContainer.getTotalBackupCount();
  final ClusterService clusterService=nodeEngine.getClusterService();
  final InternalPartitionService partitionService=nodeEngine.getPartitionService();
  final Address thisAddress=clusterService.getThisAddress();
  localMapStats.setBackupCount(backupCount);
  addNearCacheStats(localMapStats,mapContainer);
  for (int partitionId=0; partitionId < partitionService.getPartitionCount(); partitionId++) {
    InternalPartition partition=partitionService.getPartition(partitionId);
    Address owner=partition.getOwnerOrNull();
    if (owner == null) {
      continue;
    }
    if (owner.equals(thisAddress)) {
      addOwnerPartitionStats(localMapStats,mapName,partitionId);
    }
 else {
      addReplicaPartitionStats(localMapStats,mapName,partitionId,partition,partitionService,backupCount,thisAddress);
    }
  }
  return localMapStats;
}

Fixed version (ground truth):
public LocalMapStatsImpl createLocalMapStats(String mapName){
  final NodeEngine nodeEngine=this.nodeEngine;
  final MapContainer mapContainer=mapServiceContext.getMapContainer(mapName);
  final LocalMapStatsImpl localMapStats=getLocalMapStatsImpl(mapName);
  if (!mapContainer.getMapConfig().isStatisticsEnabled()) {
    return localMapStats;
  }
  final int backupCount=mapContainer.getTotalBackupCount();
  final ClusterService clusterService=nodeEngine.getClusterService();
  final InternalPartitionService partitionService=nodeEngine.getPartitionService();
  final Address thisAddress=clusterService.getThisAddress();
  LocalMapOnDemandCalculatedStats localMapOnDemandCalculatedStats=new LocalMapOnDemandCalculatedStats();
  localMapOnDemandCalculatedStats.setBackupCount(backupCount);
  addNearCacheStats(localMapStats,localMapOnDemandCalculatedStats,mapContainer);
  for (int partitionId=0; partitionId < partitionService.getPartitionCount(); partitionId++) {
    InternalPartition partition=partitionService.getPartition(partitionId);
    Address owner=partition.getOwnerOrNull();
    if (owner == null) {
      continue;
    }
    if (owner.equals(thisAddress)) {
      addOwnerPartitionStats(localMapStats,localMapOnDemandCalculatedStats,mapName,partitionId);
    }
 else {
      addReplicaPartitionStats(localMapOnDemandCalculatedStats,mapName,partitionId,partition,partitionService,backupCount,thisAddress);
    }
  }
  localMapOnDemandCalculatedStats.copyValuesTo(localMapStats);
  return localMapStats;
}
Program: 47566
Project: 47566
Buggy source:
/** 
 * Calculates and adds replica partition stats.
 */
private void addReplicaPartitionStats(LocalMapStatsImpl localMapStats,String mapName,int partitionId,InternalPartition partition,InternalPartitionService partitionService,int backupCount,Address thisAddress){
  long heapCost=0;
  long backupEntryCount=0;
  long backupEntryMemoryCost=0;
  for (int replica=1; replica <= backupCount; replica++) {
    final Address replicaAddress=getReplicaAddress(replica,partition,partitionService,backupCount);
    if (notGotReplicaAddress(replicaAddress,partitionService,backupCount)) {
      printWarning(partition,replica);
      continue;
    }
    if (gotReplicaAddress(replicaAddress,thisAddress)) {
      RecordStore recordStore=getRecordStoreOrNull(mapName,partitionId);
      if (hasRecords(recordStore)) {
        heapCost+=recordStore.getHeapCost();
        backupEntryCount+=recordStore.size();
        backupEntryMemoryCost+=getMemoryCost(recordStore);
      }
    }
  }
  localMapStats.incrementHeapCost(heapCost);
  localMapStats.incrementBackupEntryCount(backupEntryCount);
  localMapStats.incrementBackupEntryMemoryCost(backupEntryMemoryCost);
}

Fixed version (ground truth):
/** 
 * Calculates and adds replica partition stats.
 */
private void addReplicaPartitionStats(LocalMapOnDemandCalculatedStats localMapOnDemandCalculatedStats,String mapName,int partitionId,InternalPartition partition,InternalPartitionService partitionService,int backupCount,Address thisAddress){
  long heapCost=0;
  long backupEntryCount=0;
  long backupEntryMemoryCost=0;
  for (int replica=1; replica <= backupCount; replica++) {
    final Address replicaAddress=getReplicaAddress(replica,partition,partitionService,backupCount);
    if (notGotReplicaAddress(replicaAddress,partitionService,backupCount)) {
      printWarning(partition,replica);
      continue;
    }
    if (gotReplicaAddress(replicaAddress,thisAddress)) {
      RecordStore recordStore=getRecordStoreOrNull(mapName,partitionId);
      if (hasRecords(recordStore)) {
        heapCost+=recordStore.getHeapCost();
        backupEntryCount+=recordStore.size();
        backupEntryMemoryCost+=getMemoryCost(recordStore);
      }
    }
  }
  localMapOnDemandCalculatedStats.incrementHeapCost(heapCost);
  localMapOnDemandCalculatedStats.incrementBackupEntryCount(backupEntryCount);
  localMapOnDemandCalculatedStats.incrementBackupEntryMemoryCost(backupEntryMemoryCost);
}
Program: 47567
Project: 47567
Buggy source:
/** 
 * Adds near cache stats.
 */
private void addNearCacheStats(LocalMapStatsImpl localMapStats,MapContainer mapContainer){
  if (!mapContainer.getMapConfig().isNearCacheEnabled()) {
    return;
  }
  final NearCacheProvider nearCacheProvider=mapServiceContext.getNearCacheProvider();
  final NearCacheStatsImpl nearCacheStats=nearCacheProvider.getNearCache(mapContainer.getName()).getNearCacheStats();
  final long nearCacheHeapCost=mapContainer.getNearCacheSizeEstimator().getSize();
  localMapStats.setNearCacheStats(nearCacheStats);
  localMapStats.incrementHeapCost(nearCacheHeapCost);
}

Fixed version (ground truth):
/** 
 * Adds near cache stats.
 */
private void addNearCacheStats(LocalMapStatsImpl localMapStats,LocalMapOnDemandCalculatedStats localMapOnDemandCalculatedStats,MapContainer mapContainer){
  if (!mapContainer.getMapConfig().isNearCacheEnabled()) {
    return;
  }
  final NearCacheProvider nearCacheProvider=mapServiceContext.getNearCacheProvider();
  final NearCacheStatsImpl nearCacheStats=nearCacheProvider.getNearCache(mapContainer.getName()).getNearCacheStats();
  final long nearCacheHeapCost=mapContainer.getNearCacheSizeEstimator().getSize();
  localMapStats.setNearCacheStats(nearCacheStats);
  localMapOnDemandCalculatedStats.incrementHeapCost(nearCacheHeapCost);
}
Program: 47568
Project: 47568
Buggy source:
private NearCacheStatsImpl createNearCacheStats(){
  final NearCacheStatsImpl nearCacheStats=new NearCacheStatsImpl(this.nearCacheStats);
  long ownedEntryCount=0;
  long ownedEntryMemoryCost=0;
  for (  CacheRecord record : cache.values()) {
    ownedEntryCount++;
    ownedEntryMemoryCost+=record.getCost();
  }
  nearCacheStats.setOwnedEntryCount(ownedEntryCount);
  nearCacheStats.setOwnedEntryMemoryCost(ownedEntryMemoryCost);
  return nearCacheStats;
}

Fixed version (ground truth):
private NearCacheStatsImpl createNearCacheStats(){
  long ownedEntryCount=0;
  long ownedEntryMemoryCost=0;
  for (  CacheRecord record : cache.values()) {
    ownedEntryCount++;
    ownedEntryMemoryCost+=record.getCost();
  }
  nearCacheStats.setOwnedEntryCount(ownedEntryCount);
  nearCacheStats.setOwnedEntryMemoryCost(ownedEntryMemoryCost);
  return nearCacheStats;
}
Program: 47569
Project: 47569
Buggy source:
private boolean isConnectionHealthy(long elapsed){
  if (elapsed >= heartBeatInterval) {
    return connection.isHeartBeating();
  }
  return true;
}

Fixed version (ground truth):
private boolean isConnectionHealthy(long elapsed){
  if (elapsed >= heartBeatInterval) {
    return connection.isAlive() && connection.isHeartBeating();
  }
  return true;
}