Program: 113440
Project: 113440
Buggy source:
private void scrubRWOrNonReplicatedFile(){
  boolean checkMrcFileSize=true;
  List<Replica> replicas=fileHandle.getReplicasList();
  List<Replica> removedReplicas=new LinkedList<Replica>();
  for (int r=0; r < replicas.size(); r++) {
    Replica replica=replicas.get(r);
    boolean isReplOnDeadOsd=false;
    for (    String osd : replica.getOsdUuidsList()) {
      if (removedOSDs.contains(osd)) {
        if (fileHandle.getReplicaUpdatePolicy().equals(ReplicaUpdatePolicies.REPL_UPDATE_PC_NONE) | fileHandle.getReplicasList().size() == 1) {
          String errMsg="String_Node_Str";
          if (delete) {
            errMsg="String_Node_Str";
            try {
              volume.unlink(xtfs_scrub.credentials,fileName);
            }
 catch (            IOException ex2) {
              errMsg="String_Node_Str" + fileName + "String_Node_Str"+ ex2.getMessage();
            }
          }
          printFileErrorMessage(errMsg);
          returnStatus.add(ReturnStatus.FILE_LOST);
          return;
        }
 else {
          removedReplicas.add(replica);
          isReplOnDeadOsd=true;
          break;
        }
      }
    }
    if (!isReplOnDeadOsd) {
      byteCounter=0;
      boolean eof=false;
      nextObjectToScrub=0;
      while (!eof) {
        try {
          int objSize=fileHandle.checkObjectAndGetSize(r,nextObjectToScrub++);
          byteCounter+=objSize;
          if (objSize < replica.getStripingPolicy().getStripeSize()) {
            eof=true;
          }
        }
 catch (        InvalidChecksumException ex) {
          printFileErrorMessage("String_Node_Str" + (nextObjectToScrub - 1) + "String_Node_Str"+ r+ "String_Node_Str"+ replica.getOsdUuids((int)((nextObjectToScrub - 1) % replica.getOsdUuidsCount())));
          checkMrcFileSize=false;
          returnStatus.add(ReturnStatus.FAILURE_OBJECTS);
          break;
        }
catch (        IOException ex) {
          printFileErrorMessage("String_Node_Str" + (nextObjectToScrub - 1) + "String_Node_Str"+ r+ "String_Node_Str"+ ex);
          checkMrcFileSize=false;
          returnStatus.add(ReturnStatus.UNREACHABLE);
          break;
        }
      }
    }
  }
  if (!removedReplicas.isEmpty()) {
    if (repair) {
      recreateReplicas(removedReplicas);
    }
 else {
      printFileErrorMessage("String_Node_Str" + removedReplicas.size() + "String_Node_Str");
    }
    returnStatus.add(ReturnStatus.FAILURE_REPLICAS);
  }
  if (fileHandle.getReplicaUpdatePolicy().equals(ReplicaUpdatePolicies.REPL_UPDATE_PC_NONE) & checkMrcFileSize) {
    try {
      long mrcFileSize=volume.getAttr(xtfs_scrub.credentials,fileName).getSize();
      if ((osdFileSize != mrcFileSize)) {
        if (repair) {
          fileHandle.truncate(xtfs_scrub.credentials,(int)byteCounter,true);
          printFileErrorMessage("String_Node_Str" + mrcFileSize + "String_Node_Str"+ byteCounter+ "String_Node_Str");
        }
 else {
          printFileErrorMessage("String_Node_Str" + mrcFileSize + "String_Node_Str"+ byteCounter+ "String_Node_Str");
        }
        returnStatus.add(ReturnStatus.WRONG_FILE_SIZE);
      }
    }
 catch (    IOException ex) {
      printFileErrorMessage("String_Node_Str" + ex);
      returnStatus.add(ReturnStatus.UNREACHABLE);
    }
  }
  if (returnStatus.size() == 0) {
    returnStatus.add(ReturnStatus.FILE_OK);
  }
}

