This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-crypto.git
The following commit(s) were added to refs/heads/master by this push: new b1daaed Use try-with-resources. b1daaed is described below commit b1daaed27442ccdb8e41808a69fdffeeb4ea60c0 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Wed Aug 5 12:36:22 2020 -0400 Use try-with-resources. --- src/main/java/org/apache/commons/crypto/utils/Utils.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/commons/crypto/utils/Utils.java b/src/main/java/org/apache/commons/crypto/utils/Utils.java index c8a11af..0345b3d 100644 --- a/src/main/java/org/apache/commons/crypto/utils/Utils.java +++ b/src/main/java/org/apache/commons/crypto/utils/Utils.java @@ -62,16 +62,16 @@ public final class Utils { // default to system final Properties defaultedProps = new Properties(System.getProperties()); try { - final InputStream is = Thread.currentThread().getContextClassLoader() - .getResourceAsStream(SYSTEM_PROPERTIES_FILE); + final Properties fileProps = new Properties(); + try (final InputStream is = Thread.currentThread().getContextClassLoader() + .getResourceAsStream(SYSTEM_PROPERTIES_FILE)) { - if (is == null) { - return defaultedProps; // no configuration file is found + if (is == null) { + return defaultedProps; // no configuration file is found + } + // Load property file + fileProps.load(is); } - // Load property file - final Properties fileProps = new Properties(); - fileProps.load(is); - is.close(); final Enumeration<?> names = fileProps.propertyNames(); while (names.hasMoreElements()) { final String name = (String) names.nextElement();