From 176e3945a30c13fa0240735c8662bc4f89b88fc0 Mon Sep 17 00:00:00 2001 From: Sav <74550527+sberss@users.noreply.github.com> Date: Tue, 16 Jul 2024 14:46:17 +0100 Subject: [PATCH] fix: move client out of try-with-resource to fix authentication when using role assumption --- .../java/software/amazon/nio/spi/s3/S3FileSystemProvider.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/software/amazon/nio/spi/s3/S3FileSystemProvider.java b/src/main/java/software/amazon/nio/spi/s3/S3FileSystemProvider.java index 55254d20..0dd5edc7 100644 --- a/src/main/java/software/amazon/nio/spi/s3/S3FileSystemProvider.java +++ b/src/main/java/software/amazon/nio/spi/s3/S3FileSystemProvider.java @@ -384,8 +384,8 @@ public void createDirectory(Path dir, FileAttribute... attrs) throws IOExcept var timeOut = TIMEOUT_TIME_LENGTH_1; final var unit = MINUTES; - try (S3AsyncClient client = s3Directory.getFileSystem().client()) { - client.putObject( + try { + s3Directory.getFileSystem().client().putObject( PutObjectRequest.builder() .bucket(s3Directory.bucketName()) .key(directoryKey)