From 08e2ee4226ab2489442954094a7ac4bbcb633afb Mon Sep 17 00:00:00 2001 From: Ivan_Kustau Date: Mon, 11 Sep 2023 18:16:58 +0300 Subject: [PATCH 1/4] EPMRPP-80519 || Add methods for removing buckets and files --- .../dao/AttachmentRepository.java | 24 ++-- .../ta/reportportal/filesystem/DataStore.java | 11 +- .../filesystem/LocalDataStore.java | 105 +++++++++++------- .../distributed/s3/S3DataStore.java | 19 ++++ 4 files changed, 103 insertions(+), 56 deletions(-) diff --git a/src/main/java/com/epam/ta/reportportal/dao/AttachmentRepository.java b/src/main/java/com/epam/ta/reportportal/dao/AttachmentRepository.java index fd210eb16..614d97a22 100644 --- a/src/main/java/com/epam/ta/reportportal/dao/AttachmentRepository.java +++ b/src/main/java/com/epam/ta/reportportal/dao/AttachmentRepository.java @@ -17,25 +17,27 @@ package com.epam.ta.reportportal.dao; import com.epam.ta.reportportal.entity.attachment.Attachment; -import org.springframework.data.jpa.repository.Modifying; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; - import java.util.Collection; import java.util.List; import java.util.Optional; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; /** * @author Ivan Budayeu */ -public interface AttachmentRepository extends ReportPortalRepository, AttachmentRepositoryCustom { +public interface AttachmentRepository + extends ReportPortalRepository, AttachmentRepositoryCustom { + + Optional findByFileId(String fileId); - Optional findByFileId(String fileId); + List findAllByLaunchIdIn(Collection launchIds); - List findAllByLaunchIdIn(Collection launchIds); + void deleteAllByProjectId(Long projectId); - @Modifying - @Query(value = "UPDATE attachment SET launch_id = :newLaunchId WHERE project_id = :projectId AND launch_id = :currentLaunchId", nativeQuery = true) - void updateLaunchIdByProjectIdAndLaunchId(@Param("projectId") Long projectId, @Param("currentLaunchId") Long currentLaunchId, - @Param("newLaunchId") Long newLaunchId); + @Modifying + @Query(value = "UPDATE attachment SET launch_id = :newLaunchId WHERE project_id = :projectId AND launch_id = :currentLaunchId", nativeQuery = true) + void updateLaunchIdByProjectIdAndLaunchId(@Param("projectId") Long projectId, + @Param("currentLaunchId") Long currentLaunchId, @Param("newLaunchId") Long newLaunchId); } diff --git a/src/main/java/com/epam/ta/reportportal/filesystem/DataStore.java b/src/main/java/com/epam/ta/reportportal/filesystem/DataStore.java index 58203495a..3d4b88ee0 100644 --- a/src/main/java/com/epam/ta/reportportal/filesystem/DataStore.java +++ b/src/main/java/com/epam/ta/reportportal/filesystem/DataStore.java @@ -17,15 +17,20 @@ package com.epam.ta.reportportal.filesystem; import java.io.InputStream; +import java.util.List; /** * @author Dzianis_Shybeka */ public interface DataStore { - String save(String fileName, InputStream inputStream); + String save(String fileName, InputStream inputStream); - InputStream load(String filePath); + InputStream load(String filePath); - void delete(String filePath); + void delete(String filePath); + + void deleteAll(List filePaths, String bucketName); + + void deleteContainer(String bucketName); } diff --git a/src/main/java/com/epam/ta/reportportal/filesystem/LocalDataStore.java b/src/main/java/com/epam/ta/reportportal/filesystem/LocalDataStore.java index ad74302c8..1276907e4 100644 --- a/src/main/java/com/epam/ta/reportportal/filesystem/LocalDataStore.java +++ b/src/main/java/com/epam/ta/reportportal/filesystem/LocalDataStore.java @@ -18,80 +18,101 @@ import com.epam.ta.reportportal.exception.ReportPortalException; import com.epam.ta.reportportal.ws.model.ErrorType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; +import java.util.List; import java.util.Objects; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author Dzianis_Shybeka */ public class LocalDataStore implements DataStore { - private static final Logger logger = LoggerFactory.getLogger(LocalDataStore.class); + private static final Logger logger = LoggerFactory.getLogger(LocalDataStore.class); + + private final String storageRootPath; + + public LocalDataStore(String storageRootPath) { + this.storageRootPath = storageRootPath; + } + + @Override + public String save(String filePath, InputStream inputStream) { + + try { + + Path targetPath = Paths.get(storageRootPath, filePath); + Path targetDirectory = targetPath.getParent(); + + if (Objects.nonNull(targetDirectory) && !Files.isDirectory(targetDirectory)) { + Files.createDirectories(targetDirectory); + } - private final String storageRootPath; + logger.debug("Saving to: {} ", targetPath.toAbsolutePath()); - public LocalDataStore(String storageRootPath) { - this.storageRootPath = storageRootPath; - } + Files.copy(inputStream, targetPath, StandardCopyOption.REPLACE_EXISTING); - @Override - public String save(String filePath, InputStream inputStream) { + return filePath; + } catch (IOException e) { - try { + logger.error("Unable to save log file '{}'", filePath, e); - Path targetPath = Paths.get(storageRootPath, filePath); - Path targetDirectory = targetPath.getParent(); + throw new ReportPortalException(ErrorType.INCORRECT_REQUEST, "Unable to save log file"); + } + } - if (Objects.nonNull(targetDirectory) && !Files.isDirectory(targetDirectory)) { - Files.createDirectories(targetDirectory); - } + @Override + public InputStream load(String filePath) { - logger.debug("Saving to: {} ", targetPath.toAbsolutePath()); + try { - Files.copy(inputStream, targetPath, StandardCopyOption.REPLACE_EXISTING); + return Files.newInputStream(Paths.get(storageRootPath, filePath)); + } catch (IOException e) { - return filePath; - } catch (IOException e) { + logger.error("Unable to find file '{}'", filePath, e); - logger.error("Unable to save log file '{}'", filePath, e); + throw new ReportPortalException(ErrorType.UNABLE_TO_LOAD_BINARY_DATA, "Unable to find file"); + } + } - throw new ReportPortalException(ErrorType.INCORRECT_REQUEST, "Unable to save log file"); - } - } + @Override + public void delete(String filePath) { - @Override - public InputStream load(String filePath) { + try { - try { + Files.deleteIfExists(Paths.get(storageRootPath, filePath)); + } catch (IOException e) { - return Files.newInputStream(Paths.get(storageRootPath, filePath)); - } catch (IOException e) { + logger.error("Unable to delete file '{}'", filePath, e); - logger.error("Unable to find file '{}'", filePath, e); + throw new ReportPortalException(ErrorType.INCORRECT_REQUEST, "Unable to delete file"); + } + } - throw new ReportPortalException(ErrorType.UNABLE_TO_LOAD_BINARY_DATA, "Unable to find file"); - } - } + @Override + public void deleteAll(List filePaths, String bucketName) { - @Override - public void delete(String filePath) { + for (String filePath : filePaths) { + delete(filePath); + } + } - try { + @Override + public void deleteContainer(String bucketName) { + try { - Files.deleteIfExists(Paths.get(storageRootPath, filePath)); - } catch (IOException e) { + Files.deleteIfExists(Paths.get(bucketName)); + } catch (IOException e) { - logger.error("Unable to delete file '{}'", filePath, e); + logger.error("Unable to delete bucket '{}'", bucketName, e); - throw new ReportPortalException(ErrorType.INCORRECT_REQUEST, "Unable to delete file"); - } - } + throw new ReportPortalException(ErrorType.INCORRECT_REQUEST, "Unable to delete file"); + } + } } diff --git a/src/main/java/com/epam/ta/reportportal/filesystem/distributed/s3/S3DataStore.java b/src/main/java/com/epam/ta/reportportal/filesystem/distributed/s3/S3DataStore.java index e9f7e2e49..1ac0d896f 100644 --- a/src/main/java/com/epam/ta/reportportal/filesystem/distributed/s3/S3DataStore.java +++ b/src/main/java/com/epam/ta/reportportal/filesystem/distributed/s3/S3DataStore.java @@ -25,6 +25,7 @@ import java.io.InputStream; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.List; import java.util.Objects; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -126,6 +127,24 @@ public void delete(String filePath) { } } + @Override + public void deleteAll(List filePaths, String bucketName) { + if (!featureFlagHandler.isEnabled(FeatureFlag.SINGLE_BUCKET)) { + blobStore.removeBlobs(bucketPrefix + bucketName + bucketPostfix, filePaths); + } else { + blobStore.removeBlobs(bucketName, filePaths); + } + } + + @Override + public void deleteContainer(String bucketName) { + if (!featureFlagHandler.isEnabled(FeatureFlag.SINGLE_BUCKET)) { + blobStore.deleteContainer(bucketPrefix + bucketName + bucketPostfix); + } else { + blobStore.deleteContainer(bucketName); + } + } + private S3File getS3File(String filePath) { if (featureFlagHandler.isEnabled(FeatureFlag.SINGLE_BUCKET)) { return new S3File(defaultBucketName, filePath); From a65d0b96addc6abf1cf14e69ea2951f64f17397d Mon Sep 17 00:00:00 2001 From: Ivan_Kustau Date: Tue, 12 Sep 2023 18:10:16 +0300 Subject: [PATCH 2/4] EPMRPP-80519 || Remove attachments by project id --- .../binary/AttachmentBinaryDataService.java | 16 ++++---- .../reportportal/binary/DataStoreService.java | 13 +++++-- .../impl/AttachmentBinaryDataServiceImpl.java | 38 ++++++++++++++----- .../binary/impl/CommonDataStoreService.java | 13 +++++++ .../dao/AttachmentRepository.java | 2 + .../distributed/s3/S3DataStore.java | 2 +- 6 files changed, 62 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/epam/ta/reportportal/binary/AttachmentBinaryDataService.java b/src/main/java/com/epam/ta/reportportal/binary/AttachmentBinaryDataService.java index cec525d02..b4721620c 100644 --- a/src/main/java/com/epam/ta/reportportal/binary/AttachmentBinaryDataService.java +++ b/src/main/java/com/epam/ta/reportportal/binary/AttachmentBinaryDataService.java @@ -20,22 +20,24 @@ import com.epam.ta.reportportal.commons.ReportPortalUser; import com.epam.ta.reportportal.entity.attachment.AttachmentMetaInfo; import com.epam.ta.reportportal.entity.attachment.BinaryData; -import org.springframework.web.multipart.MultipartFile; - import java.util.Optional; +import org.springframework.web.multipart.MultipartFile; /** * @author Ihar Kahadouski */ public interface AttachmentBinaryDataService { - Optional saveAttachment(AttachmentMetaInfo attachmentMetaInfo, MultipartFile file); + Optional saveAttachment(AttachmentMetaInfo attachmentMetaInfo, + MultipartFile file); + + void saveFileAndAttachToLog(MultipartFile file, AttachmentMetaInfo attachmentMetaInfo); - void saveFileAndAttachToLog(MultipartFile file, AttachmentMetaInfo attachmentMetaInfo); + void attachToLog(BinaryDataMetaInfo binaryDataMetaInfo, AttachmentMetaInfo attachmentMetaInfo); - void attachToLog(BinaryDataMetaInfo binaryDataMetaInfo, AttachmentMetaInfo attachmentMetaInfo); + BinaryData load(Long fileId, ReportPortalUser.ProjectDetails projectDetails); - BinaryData load(Long fileId, ReportPortalUser.ProjectDetails projectDetails); + void delete(String fileId); - void delete(String fileId); + void deleteAllByProjectId(Long projectId); } diff --git a/src/main/java/com/epam/ta/reportportal/binary/DataStoreService.java b/src/main/java/com/epam/ta/reportportal/binary/DataStoreService.java index c98a2029f..0f80ba167 100644 --- a/src/main/java/com/epam/ta/reportportal/binary/DataStoreService.java +++ b/src/main/java/com/epam/ta/reportportal/binary/DataStoreService.java @@ -17,6 +17,7 @@ package com.epam.ta.reportportal.binary; import java.io.InputStream; +import java.util.List; import java.util.Optional; /** @@ -24,11 +25,15 @@ */ public interface DataStoreService { - String save(String fileName, InputStream data); + String save(String fileName, InputStream data); - String saveThumbnail(String fileName, InputStream data); + String saveThumbnail(String fileName, InputStream data); - void delete(String fileId); + void delete(String fileId); - Optional load(String fileId); + void deleteAll(List fileIds, String bucketName); + + void deleteContainer(String containerName); + + Optional load(String fileId); } diff --git a/src/main/java/com/epam/ta/reportportal/binary/impl/AttachmentBinaryDataServiceImpl.java b/src/main/java/com/epam/ta/reportportal/binary/impl/AttachmentBinaryDataServiceImpl.java index 2b8ffbfd4..b49b1a407 100644 --- a/src/main/java/com/epam/ta/reportportal/binary/impl/AttachmentBinaryDataServiceImpl.java +++ b/src/main/java/com/epam/ta/reportportal/binary/impl/AttachmentBinaryDataServiceImpl.java @@ -16,6 +16,12 @@ package com.epam.ta.reportportal.binary.impl; +import static com.epam.ta.reportportal.binary.impl.DataStoreUtils.PROJECT_PATH; +import static com.epam.ta.reportportal.binary.impl.DataStoreUtils.isContentTypePresent; +import static com.epam.ta.reportportal.binary.impl.DataStoreUtils.resolveExtension; +import static com.epam.ta.reportportal.commons.validation.BusinessRule.expect; +import static com.epam.ta.reportportal.commons.validation.Suppliers.formattedSupplier; + import com.epam.reportportal.commons.ContentTypeResolver; import com.epam.ta.reportportal.binary.AttachmentBinaryDataService; import com.epam.ta.reportportal.binary.CreateLogAttachmentService; @@ -31,6 +37,14 @@ import com.epam.ta.reportportal.filesystem.FilePathGenerator; import com.epam.ta.reportportal.util.FeatureFlagHandler; import com.epam.ta.reportportal.ws.model.ErrorType; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Paths; +import java.util.Optional; +import java.util.function.Predicate; +import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,15 +54,6 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile; -import java.io.*; -import java.nio.file.Paths; -import java.util.Optional; -import java.util.function.Predicate; - -import static com.epam.ta.reportportal.binary.impl.DataStoreUtils.*; -import static com.epam.ta.reportportal.commons.validation.BusinessRule.expect; -import static com.epam.ta.reportportal.commons.validation.Suppliers.formattedSupplier; - /** * @author Ihar Kahadouski */ @@ -179,7 +184,8 @@ public BinaryData load(Long fileId, ReportPortalUser.ProjectDetails projectDetai ErrorType.ACCESS_DENIED, formattedSupplier("You are not assigned to project '{}'", projectDetails.getProjectName()) ); - return new BinaryData(attachment.getFileName(), attachment.getContentType(), (long) data.available(), data); + return new BinaryData( + attachment.getFileName(), attachment.getContentType(), (long) data.available(), data); } catch (IOException e) { LOGGER.error("Unable to load binary data", e); throw new ReportPortalException( @@ -195,6 +201,18 @@ public void delete(String fileId) { } } + @Override + public void deleteAllByProjectId(Long projectId) { + if (featureFlagHandler.isEnabled(FeatureFlag.SINGLE_BUCKET)) { + dataStoreService.deleteAll( + attachmentRepository.findAllByProjectId(projectId).stream().map(Attachment::getFileId) + .collect(Collectors.toList()), projectId.toString()); + } else { + dataStoreService.deleteContainer(projectId.toString()); + } + attachmentRepository.deleteAllByProjectId(projectId); + } + private String resolveContentType(String contentType, ByteArrayOutputStream outputStream) throws IOException { if (isContentTypePresent(contentType)) { diff --git a/src/main/java/com/epam/ta/reportportal/binary/impl/CommonDataStoreService.java b/src/main/java/com/epam/ta/reportportal/binary/impl/CommonDataStoreService.java index 03c5ef21e..8bb4058ef 100644 --- a/src/main/java/com/epam/ta/reportportal/binary/impl/CommonDataStoreService.java +++ b/src/main/java/com/epam/ta/reportportal/binary/impl/CommonDataStoreService.java @@ -22,7 +22,9 @@ import com.epam.ta.reportportal.filesystem.DataEncoder; import com.epam.ta.reportportal.filesystem.DataStore; import java.io.InputStream; +import java.util.List; import java.util.Optional; +import java.util.stream.Collectors; /** * @author Ihar Kahadouski @@ -51,6 +53,17 @@ public void delete(String fileId) { dataStore.delete(dataEncoder.decode(fileId)); } + @Override + public void deleteAll(List fileIds, String bucketName) { + dataStore.deleteAll( + fileIds.stream().map(dataEncoder::decode).collect(Collectors.toList()), bucketName); + } + + @Override + public void deleteContainer(String containerName) { + dataStore.deleteContainer(containerName); + } + @Override public Optional load(String fileId) { return ofNullable(dataStore.load(dataEncoder.decode(fileId))); diff --git a/src/main/java/com/epam/ta/reportportal/dao/AttachmentRepository.java b/src/main/java/com/epam/ta/reportportal/dao/AttachmentRepository.java index 614d97a22..b203c98c5 100644 --- a/src/main/java/com/epam/ta/reportportal/dao/AttachmentRepository.java +++ b/src/main/java/com/epam/ta/reportportal/dao/AttachmentRepository.java @@ -32,6 +32,8 @@ public interface AttachmentRepository Optional findByFileId(String fileId); + List findAllByProjectId(Long projectId); + List findAllByLaunchIdIn(Collection launchIds); void deleteAllByProjectId(Long projectId); diff --git a/src/main/java/com/epam/ta/reportportal/filesystem/distributed/s3/S3DataStore.java b/src/main/java/com/epam/ta/reportportal/filesystem/distributed/s3/S3DataStore.java index 1ac0d896f..abcad405b 100644 --- a/src/main/java/com/epam/ta/reportportal/filesystem/distributed/s3/S3DataStore.java +++ b/src/main/java/com/epam/ta/reportportal/filesystem/distributed/s3/S3DataStore.java @@ -132,7 +132,7 @@ public void deleteAll(List filePaths, String bucketName) { if (!featureFlagHandler.isEnabled(FeatureFlag.SINGLE_BUCKET)) { blobStore.removeBlobs(bucketPrefix + bucketName + bucketPostfix, filePaths); } else { - blobStore.removeBlobs(bucketName, filePaths); + blobStore.removeBlobs(defaultBucketName, filePaths); } } From 8e4b91cc929905442e27eec74bddadb70a3e58de Mon Sep 17 00:00:00 2001 From: Siarhei Hrabko <45555481+grabsefx@users.noreply.github.com> Date: Fri, 22 Sep 2023 13:15:14 +0300 Subject: [PATCH 3/4] EPMRPP-86363 exclude system attributes in launches table widget (#932) * EPMRPP-86363 exclude system attributes in launches table widget * EPMRPP-86363 fixed check-style comments --- .../dao/WidgetContentRepositoryImpl.java | 3 ++- .../dao/WidgetContentRepositoryTest.java | 25 +++++++++++++++++++ .../V001005__widget_content_init.sql | 4 +-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/epam/ta/reportportal/dao/WidgetContentRepositoryImpl.java b/src/main/java/com/epam/ta/reportportal/dao/WidgetContentRepositoryImpl.java index 7290d5e73..3481ddabf 100644 --- a/src/main/java/com/epam/ta/reportportal/dao/WidgetContentRepositoryImpl.java +++ b/src/main/java/com/epam/ta/reportportal/dao/WidgetContentRepositoryImpl.java @@ -1227,7 +1227,8 @@ private SelectSeekStepN buildLaunchesTableQuery(Collection contentFields = buildLaunchesTableContentFields(); + + List launchStatisticsContents = widgetContentRepository.launchesTableStatistics( + filter, + contentFields, + sort, + 3 + ); + assertNotNull(launchStatisticsContents); + assertEquals(3, launchStatisticsContents.size()); + + launchStatisticsContents.forEach(content -> { + assertTrue(CollectionUtils.isNotEmpty(content.getAttributes())); + boolean isSystemAttributePresent = content.getAttributes() + .stream() + .anyMatch(attribute -> attribute.getValue().equals("true_system_attr")); + assertFalse(isSystemAttributePresent); + }); + } + @Test void activityStatistics() { Filter filter = buildDefaultActivityFilter(1L); diff --git a/src/test/resources/db/migration/V001005__widget_content_init.sql b/src/test/resources/db/migration/V001005__widget_content_init.sql index d840d13ba..e36ee9da1 100644 --- a/src/test/resources/db/migration/V001005__widget_content_init.sql +++ b/src/test/resources/db/migration/V001005__widget_content_init.sql @@ -1,8 +1,7 @@ create or replace function widget_content_init() RETURNS VOID as $$ -DECLARE - launch1 BIGINT; + DECLARE launch1 BIGINT; DECLARE launch2 BIGINT; DECLARE launch3 BIGINT; DECLARE launch4 BIGINT; @@ -98,6 +97,7 @@ BEGIN INSERT INTO item_attribute ("key", "value", item_id, launch_id, system) VALUES ('build', '1.3.2', null, launch2, false); INSERT INTO item_attribute ("key", "value", item_id, launch_id, system) VALUES ('build', '1.9.1', null, launch3, false); INSERT INTO item_attribute ("key", "value", item_id, launch_id, system) VALUES ('build', '3', null, launch4, false); + INSERT INTO item_attribute ("key", "value", item_id, launch_id, system) VALUES ('build', 'true_system_attr', null, launch1, true); INSERT INTO public.ticket (id, ticket_id, submitter, submit_date, bts_url, bts_project, url) From 7a588937b6206cd6b882f7dbe22fd55788646433 Mon Sep 17 00:00:00 2001 From: Pavel Bortnik Date: Fri, 20 Oct 2023 16:54:00 +0300 Subject: [PATCH 4/4] EPMRPP-80574 || Fix early stream closing --- .../com/epam/ta/reportportal/config/EncryptConfiguration.java | 4 ++-- .../reportportal/filesystem/distributed/s3/S3DataStore.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/epam/ta/reportportal/config/EncryptConfiguration.java b/src/main/java/com/epam/ta/reportportal/config/EncryptConfiguration.java index b865b6add..4a0069e16 100644 --- a/src/main/java/com/epam/ta/reportportal/config/EncryptConfiguration.java +++ b/src/main/java/com/epam/ta/reportportal/config/EncryptConfiguration.java @@ -116,8 +116,8 @@ private String getPassword() { } private String loadFromDataStore() { - try { - return IOUtils.toString(dataStore.load(secretFilePath), StandardCharsets.UTF_8); + try (InputStream source = dataStore.load(secretFilePath)) { + return IOUtils.toString(source, StandardCharsets.UTF_8); } catch (IOException e) { throw new ReportPortalException(ErrorType.UNABLE_TO_LOAD_BINARY_DATA, e.getMessage()); } diff --git a/src/main/java/com/epam/ta/reportportal/filesystem/distributed/s3/S3DataStore.java b/src/main/java/com/epam/ta/reportportal/filesystem/distributed/s3/S3DataStore.java index 313e1102b..22b09474b 100644 --- a/src/main/java/com/epam/ta/reportportal/filesystem/distributed/s3/S3DataStore.java +++ b/src/main/java/com/epam/ta/reportportal/filesystem/distributed/s3/S3DataStore.java @@ -106,8 +106,8 @@ public InputStream load(String filePath) { S3File s3File = getS3File(filePath); Blob fileBlob = blobStore.getBlob(s3File.getBucket(), s3File.getFilePath()); if (fileBlob != null) { - try (InputStream inputStream = fileBlob.getPayload().openStream()) { - return inputStream; + try { + return fileBlob.getPayload().openStream(); } catch (IOException e) { throw new ReportPortalException(ErrorType.UNABLE_TO_LOAD_BINARY_DATA, e.getMessage()); }