RED-6270: Added try-with-resources to correctly close file stream
This commit is contained in:
parent
6165a5eea1
commit
9b9c79fc99
@ -5,6 +5,7 @@ import static com.iqser.red.service.persistence.management.v1.processor.utils.Ma
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -264,7 +265,11 @@ public class DossierTemplateExportService {
|
||||
private void storeZipFile(String storageId, FileSystemBackedArchiver fileSystemBackedArchiver) {
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
fileManagementStorageService.storeObject(storageId, fileSystemBackedArchiver.toInputStream());
|
||||
try (InputStream data = fileSystemBackedArchiver.toInputStream()) {
|
||||
fileManagementStorageService.storeObject(storageId, data);
|
||||
} catch (IOException ex) {
|
||||
log.warn("IO error when sending file to storage", ex);
|
||||
}
|
||||
log.info("Successfully stored zip for downloadId {}, took {}", storageId, System.currentTimeMillis() - start);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user