Program: 49193
Project: 49193
Buggy source:
private int sendBackups(BackupAwareOperation backupAwareOp) throws Exception {
  final Operation op=(Operation)backupAwareOp;
  final boolean returnsResponse=op.returnsResponse();
  final PartitionServiceImpl partitionService=(PartitionServiceImpl)nodeEngine.getPartitionService();
  final int maxBackups=Math.min(partitionService.getMemberGroupsSize() - 1,PartitionView.MAX_BACKUP_COUNT);
  int syncBackupCount=backupAwareOp.getSyncBackupCount() > 0 ? Math.min(maxBackups,backupAwareOp.getSyncBackupCount()) : 0;
  int asyncBackupCount=(backupAwareOp.getAsyncBackupCount() > 0 && maxBackups > syncBackupCount) ? Math.min(maxBackups - syncBackupCount,backupAwareOp.getAsyncBackupCount()) : 0;
  if (!returnsResponse) {
    asyncBackupCount+=syncBackupCount;
    syncBackupCount=0;
  }
  final int totalBackupCount=syncBackupCount + asyncBackupCount;
  if (totalBackupCount > 0) {
    final String serviceName=op.getServiceName();
    final int partitionId=op.getPartitionId();
    final long[] replicaVersions=partitionService.incrementPartitionReplicaVersions(partitionId,totalBackupCount);
    final PartitionView partition=partitionService.getPartitionView(partitionId);
    for (int replicaIndex=1; replicaIndex <= totalBackupCount; replicaIndex++) {
      final Operation backupOp=backupAwareOp.getBackupOperation();
      if (backupOp == null) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      backupOp.setPartitionId(partitionId).setReplicaIndex(replicaIndex).setServiceName(serviceName);
      final Backup backup=new Backup(backupOp,op.getCallerAddress(),replicaVersions,replicaIndex <= syncBackupCount);
      backup.setPartitionId(partitionId).setReplicaIndex(replicaIndex).setServiceName(serviceName).setCallerUuid(nodeEngine.getLocalMember().getUuid());
      OperationAccessor.setCallId(backup,op.getCallId());
      final Address target=partition.getReplicaAddress(replicaIndex);
      if (target != null) {
        if (target.equals(node.getThisAddress())) {
          throw new IllegalStateException("String_Node_Str");
        }
 else {
          send(backup,target);
        }
      }
 else {
        final RemoteCallKey key=new RemoteCallKey(op.getCallerAddress(),op.getCallId());
        if (logger.isLoggable(Level.INFO)) {
          logger.log(Level.INFO,"String_Node_Str" + backup);
        }
        backupScheduler.schedule(500,key,new ScheduledBackup(backup,partitionId,replicaIndex));
      }
    }
  }
  return syncBackupCount;
}

Fixed version (ground truth):
private int sendBackups(BackupAwareOperation backupAwareOp) throws Exception {
  final Operation op=(Operation)backupAwareOp;
  final boolean returnsResponse=op.returnsResponse();
  final PartitionServiceImpl partitionService=(PartitionServiceImpl)nodeEngine.getPartitionService();
  final int maxBackups=Math.min(partitionService.getMemberGroupsSize() - 1,PartitionView.MAX_BACKUP_COUNT);
  int syncBackupCount=backupAwareOp.getSyncBackupCount() > 0 ? Math.min(maxBackups,backupAwareOp.getSyncBackupCount()) : 0;
  int asyncBackupCount=(backupAwareOp.getAsyncBackupCount() > 0 && maxBackups > syncBackupCount) ? Math.min(maxBackups - syncBackupCount,backupAwareOp.getAsyncBackupCount()) : 0;
  if (!returnsResponse) {
    asyncBackupCount+=syncBackupCount;
    syncBackupCount=0;
  }
  final int totalBackupCount=syncBackupCount + asyncBackupCount;
  if (totalBackupCount > 0) {
    final String serviceName=op.getServiceName();
    final int partitionId=op.getPartitionId();
    final long[] replicaVersions=partitionService.incrementPartitionReplicaVersions(partitionId,totalBackupCount);
    final PartitionView partition=partitionService.getPartitionView(partitionId);
    for (int replicaIndex=1; replicaIndex <= totalBackupCount; replicaIndex++) {
      final Operation backupOp=backupAwareOp.getBackupOperation();
      if (backupOp == null) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      backupOp.setPartitionId(partitionId).setReplicaIndex(replicaIndex).setServiceName(serviceName);
      final Backup backup=new Backup(backupOp,op.getCallerAddress(),replicaVersions,replicaIndex <= syncBackupCount);
      backup.setPartitionId(partitionId).setReplicaIndex(replicaIndex).setServiceName(serviceName).setCallerUuid(nodeEngine.getLocalMember().getUuid());
      OperationAccessor.setCallId(backup,op.getCallId());
      final Address target=partition.getReplicaAddress(replicaIndex);
      if (target != null) {
        if (target.equals(node.getThisAddress())) {
          throw new IllegalStateException("String_Node_Str" + partition);
        }
 else {
          send(backup,target);
        }
      }
 else {
        scheduleBackup(op,backup,partitionId,replicaIndex);
      }
    }
  }
  return syncBackupCount;
}