Browse Source

ensure import file stream is closed

terminal
Craig Raw 4 years ago
parent
commit
45a9093055
  1. 5
      src/main/java/com/sparrowwallet/sparrow/control/FileImportPane.java

5
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);

Loading…
Cancel
Save