Program: 49324
Project: 49324
Buggy source:
private int sendBackups(BackupAwareOperation backupAwareOp) throws Exception {
  final Operation op=(Operation)backupAwareOp;
  boolean returnsResponse=op.returnsResponse();
  final int maxBackups=node.getClusterService().getSize() - 1;
  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 PartitionServiceImpl partitionService=(PartitionServiceImpl)nodeEngine.getPartitionService();
    final long[] replicaVersions=partitionService.incrementPartitionReplicaVersions(partitionId,totalBackupCount);
    final PartitionInfo partitionInfo=partitionService.getPartitionInfo(partitionId);
    for (int replicaIndex=1; replicaIndex <= totalBackupCount; replicaIndex++) {
      final Address target=partitionInfo.getReplicaAddress(replicaIndex);
      if (target != null) {
        final Operation backupOp=backupAwareOp.getBackupOperation();
        if (backupOp == null) {
          throw new IllegalArgumentException("String_Node_Str");
        }
        if (target.equals(node.getThisAddress())) {
          throw new IllegalStateException("String_Node_Str");
        }
 else {
          backupOp.setPartitionId(partitionId).setReplicaIndex(replicaIndex).setServiceName(serviceName);
          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());
          send(backup,target);
        }
      }
    }
  }
  return syncBackupCount;
}

Fixed version (ground truth):
private int sendBackups(BackupAwareOperation backupAwareOp) throws Exception {
  final Operation op=(Operation)backupAwareOp;
  final boolean returnsResponse=op.returnsResponse();
  final int maxBackups=Math.min(node.getClusterService().getSize(),PartitionInfo.MAX_REPLICA_COUNT) - 1;
  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 PartitionServiceImpl partitionService=(PartitionServiceImpl)nodeEngine.getPartitionService();
    final long[] replicaVersions=partitionService.incrementPartitionReplicaVersions(partitionId,totalBackupCount);
    final PartitionInfo partitionInfo=partitionService.getPartitionInfo(partitionId);
    for (int replicaIndex=1; replicaIndex <= totalBackupCount; replicaIndex++) {
      final Address target=partitionInfo.getReplicaAddress(replicaIndex);
      if (target != null) {
        final Operation backupOp=backupAwareOp.getBackupOperation();
        if (backupOp == null) {
          throw new IllegalArgumentException("String_Node_Str");
        }
        if (target.equals(node.getThisAddress())) {
          throw new IllegalStateException("String_Node_Str");
        }
 else {
          backupOp.setPartitionId(partitionId).setReplicaIndex(replicaIndex).setServiceName(serviceName);
          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());
          send(backup,target);
        }
      }
    }
  }
  return syncBackupCount;
}