Program: 188487
Project: 188487
Buggy source:
@Override public Report execute(IndexService index,ModelService model,StorageService storage,List<LiteOptionalWithCause> liteList) throws PluginException {
  Report report=PluginHelper.initPluginReport(this);
  try {
    SimpleJobPluginInfo jobPluginInfo=PluginHelper.getInitialJobInformation(this,liteList.size());
    PluginHelper.updateJobInformation(this,jobPluginInfo);
    List<AIP> list=PluginHelper.transformLitesIntoObjects(model,index,this,report,jobPluginInfo,liteList);
    try {
      for (      AIP aip : list) {
        boolean aipFailed=false;
        List<String> passedFiles=new ArrayList<String>();
        Map<String,Pair<String,String>> failedFiles=new HashMap<>();
        List<LinkingIdentifier> sources=new ArrayList<LinkingIdentifier>();
        for (        Representation r : aip.getRepresentations()) {
          LOGGER.debug("String_Node_Str",r.getId(),aip.getId());
          try {
            boolean recursive=true;
            CloseableIterable<OptionalWithCause<File>> allFiles=model.listFilesUnder(aip.getId(),r.getId(),recursive);
            for (            OptionalWithCause<File> oFile : allFiles) {
              if (oFile.isPresent()) {
                File file=oFile.get();
                if (!file.isDirectory()) {
                  StoragePath storagePath=ModelUtils.getFileStoragePath(file);
                  Binary currentFileBinary=storage.getBinary(storagePath);
                  Binary premisFile=model.retrievePreservationFile(file);
                  List<Fixity> fixities=PremisV3Utils.extractFixities(premisFile);
                  sources.add(PluginHelper.getLinkingIdentifier(aip.getId(),file.getRepresentationId(),file.getPath(),file.getId(),RodaConstants.PRESERVATION_LINKING_OBJECT_SOURCE));
                  String fileEntry=file.getRepresentationId() + (file.getPath().isEmpty() ? "String_Node_Str" : '/' + String.join("String_Node_Str",file.getPath())) + '/'+ file.getId();
                  if (fixities != null) {
                    boolean passedFixity=true;
                    Set<String> algorithms=new HashSet<>();
                    for (                    Fixity f : fixities) {
                      algorithms.add(f.getMessageDigestAlgorithm());
                    }
                    try {
                      Map<String,String> checksums=FileUtility.checksums(currentFileBinary.getContent().createInputStream(),algorithms);
                      for (                      Fixity f : fixities) {
                        String checksum=checksums.get(f.getMessageDigestAlgorithm());
                        if (!f.getMessageDigest().trim().equalsIgnoreCase(checksum.trim())) {
                          passedFixity=false;
                          failedFiles.put(fileEntry,new Pair<>(f.getMessageDigest().trim(),checksum.trim()));
                          break;
                        }
                      }
                    }
 catch (                    NoSuchAlgorithmException e) {
                      passedFixity=false;
                      LOGGER.debug("String_Node_Str",e);
                    }
                    if (passedFixity) {
                      passedFiles.add(fileEntry);
                    }
 else {
                      aipFailed=true;
                      createIncidence(model,file,risks.get(0));
                    }
                  }
                }
              }
            }
            IOUtils.closeQuietly(allFiles);
            model.notifyAIPUpdated(aip.getId());
          }
 catch (          IOException|RODAException|XmlException e) {
            LOGGER.error("String_Node_Str",r.getId(),e);
          }
        }
        try {
          Report reportItem=PluginHelper.initPluginReportItem(this,aip.getId(),AIP.class,AIPState.ACTIVE);
          if (aipFailed) {
            ValidationReport validationReport=new ValidationReport();
            for (            Entry<String,Pair<String,String>> entry : failedFiles.entrySet()) {
              ValidationIssue issue=new ValidationIssue(entry.getKey() + "String_Node_Str" + entry.getValue().getFirst()+ "String_Node_Str"+ entry.getValue().getSecond()+ "String_Node_Str");
              validationReport.addIssue(issue);
            }
            reportItem.setPluginState(PluginState.FAILURE).setHtmlPluginDetails(true).setPluginDetails(validationReport.toHtml(false,false,false,"String_Node_Str"));
            jobPluginInfo.incrementObjectsProcessedWithFailure();
            PluginHelper.createPluginEvent(this,aip.getId(),model,index,sources,null,PluginState.FAILURE,validationReport.toHtml(false,false,false,"String_Node_Str"),true);
          }
 else {
            reportItem.setPluginState(PluginState.SUCCESS).setPluginDetails("String_Node_Str");
            jobPluginInfo.incrementObjectsProcessedWithSuccess();
            PluginHelper.createPluginEvent(this,aip.getId(),model,index,sources,null,PluginState.SUCCESS,"String_Node_Str",true);
          }
          report.addReport(reportItem);
          PluginHelper.updatePartialJobReport(this,model,index,reportItem,true);
        }
 catch (        RequestNotValidException|NotFoundException|GenericException|AuthorizationDeniedException|ValidationException|AlreadyExistsException e) {
          LOGGER.error("String_Node_Str");
        }
      }
    }
 catch (    ClassCastException e) {
      LOGGER.error("String_Node_Str");
      jobPluginInfo.incrementObjectsProcessedWithFailure(list.size());
    }
    jobPluginInfo.finalizeInfo();
    PluginHelper.updateJobInformation(this,jobPluginInfo);
  }
 catch (  JobException e) {
    LOGGER.error("String_Node_Str");
  }
  return report;
}

