Program: 188798
Project: 188798
Buggy source:
@Override public Report execute(IndexService index,ModelService model,StorageService storage,List<AIP> list) throws PluginException {
  for (  AIP aip : list) {
    List<String> representationIds=aip.getRepresentationIds();
    if (representationIds != null && representationIds.size() > 0) {
      for (      String representationID : representationIds) {
        LOGGER.debug("String_Node_Str" + representationID + "String_Node_Str"+ aip.getId());
        EventPreservationObject epo=new EventPreservationObject();
        epo.setDatetime(new Date());
        epo.setEventType(EventPreservationObject.PRESERVATION_EVENT_TYPE_FIXITY_CHECK);
        epo.setEventDetail("String_Node_Str");
        epo.setAgentRole(EventPreservationObject.PRESERVATION_EVENT_AGENT_ROLE_PRESERVATION_TASK);
        try {
          Representation r=model.retrieveRepresentation(aip.getId(),representationID);
          List<String> fileIDs=r.getFileIds();
          List<String> okFileIDS=new ArrayList<String>();
          List<String> koFileIDS=new ArrayList<String>();
          if (fileIDs != null && fileIDs.size() > 0) {
            for (            String fileID : fileIDs) {
              LOGGER.debug("String_Node_Str" + fileID);
              File currentFile=model.retrieveFile(aip.getId(),representationID,fileID);
              Binary currentFileBinary=storage.getBinary(currentFile.getStoragePath());
              Path currentPath=Files.createTempFile("String_Node_Str","String_Node_Str");
              currentFileBinary.getContent().writeToPath(currentPath);
              RepresentationFilePreservationObject rfpo=model.retrieveRepresentationFileObject(aip.getId(),representationID,fileID);
              if (rfpo.getFixities() != null) {
                boolean fixityOK=true;
                for (                Fixity f : rfpo.getFixities()) {
                  try {
                    Fixity currentFixity=PremisUtils.calculateFixity(currentFileBinary,f.getMessageDigestAlgorithm(),"String_Node_Str");
                    if (!f.getMessageDigest().trim().equalsIgnoreCase(currentFixity.getMessageDigest().trim())) {
                      fixityOK=false;
                      break;
                    }
                  }
 catch (                  NoSuchAlgorithmException nsae) {
                    fixityOK=false;
                    break;
                  }
                }
                if (fixityOK) {
                  okFileIDS.add(fileID);
                }
 else {
                  koFileIDS.add(fileID);
                }
              }
            }
            if (okFileIDS.size() < fileIDs.size()) {
              LOGGER.debug("String_Node_Str" + representationID + "String_Node_Str"+ aip.getId());
              epo.setOutcome("String_Node_Str");
              epo.setOutcomeDetailNote("String_Node_Str");
              StringBuilder sb=new StringBuilder();
              sb.append("String_Node_Str");
              sb.append("String_Node_Str");
              for (              String s : koFileIDS) {
                sb.append("String_Node_Str" + s + "String_Node_Str");
              }
              sb.append("String_Node_Str");
              epo.setOutcomeDetailExtension(sb.toString());
              notifyUserOfFixityCheckError(representationID,okFileIDS,koFileIDS,epo);
            }
 else {
              LOGGER.debug("String_Node_Str" + representationID + "String_Node_Str"+ aip.getId());
              epo.setOutcome("String_Node_Str");
              epo.setOutcomeDetailNote(fileIDs.size() + "String_Node_Str");
              epo.setOutcomeDetailExtension(fileIDs.toString());
              notifyUserOfFixityCheckSucess(representationID,okFileIDS,koFileIDS,epo);
            }
          }
        }
 catch (        ModelServiceException|IOException|StorageServiceException e) {
          LOGGER.error("String_Node_Str" + representationID + "String_Node_Str"+ e.getMessage(),e);
          epo.setOutcome("String_Node_Str");
          epo.setOutcomeDetailNote("String_Node_Str");
          epo.setOutcomeDetailExtension("String_Node_Str" + e.getMessage() + "String_Node_Str");
          notifyUserOfFixityCheckUndetermined(representationID,epo,e.getMessage());
        }
        try {
          DateFormat format=new SimpleDateFormat("String_Node_Str");
          String name="String_Node_Str" + format.format(new Date()) + "String_Node_Str";
          epo.setId(name);
          epo.setAgentID(fixityAgent.getId());
          epo.setObjectIDs(new String[]{"String_Node_Str"});
          byte[] serializedPremisEvent=new PremisEventHelper(epo).saveToByteArray();
          Path file=Files.createTempFile("String_Node_Str","String_Node_Str");
          Files.copy(new ByteArrayInputStream(serializedPremisEvent),file,StandardCopyOption.REPLACE_EXISTING);
          Binary resource=(Binary)FSUtils.convertPathToResource(file.getParent(),file);
          model.createPreservationMetadata(aip.getId(),representationID,name,resource);
        }
 catch (        ModelServiceException e) {
          LOGGER.error(e.getMessage(),e);
        }
catch (        PremisMetadataException e) {
          LOGGER.error(e.getMessage(),e);
        }
catch (        IOException e) {
          LOGGER.error(e.getMessage(),e);
        }
catch (        StorageServiceException e) {
          LOGGER.error(e.getMessage(),e);
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public Report execute(IndexService index,ModelService model,StorageService storage,List<AIP> list) throws PluginException {
  for (  AIP aip : list) {
    List<String> representationIds=aip.getRepresentationIds();
    if (representationIds != null && representationIds.size() > 0) {
      for (      String representationID : representationIds) {
        LOGGER.debug("String_Node_Str" + representationID + "String_Node_Str"+ aip.getId());
        EventPreservationObject epo=new EventPreservationObject();
        epo.setDatetime(new Date());
        epo.setEventType(EventPreservationObject.PRESERVATION_EVENT_TYPE_FIXITY_CHECK);
        epo.setEventDetail("String_Node_Str");
        epo.setAgentRole(EventPreservationObject.PRESERVATION_EVENT_AGENT_ROLE_PRESERVATION_TASK);
        try {
          Representation r=model.retrieveRepresentation(aip.getId(),representationID);
          List<String> fileIDs=r.getFileIds();
          List<String> okFileIDS=new ArrayList<String>();
          List<String> koFileIDS=new ArrayList<String>();
          if (fileIDs != null && fileIDs.size() > 0) {
            for (            String fileID : fileIDs) {
              LOGGER.debug("String_Node_Str" + fileID);
              File currentFile=model.retrieveFile(aip.getId(),representationID,fileID);
              Binary currentFileBinary=storage.getBinary(currentFile.getStoragePath());
              Path currentPath=Files.createTempFile("String_Node_Str","String_Node_Str");
              currentFileBinary.getContent().writeToPath(currentPath);
              RepresentationFilePreservationObject rfpo=model.retrieveRepresentationFileObject(aip.getId(),representationID,fileID);
              if (rfpo.getFixities() != null) {
                boolean fixityOK=true;
                for (                Fixity f : rfpo.getFixities()) {
                  try {
                    Fixity currentFixity=PremisUtils.calculateFixity(currentFileBinary,f.getMessageDigestAlgorithm(),"String_Node_Str");
                    if (!f.getMessageDigest().trim().equalsIgnoreCase(currentFixity.getMessageDigest().trim())) {
                      fixityOK=false;
                      break;
                    }
                  }
 catch (                  NoSuchAlgorithmException nsae) {
                    fixityOK=false;
                    break;
                  }
                }
                if (fixityOK) {
                  okFileIDS.add(fileID);
                }
 else {
                  koFileIDS.add(fileID);
                }
              }
            }
            if (okFileIDS.size() < fileIDs.size()) {
              LOGGER.debug("String_Node_Str" + representationID + "String_Node_Str"+ aip.getId());
              epo.setOutcome("String_Node_Str");
              epo.setOutcomeDetailNote("String_Node_Str");
              StringBuilder sb=new StringBuilder();
              sb.append("String_Node_Str");
              sb.append("String_Node_Str");
              for (              String s : koFileIDS) {
                sb.append("String_Node_Str" + s + "String_Node_Str");
              }
              sb.append("String_Node_Str");
              epo.setOutcomeDetailExtension(sb.toString());
              notifyUserOfFixityCheckError(representationID,okFileIDS,koFileIDS,epo);
            }
 else {
              LOGGER.debug("String_Node_Str" + representationID + "String_Node_Str"+ aip.getId());
              epo.setOutcome("String_Node_Str");
              epo.setOutcomeDetailNote(fileIDs.size() + "String_Node_Str");
              epo.setOutcomeDetailExtension(fileIDs.toString());
              notifyUserOfFixityCheckSucess(representationID,okFileIDS,koFileIDS,epo);
            }
          }
        }
 catch (        IOException|RequestNotValidException|GenericException|NotFoundException|AuthorizationDeniedException e) {
          LOGGER.error("String_Node_Str" + representationID + "String_Node_Str"+ e.getMessage(),e);
          epo.setOutcome("String_Node_Str");
          epo.setOutcomeDetailNote("String_Node_Str");
          epo.setOutcomeDetailExtension("String_Node_Str" + e.getMessage() + "String_Node_Str");
          notifyUserOfFixityCheckUndetermined(representationID,epo,e.getMessage());
        }
        try {
          DateFormat format=new SimpleDateFormat("String_Node_Str");
          String name="String_Node_Str" + format.format(new Date()) + "String_Node_Str";
          epo.setId(name);
          epo.setAgentID(fixityAgent.getId());
          epo.setObjectIDs(new String[]{"String_Node_Str"});
          byte[] serializedPremisEvent=new PremisEventHelper(epo).saveToByteArray();
          Path file=Files.createTempFile("String_Node_Str","String_Node_Str");
          Files.copy(new ByteArrayInputStream(serializedPremisEvent),file,StandardCopyOption.REPLACE_EXISTING);
          Binary resource=(Binary)FSUtils.convertPathToResource(file.getParent(),file);
          model.createPreservationMetadata(aip.getId(),representationID,name,resource);
        }
 catch (        PremisMetadataException e) {
          LOGGER.error(e.getMessage(),e);
        }
catch (        IOException e) {
          LOGGER.error(e.getMessage(),e);
        }
catch (        RequestNotValidException e) {
          e.printStackTrace();
        }
catch (        NotFoundException e) {
          e.printStackTrace();
        }
catch (        GenericException e) {
          e.printStackTrace();
        }
catch (        AuthorizationDeniedException e) {
          e.printStackTrace();
        }
      }
    }
  }
  return null;
}