diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 310b8ef64a0..39748e84421 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -385,6 +385,9 @@ Release 2.7.0 - UNRELEASED HADOOP-11209. Configuration#updatingResource/finalParameters are not thread-safe. (Varun Saxena via ozawa) + HADOOP-11500. InputStream is left unclosed in ApplicationClassLoader. + (Ted Yu via ozawa) + Release 2.6.0 - 2014-11-18 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ApplicationClassLoader.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ApplicationClassLoader.java index 9f16b61044f..6d37c28774e 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ApplicationClassLoader.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ApplicationClassLoader.java @@ -67,10 +67,8 @@ public class ApplicationClassLoader extends URLClassLoader { }; static { - InputStream is = null; - try { - is = ApplicationClassLoader.class.getClassLoader(). - getResourceAsStream(PROPERTIES_FILE); + try (InputStream is = ApplicationClassLoader.class.getClassLoader() + .getResourceAsStream(PROPERTIES_FILE);) { if (is == null) { throw new ExceptionInInitializerError("properties file " + PROPERTIES_FILE + " is not found");