From 70b4734f3d2ef94417d185c2368702c157e09650 Mon Sep 17 00:00:00 2001 From: Cherry <13651622+MolotovCherry@users.noreply.github.com> Date: Fri, 4 Aug 2023 08:36:12 -0700 Subject: [PATCH] Properly close fileoutput stream --- src/main/java/rocks/kavin/reqwest4j/ReqwestUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/rocks/kavin/reqwest4j/ReqwestUtils.java b/src/main/java/rocks/kavin/reqwest4j/ReqwestUtils.java index 254e7e4..5f18163 100644 --- a/src/main/java/rocks/kavin/reqwest4j/ReqwestUtils.java +++ b/src/main/java/rocks/kavin/reqwest4j/ReqwestUtils.java @@ -41,8 +41,8 @@ public class ReqwestUtils { final var cl = ReqwestUtils.class.getClassLoader(); - try (var stream = cl.getResourceAsStream("META-INF/natives/" + native_folder + "/" + arch + "/libreqwest" + extension)) { - stream.transferTo(new FileOutputStream(nativeFile)); + try (var stream = cl.getResourceAsStream("META-INF/natives/" + native_folder + "/" + arch + "/libreqwest" + extension); var fileOutputStream = new FileOutputStream(nativeFile)) { + stream.transferTo(fileOutputStream); } catch (IOException e) { throw new RuntimeException(e); }