Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-80574 || Fix early stream closing #940

Merged
merged 7 commits into from
Oct 20, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down