From bc2a4434183e833c4f74ff91583747be5033a1be Mon Sep 17 00:00:00 2001 From: Alejandro Abdelnur Date: Sun, 12 Jan 2014 23:24:37 +0000 Subject: [PATCH] HADOOP-10223. MiniKdc#main() should close the FileReader it creates. (Ted Yu via tucu) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1557627 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../main/java/org/apache/hadoop/minikdc/MiniKdc.java | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index e8c7e5cc45..6c348091c9 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -511,6 +511,9 @@ Release 2.4.0 - UNRELEASED HADOOP-10214. Fix multithreaded correctness warnings in ActiveStandbyElector (Liang Xie via kasha) + HADOOP-10223. MiniKdc#main() should close the FileReader it creates. + (Ted Yu via tucu) + Release 2.3.0 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java b/hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java index ed2142b46c..8eb24e9fc3 100644 --- a/hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java +++ b/hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java @@ -125,7 +125,15 @@ public static void main(String[] args) throws Exception { + file.getAbsolutePath()); } Properties userConf = new Properties(); - userConf.load(new FileReader(file)); + FileReader r = null; + try { + r = new FileReader(file); + userConf.load(r); + } finally { + if (r != null) { + r.close(); + } + } for (Map.Entry entry : userConf.entrySet()) { conf.put(entry.getKey(), entry.getValue()); }