From 2f0f756b26ea83e142a5b9379fa75862c2fc6ad5 Mon Sep 17 00:00:00 2001 From: Tsuyoshi Ozawa Date: Tue, 17 Feb 2015 21:56:20 +0900 Subject: [PATCH] HADOOP-11600. Fix up source codes to be compiled with Guava 17.0. (ozawa) --- hadoop-common-project/hadoop-common/CHANGES.txt | 2 ++ .../java/org/apache/hadoop/fs/shell/XAttrCommands.java | 10 ++++++++-- .../tools/offlineImageViewer/PBImageTextWriter.java | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 51305bba7f..c3aafe8954 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -605,6 +605,8 @@ Release 2.7.0 - UNRELEASED HADOOP-11589. NetUtils.createSocketAddr should trim the input URI. (Rakesh R via ozawa) + HADOOP-11600. Fix up source codes to be compiled with Guava 17.0. (ozawa) + OPTIMIZATIONS HADOOP-11323. WritableComparator#compare keeps reference to byte array. diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java index 44e970b88f..4efda87444 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.util.Iterator; import java.util.LinkedList; +import java.util.Locale; import java.util.Map; import java.util.Map.Entry; @@ -77,9 +78,14 @@ protected void processOptions(LinkedList args) throws IOException { name = StringUtils.popOptionWithArgument("-n", args); String en = StringUtils.popOptionWithArgument("-e", args); if (en != null) { - encoding = enValueOfFunc.apply(en.toUpperCase()); + try { + encoding = enValueOfFunc.apply(en.toUpperCase(Locale.ENGLISH)); + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException( + "Invalid/unsupported encoding option specified: " + en); + } Preconditions.checkArgument(encoding != null, - "Invalid/unsupported encoding option specified: " + en); + "Invalid/unsupported encoding option specified: " + en); } boolean r = StringUtils.popOption("-R", args); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageTextWriter.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageTextWriter.java index 0da263d87a..d228920df6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageTextWriter.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageTextWriter.java @@ -19,7 +19,6 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Lists; -import com.google.common.io.LimitInputStream; import org.apache.commons.io.FileUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.permission.PermissionStatus; @@ -33,6 +32,7 @@ import org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INode; import org.apache.hadoop.hdfs.server.namenode.INodeId; import org.apache.hadoop.io.IOUtils; +import org.apache.hadoop.util.LimitInputStream; import org.apache.hadoop.util.Time; import org.fusesource.leveldbjni.JniDBFactory; import org.iq80.leveldb.DB;