Fixed version (ground truth):
@Override public Report execute(IndexService index,ModelService model,StorageService storage,List<LiteOptionalWithCause> liteList) throws PluginException {
  Report report=PluginHelper.initPluginReport(this);
  try {
    SimpleJobPluginInfo jobPluginInfo=PluginHelper.getInitialJobInformation(this,liteList.size());
    PluginHelper.updateJobInformation(this,jobPluginInfo);
    Job job=PluginHelper.getJob(this,model);
    List<AIP> list=PluginHelper.transformLitesIntoObjects(model,index,this,report,jobPluginInfo,liteList,job);
    try {
      for (      AIP aip : list) {
        boolean aipFailed=false;
        List<String> passedFiles=new ArrayList<String>();
        Map<String,Pair<String,String>> failedFiles=new HashMap<>();
        List<LinkingIdentifier> sources=new ArrayList<LinkingIdentifier>();
        for (        Representation r : aip.getRepresentations()) {
          LOGGER.debug("String_Node_Str",r.getId(),aip.getId());
          try {
            boolean recursive=true;
            CloseableIterable<OptionalWithCause<File>> allFiles=model.listFilesUnder(aip.getId(),r.getId(),recursive);
            for (            OptionalWithCause<File> oFile : allFiles) {
              if (oFile.isPresent()) {
                File file=oFile.get();
                if (!file.isDirectory()) {
                  StoragePath storagePath=ModelUtils.getFileStoragePath(file);
                  Binary currentFileBinary=storage.getBinary(storagePath);
                  Binary premisFile=model.retrievePreservationFile(file);
                  List<Fixity> fixities=PremisV3Utils.extractFixities(premisFile);
                  sources.add(PluginHelper.getLinkingIdentifier(aip.getId(),file.getRepresentationId(),file.getPath(),file.getId(),RodaConstants.PRESERVATION_LINKING_OBJECT_SOURCE));
                  String fileEntry=file.getRepresentationId() + (file.getPath().isEmpty() ? "String_Node_Str" : '/' + String.join("String_Node_Str",file.getPath())) + '/'+ file.getId();
                  if (fixities != null) {
                    boolean passedFixity=true;
                    Set<String> algorithms=new HashSet<>();
                    for (                    Fixity f : fixities) {
                      algorithms.add(f.getMessageDigestAlgorithm());
                    }
                    try {
                      Map<String,String> checksums=FileUtility.checksums(currentFileBinary.getContent().createInputStream(),algorithms);
                      for (                      Fixity f : fixities) {
                        String checksum=checksums.get(f.getMessageDigestAlgorithm());
                        if (!f.getMessageDigest().trim().equalsIgnoreCase(checksum.trim())) {
                          passedFixity=false;
                          failedFiles.put(fileEntry,new Pair<>(f.getMessageDigest().trim(),checksum.trim()));
                          break;
                        }
                      }
                    }
 catch (                    NoSuchAlgorithmException e) {
                      passedFixity=false;
                      LOGGER.debug("String_Node_Str",e);
                    }
                    if (passedFixity) {
                      passedFiles.add(fileEntry);
                    }
 else {
                      aipFailed=true;
                      createIncidence(model,file,risks.get(0));
                    }
                  }
                }
              }
            }
            IOUtils.closeQuietly(allFiles);
            model.notifyAIPUpdated(aip.getId());
          }
 catch (          IOException|RODAException|XmlException e) {
            LOGGER.error("String_Node_Str",r.getId(),e);
          }
        }
        try {
          Report reportItem=PluginHelper.initPluginReportItem(this,aip.getId(),AIP.class,AIPState.ACTIVE);
          if (aipFailed) {
            ValidationReport validationReport=new ValidationReport();
            for (            Entry<String,Pair<String,String>> entry : failedFiles.entrySet()) {
              ValidationIssue issue=new ValidationIssue(entry.getKey() + "String_Node_Str" + entry.getValue().getFirst()+ "String_Node_Str"+ entry.getValue().getSecond()+ "String_Node_Str");
              validationReport.addIssue(issue);
            }
            reportItem.setPluginState(PluginState.FAILURE).setHtmlPluginDetails(true).setPluginDetails(validationReport.toHtml(false,false,false,"String_Node_Str"));
            jobPluginInfo.incrementObjectsProcessedWithFailure();
            PluginHelper.createPluginEvent(this,aip.getId(),model,index,sources,null,PluginState.FAILURE,validationReport.toHtml(false,false,false,"String_Node_Str"),true);
          }
 else {
            reportItem.setPluginState(PluginState.SUCCESS).setPluginDetails("String_Node_Str");
            jobPluginInfo.incrementObjectsProcessedWithSuccess();
            PluginHelper.createPluginEvent(this,aip.getId(),model,index,sources,null,PluginState.SUCCESS,"String_Node_Str",true);
          }
          report.addReport(reportItem);
          PluginHelper.updatePartialJobReport(this,model,index,reportItem,true,job);
        }
 catch (        RequestNotValidException|NotFoundException|GenericException|AuthorizationDeniedException|ValidationException|AlreadyExistsException e) {
          LOGGER.error("String_Node_Str");
        }
      }
    }
 catch (    ClassCastException e) {
      LOGGER.error("String_Node_Str");
      jobPluginInfo.incrementObjectsProcessedWithFailure(list.size());
    }
    jobPluginInfo.finalizeInfo();
    PluginHelper.updateJobInformation(this,jobPluginInfo);
  }
 catch (  JobException|AuthorizationDeniedException|NotFoundException|GenericException|RequestNotValidException e) {
    LOGGER.error("String_Node_Str");
  }
  return report;
}