Program: 188794
Project: 188794
Buggy source:
@Override public Report execute(IndexService index,ModelService model,StorageService storage,List<TransferredResource> list) throws PluginException {
  Report report=PluginHelper.createPluginReport(this);
  PluginState state;
  String jobDefinedParentId=PluginHelper.getParentIdFromParameters(parameters);
  for (  TransferredResource transferredResource : list) {
    ReportItem reportItem=PluginHelper.createPluginReportItem(transferredResource,this);
    try {
      Path transferredResourcePath=Paths.get(transferredResource.getFullPath());
      boolean active=false;
      String parentId=jobDefinedParentId;
      AIPPermissions permissions=new AIPPermissions();
      boolean notifyCreatedAIP=false;
      final AIP aip=model.createAIP(active,parentId,permissions,notifyCreatedAIP);
      final String representationId=UUID.randomUUID().toString();
      final boolean original=true;
      boolean notifyRepresentationCreated=false;
      model.createRepresentation(aip.getId(),representationId,original,notifyRepresentationCreated);
      PluginHelper.createDirectories(model,aip.getId(),representationId);
      if (transferredResource.isFile()) {
        String fileId=transferredResource.getName();
        List<String> directoryPath=new ArrayList<>();
        ContentPayload payload=new FSPathContentPayload(transferredResourcePath);
        boolean notifyFileCreated=false;
        model.createFile(aip.getId(),representationId,directoryPath,fileId,payload,notifyFileCreated);
      }
 else {
        EnumSet<FileVisitOption> opts=EnumSet.of(FileVisitOption.FOLLOW_LINKS);
        Files.walkFileTree(transferredResourcePath,opts,Integer.MAX_VALUE,new FileVisitor<Path>(){
          @Override public FileVisitResult preVisitDirectory(          Path dir,          BasicFileAttributes attrs) throws IOException {
            return FileVisitResult.CONTINUE;
          }
          @Override public FileVisitResult visitFile(          Path file,          BasicFileAttributes attrs) throws IOException {
            try {
              Path relativePath=transferredResourcePath.relativize(file);
              String fileId=file.getFileName().toString();
              List<String> directoryPath=new ArrayList<>();
              for (int i=0; i < relativePath.getNameCount() - 1; i++) {
                directoryPath.add(relativePath.getName(i).toString());
              }
              ContentPayload payload=new FSPathContentPayload(transferredResourcePath);
              boolean notifyFileCreated=false;
              model.createFile(aip.getId(),representationId,directoryPath,fileId,payload,notifyFileCreated);
            }
 catch (            RODAException e) {
            }
            return FileVisitResult.CONTINUE;
          }
          @Override public FileVisitResult visitFileFailed(          Path file,          IOException exc) throws IOException {
            return FileVisitResult.CONTINUE;
          }
          @Override public FileVisitResult postVisitDirectory(          Path dir,          IOException exc) throws IOException {
            return FileVisitResult.CONTINUE;
          }
        }
);
      }
      StringBuilder b=new StringBuilder();
      b.append("String_Node_Str");
      b.append("String_Node_Str" + StringEscapeUtils.escapeXml(transferredResource.getName()) + "String_Node_Str");
      b.append("String_Node_Str");
      ContentPayload metadataPayload=new StringContentPayload(b.toString());
      boolean notifyDescriptiveMetadataCreated=false;
      model.createDescriptiveMetadata(aip.getId(),"String_Node_Str",metadataPayload,"String_Node_Str",notifyDescriptiveMetadataCreated);
      model.notifyAIPCreated(aip.getId());
      state=PluginState.SUCCESS;
      reportItem=PluginHelper.setPluginReportItemInfo(reportItem,aip.getId(),new Attribute(RodaConstants.REPORT_ATTR_OUTCOME,state.toString()));
    }
 catch (    Throwable e) {
      LOGGER.error("String_Node_Str" + transferredResource.getId() + "String_Node_Str",e);
      state=PluginState.FAILURE;
      reportItem=PluginHelper.setPluginReportItemInfo(reportItem,null,new Attribute(RodaConstants.REPORT_ATTR_OUTCOME,state.toString()),new Attribute(RodaConstants.REPORT_ATTR_OUTCOME_DETAILS,e.getMessage()));
    }
    report.addItem(reportItem);
    PluginHelper.createJobReport(model,this,reportItem,state,PluginHelper.getJobId(parameters));
  }
  return report;
}