Fixed version (ground truth):
private void scrubRWOrNonReplicatedFile(){
  boolean checkMrcFileSize=true;
  List<Replica> replicas=fileHandle.getReplicasList();
  List<Replica> removedReplicas=new LinkedList<Replica>();
  for (int r=0; r < replicas.size(); r++) {
    Replica replica=replicas.get(r);
    boolean isReplOnDeadOsd=false;
    for (    String osd : replica.getOsdUuidsList()) {
      if (removedOSDs.contains(osd)) {
        if (fileHandle.getReplicaUpdatePolicy().equals(ReplicaUpdatePolicies.REPL_UPDATE_PC_NONE) | fileHandle.getReplicasList().size() == 1) {
          String errMsg="String_Node_Str";
          if (delete) {
            errMsg="String_Node_Str";
            try {
              volume.unlink(xtfs_scrub.credentials,fileName);
            }
 catch (            IOException ex2) {
              errMsg="String_Node_Str" + fileName + "String_Node_Str"+ ex2.getMessage();
            }
          }
          printFileErrorMessage(errMsg);
          returnStatus.add(ReturnStatus.FILE_LOST);
          return;
        }
 else {
          removedReplicas.add(replica);
          isReplOnDeadOsd=true;
          break;
        }
      }
    }
    if (!isReplOnDeadOsd) {
      byteCounter=0;
      boolean eof=false;
      nextObjectToScrub=0;
      while (!eof) {
        try {
          int objSize=fileHandle.checkObjectAndGetSize(r,nextObjectToScrub++);
          byteCounter+=objSize;
          if (objSize < replica.getStripingPolicy().getStripeSize()) {
            eof=true;
          }
        }
 catch (        InvalidChecksumException ex) {
          printFileErrorMessage("String_Node_Str" + (nextObjectToScrub - 1) + "String_Node_Str"+ r+ "String_Node_Str"+ replica.getOsdUuids((int)((nextObjectToScrub - 1) % replica.getOsdUuidsCount())));
          checkMrcFileSize=false;
          returnStatus.add(ReturnStatus.FAILURE_OBJECTS);
          break;
        }
catch (        IOException ex) {
          printFileErrorMessage("String_Node_Str" + (nextObjectToScrub - 1) + "String_Node_Str"+ r+ "String_Node_Str"+ ex);
          checkMrcFileSize=false;
          returnStatus.add(ReturnStatus.UNREACHABLE);
          break;
        }
      }
    }
  }
  if (!removedReplicas.isEmpty()) {
    if (repair) {
      recreateReplicas(removedReplicas);
    }
 else {
      printFileErrorMessage("String_Node_Str" + removedReplicas.size() + "String_Node_Str");
    }
    returnStatus.add(ReturnStatus.FAILURE_REPLICAS);
  }
  if (fileHandle.getReplicaUpdatePolicy().equals(ReplicaUpdatePolicies.REPL_UPDATE_PC_NONE) & checkMrcFileSize) {
    try {
      long mrcFileSize=volume.getAttr(xtfs_scrub.credentials,fileName).getSize();
      if (byteCounter != mrcFileSize) {
        if (repair) {
          fileHandle.truncate(xtfs_scrub.credentials,byteCounter,true);
          printFileErrorMessage("String_Node_Str" + mrcFileSize + "String_Node_Str"+ byteCounter+ "String_Node_Str");
        }
 else {
          printFileErrorMessage("String_Node_Str" + mrcFileSize + "String_Node_Str"+ byteCounter+ "String_Node_Str");
        }
        returnStatus.add(ReturnStatus.WRONG_FILE_SIZE);
      }
    }
 catch (    IOException ex) {
      printFileErrorMessage("String_Node_Str" + ex);
      returnStatus.add(ReturnStatus.UNREACHABLE);
    }
  }
  if (returnStatus.size() == 0) {
    returnStatus.add(ReturnStatus.FILE_OK);
  }
}