Program: 188606
Project: 188606
Buggy source:
@Override public Report execute(IndexService index,ModelService model,StorageService storage,List<AIP> aips) throws PluginException {
  FileOutputStream fos=null;
  try {
    SimpleJobPluginInfo jobPluginInfo=PluginHelper.getInitialJobInformation(this,aips.size());
    PluginHelper.updateJobInformation(this,jobPluginInfo);
    if (exportType == ExportType.MULTI_ZIP) {
      for (      AIP aip : aips) {
        LOGGER.debug("String_Node_Str",aip.getId());
        try {
          List<ZipEntryInfo> zipEntries=ModelUtils.aipToZipEntry(aip);
          java.io.File outputFolderFile=new java.io.File(outputFolder);
          java.io.File zip=new java.io.File(outputFolderFile,aip.getId() + "String_Node_Str");
          if (zip.exists() && removeIfAlreadyExists) {
            zip.delete();
          }
          fos=new FileOutputStream(zip);
          ZipTools.zip(zipEntries,fos);
          jobPluginInfo.incrementObjectsProcessedWithSuccess();
        }
 catch (        Exception e) {
          LOGGER.error("String_Node_Str" + aip.getId() + "String_Node_Str"+ e.getMessage());
          jobPluginInfo.incrementObjectsProcessedWithFailure();
        }
      }
      jobPluginInfo.finalizeInfo();
      PluginHelper.updateJobInformation(this,jobPluginInfo);
    }
 else     if (exportType == ExportType.FOLDER) {
      FileStorageService localStorage=new FileStorageService(Paths.get(outputFolder));
      for (      AIP aip : aips) {
        LOGGER.debug("String_Node_Str",aip.getId());
        StoragePath aipPath=ModelUtils.getAIPStoragePath(aip.getId());
        try {
          localStorage.copy(storage,aipPath,DefaultStoragePath.parse(aip.getId()));
          jobPluginInfo.incrementObjectsProcessedWithSuccess();
        }
 catch (        AlreadyExistsException e) {
          if (removeIfAlreadyExists) {
            try {
              localStorage.deleteResource(DefaultStoragePath.parse(aip.getId()));
              localStorage.copy(storage,aipPath,DefaultStoragePath.parse(aip.getId()));
              jobPluginInfo.incrementObjectsProcessedWithSuccess();
            }
 catch (            AlreadyExistsException e2) {
              jobPluginInfo.incrementObjectsProcessedWithFailure();
            }
          }
 else {
            LOGGER.error("String_Node_Str",aip.getId());
            jobPluginInfo.incrementObjectsProcessedWithFailure();
          }
        }
      }
      jobPluginInfo.finalizeInfo();
      PluginHelper.updateJobInformation(this,jobPluginInfo);
    }
  }
 catch (  AuthorizationDeniedException|RequestNotValidException|GenericException|NotFoundException e) {
    throw new PluginException(e.getMessage(),e);
  }
catch (  JobException e) {
    LOGGER.error("String_Node_Str");
  }
 finally {
    IOUtils.closeQuietly(fos);
  }
  return PluginHelper.initPluginReport(this);
}

Fixed version (ground truth):
@Override public Report execute(IndexService index,ModelService model,StorageService storage,List<AIP> aips) throws PluginException {
  OutputStream os=null;
  try {
    SimpleJobPluginInfo jobPluginInfo=PluginHelper.getInitialJobInformation(this,aips.size());
    PluginHelper.updateJobInformation(this,jobPluginInfo);
    if (exportType == ExportType.MULTI_ZIP) {
      for (      AIP aip : aips) {
        LOGGER.debug("String_Node_Str",aip.getId());
        try {
          List<ZipEntryInfo> zipEntries=ModelUtils.aipToZipEntry(aip);
          Path outputPath=Paths.get(outputFolder);
          Path zip=outputPath.resolve(aip.getId() + "String_Node_Str");
          if (Files.exists(zip) && removeIfAlreadyExists) {
            Files.delete(zip);
          }
          os=Files.newOutputStream(zip,StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING);
          ZipTools.zip(zipEntries,os);
          jobPluginInfo.incrementObjectsProcessedWithSuccess();
        }
 catch (        Exception e) {
          LOGGER.error("String_Node_Str" + aip.getId() + "String_Node_Str"+ e.getMessage());
          jobPluginInfo.incrementObjectsProcessedWithFailure();
        }
      }
      jobPluginInfo.finalizeInfo();
      PluginHelper.updateJobInformation(this,jobPluginInfo);
    }
 else     if (exportType == ExportType.FOLDER) {
      FileStorageService localStorage=new FileStorageService(Paths.get(outputFolder));
      for (      AIP aip : aips) {
        LOGGER.debug("String_Node_Str",aip.getId());
        StoragePath aipPath=ModelUtils.getAIPStoragePath(aip.getId());
        try {
          localStorage.copy(storage,aipPath,DefaultStoragePath.parse(aip.getId()));
          jobPluginInfo.incrementObjectsProcessedWithSuccess();
        }
 catch (        AlreadyExistsException e) {
          if (removeIfAlreadyExists) {
            try {
              localStorage.deleteResource(DefaultStoragePath.parse(aip.getId()));
              localStorage.copy(storage,aipPath,DefaultStoragePath.parse(aip.getId()));
              jobPluginInfo.incrementObjectsProcessedWithSuccess();
            }
 catch (            AlreadyExistsException e2) {
              jobPluginInfo.incrementObjectsProcessedWithFailure();
            }
          }
 else {
            LOGGER.error("String_Node_Str",aip.getId());
            jobPluginInfo.incrementObjectsProcessedWithFailure();
          }
        }
      }
      jobPluginInfo.finalizeInfo();
      PluginHelper.updateJobInformation(this,jobPluginInfo);
    }
  }
 catch (  AuthorizationDeniedException|RequestNotValidException|GenericException|NotFoundException e) {
    throw new PluginException(e.getMessage(),e);
  }
catch (  JobException e) {
    LOGGER.error("String_Node_Str");
  }
 finally {
    IOUtils.closeQuietly(os);
  }
  return PluginHelper.initPluginReport(this);
}