Fixed version (ground truth):
@Override public Report execute(IndexService index,ModelService model,StorageService storage,List<TransferredResource> list) throws PluginException {
  Report report=PluginHelper.createPluginReport(this);
  PluginState state;
  String jobDefinedParentId=PluginHelper.getParentIdFromParameters(parameters);
  for (  TransferredResource transferredResource : list) {
    ReportItem reportItem=PluginHelper.createPluginReportItem(transferredResource,this);
    try {
      Path transferredResourcePath=Paths.get(transferredResource.getFullPath());
      boolean active=false;
      String parentId=jobDefinedParentId;
      AIPPermissions permissions=new AIPPermissions();
      boolean notifyCreatedAIP=false;
      final AIP aip=model.createAIP(active,parentId,permissions,notifyCreatedAIP);
      final String representationId=UUID.randomUUID().toString();
      final boolean original=true;
      boolean notifyRepresentationCreated=false;
      model.createRepresentation(aip.getId(),representationId,original,notifyRepresentationCreated);
      PluginHelper.createDirectories(model,aip.getId(),representationId);
      if (transferredResource.isFile()) {
        String fileId=transferredResource.getName();
        List<String> directoryPath=new ArrayList<>();
        ContentPayload payload=new FSPathContentPayload(transferredResourcePath);
        boolean notifyFileCreated=false;
        model.createFile(aip.getId(),representationId,directoryPath,fileId,payload,notifyFileCreated);
      }
 else {
        EnumSet<FileVisitOption> opts=EnumSet.of(FileVisitOption.FOLLOW_LINKS);
        Files.walkFileTree(transferredResourcePath,opts,Integer.MAX_VALUE,new FileVisitor<Path>(){
          @Override public FileVisitResult preVisitDirectory(          Path dir,          BasicFileAttributes attrs) throws IOException {
            return FileVisitResult.CONTINUE;
          }
          @Override public FileVisitResult visitFile(          Path file,          BasicFileAttributes attrs) throws IOException {
            try {
              Path relativePath=transferredResourcePath.relativize(file);
              String fileId=file.getFileName().toString();
              List<String> directoryPath=new ArrayList<>();
              for (int i=0; i < relativePath.getNameCount() - 2; i++) {
                directoryPath.add(relativePath.getName(i).toString());
              }
              ContentPayload payload=new FSPathContentPayload(file);
              boolean notifyFileCreated=false;
              model.createFile(aip.getId(),representationId,directoryPath,fileId,payload,notifyFileCreated);
            }
 catch (            RODAException e) {
            }
            return FileVisitResult.CONTINUE;
          }
          @Override public FileVisitResult visitFileFailed(          Path file,          IOException exc) throws IOException {
            return FileVisitResult.CONTINUE;
          }
          @Override public FileVisitResult postVisitDirectory(          Path dir,          IOException exc) throws IOException {
            return FileVisitResult.CONTINUE;
          }
        }
);
      }
      StringBuilder b=new StringBuilder();
      b.append("String_Node_Str");
      b.append("String_Node_Str" + StringEscapeUtils.escapeXml(transferredResource.getName()) + "String_Node_Str");
      b.append("String_Node_Str");
      ContentPayload metadataPayload=new StringContentPayload(b.toString());
      boolean notifyDescriptiveMetadataCreated=false;
      model.createDescriptiveMetadata(aip.getId(),"String_Node_Str",metadataPayload,"String_Node_Str",notifyDescriptiveMetadataCreated);
      model.notifyAIPCreated(aip.getId());
      state=PluginState.SUCCESS;
      reportItem=PluginHelper.setPluginReportItemInfo(reportItem,aip.getId(),new Attribute(RodaConstants.REPORT_ATTR_OUTCOME,state.toString()));
    }
 catch (    Throwable e) {
      LOGGER.error("String_Node_Str" + transferredResource.getId() + "String_Node_Str",e);
      state=PluginState.FAILURE;
      reportItem=PluginHelper.setPluginReportItemInfo(reportItem,null,new Attribute(RodaConstants.REPORT_ATTR_OUTCOME,state.toString()),new Attribute(RodaConstants.REPORT_ATTR_OUTCOME_DETAILS,e.getMessage()));
    }
    report.addItem(reportItem);
    PluginHelper.createJobReport(model,this,reportItem,state,PluginHelper.getJobId(parameters));
  }
  return report;
}