From a45dc1089f5141b65c6bad679e470a0476a106ad Mon Sep 17 00:00:00 2001 From: Jakob Vogel Date: Mon, 18 Sep 2023 12:22:07 +0200 Subject: [PATCH] =?UTF-8?q?Properly=20try-catches=20the=20stream=20as=20we?= =?UTF-8?q?ll,=20not=20just=20the=20channel=20=F0=9F=9A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #233 --- src/main/java/ninja/S3Dispatcher.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/ninja/S3Dispatcher.java b/src/main/java/ninja/S3Dispatcher.java index 5ff4ab8..db78a6e 100644 --- a/src/main/java/ninja/S3Dispatcher.java +++ b/src/main/java/ninja/S3Dispatcher.java @@ -1072,8 +1072,9 @@ private File combineParts(String id, String uploadId, List parts) { file.getName(), file.getAbsolutePath()); } - try (FileChannel out = new FileOutputStream(file).getChannel()) { - combine(parts, out); + try (FileOutputStream outStream = new FileOutputStream(file); + FileChannel outChannel = outStream.getChannel()) { + combine(parts, outChannel); } } catch (IOException e) { throw Exceptions.handle(e);