diff --git a/batik-util/src/main/java/org/apache/batik/util/XMLResourceDescriptor.java b/batik-util/src/main/java/org/apache/batik/util/XMLResourceDescriptor.java index ad7c5a7279..fc39d1a480 100644 --- a/batik-util/src/main/java/org/apache/batik/util/XMLResourceDescriptor.java +++ b/batik-util/src/main/java/org/apache/batik/util/XMLResourceDescriptor.java @@ -72,8 +72,9 @@ protected static synchronized Properties getParserProps() { parserProps = new Properties(); try { Class cls = XMLResourceDescriptor.class; - InputStream is = cls.getResourceAsStream(RESOURCES); - parserProps.load(is); + try (InputStream is = cls.getResourceAsStream(RESOURCES)) { + parserProps.load(is); + } } catch (IOException ioe) { throw new MissingResourceException(ioe.getMessage(), RESOURCES, null);