From 2d140567edf035fe665f66b78d488bc12c0f157b Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Mon, 30 Mar 2020 20:58:40 -0400 Subject: Clean up warnings Clear up some warnings that had popped up. Mostly, closing some input streams after we're done with them. --- .../java/bjc/inflexion/examples/InflexionTester.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/examples/java') diff --git a/src/examples/java/bjc/inflexion/examples/InflexionTester.java b/src/examples/java/bjc/inflexion/examples/InflexionTester.java index ff5dcd7..0595cfa 100644 --- a/src/examples/java/bjc/inflexion/examples/InflexionTester.java +++ b/src/examples/java/bjc/inflexion/examples/InflexionTester.java @@ -48,11 +48,18 @@ public class InflexionTester { */ public static void main(final String[] args) { final Prepositions prepositionDB = new Prepositions(); - prepositionDB.loadFromStream( - InflexionTester.class.getResourceAsStream("/prepositions.txt")); + try (InputStream strim = InflectionML.class.getResourceAsStream("/prepositions.txt")) { + prepositionDB.loadFromStream(strim); + } catch (IOException ioex) { + ioex.printStackTrace(); + } - final Nouns nounDB = new Nouns(prepositionDB); - nounDB.loadFromStream(InflexionTester.class.getResourceAsStream("/nouns.txt")); + Nouns nounDB = new Nouns(prepositionDB); + try (InputStream strim = InflectionML.class.getResourceAsStream("/nouns.txt")) { + nounDB.loadFromStream(strim); + } catch (IOException ioex) { + ioex.printStackTrace(); + } final Scanner scn = new Scanner(System.in); -- cgit v1.2.3