Program: 188314
Project: 188314
Buggy source:
@Override public Report executeOnAIP(IndexService index,ModelService model,StorageService storage,Report report,SimpleJobPluginInfo jobPluginInfo,List<AIP> list,Job job) throws PluginException {
  for (  AIP aip : list) {
    PluginState pluginState=PluginState.SUCCESS;
    Report reportItem=PluginHelper.initPluginReportItem(this,aip.getId(),AIP.class);
    for (    Representation representation : aip.getRepresentations()) {
      String dipId=IdUtils.createUUID();
      try {
        RepresentationLink representationLink=new RepresentationLink(representation.getAipId(),representation.getId());
        List<RepresentationLink> links=new ArrayList<>();
        links.add(representationLink);
        DIP dip=new DIP();
        dip.setId(dipId);
        dip.setRepresentationIds(links);
        dip.setPermissions(aip.getPermissions());
        dip.setTitle(getDIPTitle());
        dip.setDescription(getDIPDescription());
        dip.setType(RodaConstants.DIP_TYPE_DIGITAL_SIGNATURE);
        dip=model.createDIP(dip,false);
        LOGGER.debug("String_Node_Str",representation);
        boolean recursive=true;
        CloseableIterable<OptionalWithCause<File>> allFiles=model.listFilesUnder(representation.getAipId(),representation.getId(),recursive);
        for (        OptionalWithCause<File> oFile : allFiles) {
          if (oFile.isPresent()) {
            File file=oFile.get();
            manageFileSigning(model,index,storage,file,dip.getId());
          }
 else {
            LOGGER.error("String_Node_Str",oFile.getCause());
          }
        }
        IOUtils.closeQuietly(allFiles);
        model.notifyDIPCreated(dip,true);
      }
 catch (      Exception|LinkageError e) {
        LOGGER.error("String_Node_Str" + representation.getId() + "String_Node_Str"+ e.getMessage(),e);
        reportItem.setPluginDetails(e.getMessage());
        pluginState=PluginState.FAILURE;
        try {
          model.deleteDIP(dipId);
        }
 catch (        GenericException|NotFoundException|AuthorizationDeniedException e1) {
        }
      }
 finally {
        report.addReport(reportItem);
        PluginHelper.updatePartialJobReport(this,model,reportItem,true,job);
      }
    }
    if (pluginState.equals(PluginState.SUCCESS)) {
      jobPluginInfo.incrementObjectsProcessedWithSuccess();
    }
 else {
      jobPluginInfo.incrementObjectsProcessedWithFailure();
    }
    reportItem.setPluginState(pluginState);
    report.addReport(reportItem);
    PluginHelper.updatePartialJobReport(this,model,reportItem,true,job);
  }
  return report;
}

Fixed version (ground truth):
@Override public Report executeOnAIP(IndexService index,ModelService model,StorageService storage,Report report,SimpleJobPluginInfo jobPluginInfo,List<AIP> list,Job job) throws PluginException {
  for (  AIP aip : list) {
    PluginState pluginState=PluginState.SUCCESS;
    Report reportItem=PluginHelper.initPluginReportItem(this,aip.getId(),AIP.class);
    for (    Representation representation : aip.getRepresentations()) {
      String dipId=IdUtils.createUUID();
      try {
        RepresentationLink representationLink=new RepresentationLink(representation.getAipId(),representation.getId());
        List<RepresentationLink> links=new ArrayList<>();
        links.add(representationLink);
        DIP dip=new DIP();
        dip.setId(dipId);
        dip.setRepresentationIds(links);
        dip.setPermissions(aip.getPermissions());
        dip.setTitle(getDIPTitle());
        dip.setDescription(getDIPDescription());
        dip.setType(RodaConstants.DIP_TYPE_DIGITAL_SIGNATURE);
        dip=model.createDIP(dip,false);
        LOGGER.debug("String_Node_Str",representation);
        boolean recursive=true;
        CloseableIterable<OptionalWithCause<File>> allFiles=model.listFilesUnder(representation.getAipId(),representation.getId(),recursive);
        for (        OptionalWithCause<File> oFile : allFiles) {
          if (oFile.isPresent()) {
            manageFileSigning(model,index,storage,oFile.get(),dip.getId());
          }
 else {
            LOGGER.error("String_Node_Str",oFile.getCause());
          }
        }
        IOUtils.closeQuietly(allFiles);
        model.notifyDIPCreated(dip,true);
      }
 catch (      Exception|LinkageError e) {
        LOGGER.error("String_Node_Str" + representation.getId() + "String_Node_Str"+ e.getMessage(),e);
        reportItem.setPluginDetails(e.getMessage());
        pluginState=PluginState.FAILURE;
        try {
          model.deleteDIP(dipId);
        }
 catch (        GenericException|NotFoundException|AuthorizationDeniedException e1) {
        }
      }
 finally {
        report.addReport(reportItem);
        PluginHelper.updatePartialJobReport(this,model,reportItem,true,job);
      }
    }
    if (pluginState.equals(PluginState.SUCCESS)) {
      jobPluginInfo.incrementObjectsProcessedWithSuccess();
    }
 else {
      jobPluginInfo.incrementObjectsProcessedWithFailure();
    }
    reportItem.setPluginState(pluginState);
    report.addReport(reportItem);
    PluginHelper.updatePartialJobReport(this,model,reportItem,true,job);
  }
  return report;
}