From 731abae55716a3023f145dce3bed2ef81ccb81a1 Mon Sep 17 00:00:00 2001 From: Andrew Wang Date: Thu, 24 May 2018 09:56:23 -0700 Subject: [PATCH] HDFS-13611. Unsafe use of Text as a ConcurrentHashMap key in PBHelperClient. (cherry picked from commit c9b63deb533274ca8ef4939f6cd13f728a067f7b) --- .../java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java index f9739521416..b7f7f9f4c54 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java @@ -240,7 +240,7 @@ public class PBHelperClient { ByteString value = fixedByteStringCache.get(key); if (value == null) { value = ByteString.copyFromUtf8(key.toString()); - fixedByteStringCache.put(key, value); + fixedByteStringCache.put(new Text(key.copyBytes()), value); } return value; }