HADOOP-11500. InputStream is left unclosed in ApplicationClassLoader. Contributed by Ted Yu.

(cherry picked from commit 825923f7b9)
This commit is contained in:
Tsuyoshi Ozawa 2015-01-23 00:50:19 +09:00
parent 1435b2002b
commit 7191efe25f
2 changed files with 5 additions and 4 deletions

View File

@ -385,6 +385,9 @@ Release 2.7.0 - UNRELEASED
HADOOP-11209. Configuration#updatingResource/finalParameters are not HADOOP-11209. Configuration#updatingResource/finalParameters are not
thread-safe. (Varun Saxena via ozawa) 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 Release 2.6.0 - 2014-11-18
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -67,10 +67,8 @@ public class ApplicationClassLoader extends URLClassLoader {
}; };
static { static {
InputStream is = null; try (InputStream is = ApplicationClassLoader.class.getClassLoader()
try { .getResourceAsStream(PROPERTIES_FILE);) {
is = ApplicationClassLoader.class.getClassLoader().
getResourceAsStream(PROPERTIES_FILE);
if (is == null) { if (is == null) {
throw new ExceptionInInitializerError("properties file " + throw new ExceptionInInitializerError("properties file " +
PROPERTIES_FILE + " is not found"); PROPERTIES_FILE + " is not found");