From 071da287dd0e049792370850416da1ae656acee5 Mon Sep 17 00:00:00 2001 From: Leonard Kupper <leonard.kupper@mailbox.tu-dresden.de> Date: Tue, 24 Sep 2019 10:29:08 +0200 Subject: [PATCH] Add try with resource. --- .../inf/mci/brailleplot/brailleparser/PropertiesParser.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/de/tudresden/inf/mci/brailleplot/brailleparser/PropertiesParser.java b/src/main/java/de/tudresden/inf/mci/brailleplot/brailleparser/PropertiesParser.java index 4dda67c5..ed095f3b 100644 --- a/src/main/java/de/tudresden/inf/mci/brailleplot/brailleparser/PropertiesParser.java +++ b/src/main/java/de/tudresden/inf/mci/brailleplot/brailleparser/PropertiesParser.java @@ -23,11 +23,8 @@ public class PropertiesParser extends AbstractBrailleTableParser { public PropertiesParser(final String filePath) { Objects.requireNonNull(filePath); - InputStream stream; - try { - stream = new GeneralResource(filePath).getInputStream(); // use input stream (jar resource) instead of file input stream. + try (InputStream stream = new GeneralResource(filePath).getInputStream()) { // use input stream (jar resource) instead of file input stream. mProperties.load(stream); - stream.close(); } catch (java.io.IOException e) { throw new RuntimeException(e); } -- GitLab