Properly close fileoutput stream

This commit is contained in:
Cherry 2023-08-04 08:36:12 -07:00 committed by GitHub
parent 7d686cff56
commit 70b4734f3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}