From 5d37911882eabc31320e783bba649fa2e6fd6155 Mon Sep 17 00:00:00 2001 From: Suresh Srinivas Date: Sun, 16 Sep 2012 22:33:13 +0000 Subject: [PATCH] HADOOP-8821. Fix findbugs warning related concatenating string in a for loop in Configuration#dumpDeprecatedKeys(). Contributed by Suresh Srinivas. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1385389 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../main/java/org/apache/hadoop/conf/Configuration.java | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 0ff925ef803..589c59abad8 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -211,6 +211,9 @@ Trunk (Unreleased) HADOOP-8818. Use equals instead == in MD5MD5CRC32FileChecksum and TFileDumper. (Brandon Li via suresh) + HADOOP-8821. Fix findbugs warning related to concatenating string in a + for loop in Configuration#dumpDeprecatedKeys(). (suresh) + OPTIMIZATIONS HADOOP-7761. Improve the performance of raw comparisons. (todd) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java index b2128e75783..21454154e0c 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java @@ -2332,17 +2332,17 @@ public class Configuration implements Iterable>, /** * A unique class which is used as a sentinel value in the caching - * for getClassByName. {@see Configuration#getClassByNameOrNull(String)} + * for getClassByName. {@link Configuration#getClassByNameOrNull(String)} */ private static abstract class NegativeCacheSentinel {} public static void dumpDeprecatedKeys() { for (Map.Entry entry : deprecatedKeyMap.entrySet()) { - String newKeys = ""; + StringBuilder newKeys = new StringBuilder(); for (String newKey : entry.getValue().newKeys) { - newKeys += newKey + "\t"; + newKeys.append(newKey).append("\t"); } - System.out.println(entry.getKey() + "\t" + newKeys); + System.out.println(entry.getKey() + "\t" + newKeys.toString()); } } }