From bfc9c4b5a567a9f2efc185a7f25e17edd536101b Mon Sep 17 00:00:00 2001 From: Haohui Mai Date: Fri, 20 Jun 2014 22:23:31 +0000 Subject: [PATCH] HADOOP-10479. Fix new findbugs warnings in hadoop-minikdc. Contributed by Swarnim Kulkarni. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1604292 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/minikdc/MiniKdc.java | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 3adee445e54..cb49bc5343f 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -617,6 +617,9 @@ Release 2.5.0 - UNRELEASED HADOOP-10711. Cleanup some extra dependencies from hadoop-auth. (rkanter via tucu) + HADOOP-10479. Fix new findbugs warnings in hadoop-minikdc. + (Swarnim Kulkarni via wheat9) + Release 2.4.1 - 2014-06-23 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 33ff1bb9c22..d3ea2e70cfa 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 @@ -17,6 +17,7 @@ */ package org.apache.hadoop.minikdc; +import org.apache.commons.io.Charsets; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.text.StrSubstitutor; @@ -56,7 +57,7 @@ import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; +import java.io.FileInputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.StringReader; @@ -126,9 +127,9 @@ public class MiniKdc { + file.getAbsolutePath()); } Properties userConf = new Properties(); - FileReader r = null; + InputStreamReader r = null; try { - r = new FileReader(file); + r = new InputStreamReader(new FileInputStream(file), Charsets.UTF_8); userConf.load(r); } finally { if (r != null) { @@ -438,7 +439,7 @@ public class MiniKdc { BufferedReader r = null; try { - r = new BufferedReader(new InputStreamReader(is2)); + r = new BufferedReader(new InputStreamReader(is2, Charsets.UTF_8)); String line = r.readLine(); while (line != null) {