From 45a9093055269706492e489a77a95a9521c89339 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Thu, 29 Apr 2021 20:58:04 +0200 Subject: [PATCH] ensure import file stream is closed --- .../com/sparrowwallet/sparrow/control/FileImportPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/FileImportPane.java b/src/main/java/com/sparrowwallet/sparrow/control/FileImportPane.java index 6208988f..2c6e1ec1 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/FileImportPane.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/FileImportPane.java @@ -113,8 +113,9 @@ public abstract class FileImportPane extends TitledDescriptionPane { importButton.setDisable(true); setExpanded(true); } else { - InputStream inputStream = new BufferedInputStream(new FileInputStream(file)); - importFile(file.getName(), inputStream, password); + try(InputStream inputStream = new BufferedInputStream(new FileInputStream(file))) { + importFile(file.getName(), inputStream, password); + }; } } catch (Exception e) { log.error("Error importing file", e);