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
This commit is contained in:
Haohui Mai 2014-06-20 22:23:31 +00:00
parent 9ca79e8d32
commit bfc9c4b5a5
2 changed files with 8 additions and 4 deletions

View File

@ -617,6 +617,9 @@ Release 2.5.0 - UNRELEASED
HADOOP-10711. Cleanup some extra dependencies from hadoop-auth. (rkanter via tucu) 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 Release 2.4.1 - 2014-06-23
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -17,6 +17,7 @@
*/ */
package org.apache.hadoop.minikdc; package org.apache.hadoop.minikdc;
import org.apache.commons.io.Charsets;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.text.StrSubstitutor; import org.apache.commons.lang.text.StrSubstitutor;
@ -56,7 +57,7 @@ import org.slf4j.LoggerFactory;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.StringReader; import java.io.StringReader;
@ -126,9 +127,9 @@ public class MiniKdc {
+ file.getAbsolutePath()); + file.getAbsolutePath());
} }
Properties userConf = new Properties(); Properties userConf = new Properties();
FileReader r = null; InputStreamReader r = null;
try { try {
r = new FileReader(file); r = new InputStreamReader(new FileInputStream(file), Charsets.UTF_8);
userConf.load(r); userConf.load(r);
} finally { } finally {
if (r != null) { if (r != null) {
@ -438,7 +439,7 @@ public class MiniKdc {
BufferedReader r = null; BufferedReader r = null;
try { try {
r = new BufferedReader(new InputStreamReader(is2)); r = new BufferedReader(new InputStreamReader(is2, Charsets.UTF_8));
String line = r.readLine(); String line = r.readLine();
while (line != null) { while (line != null) {