Jelajahi Sumber

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
Suresh Srinivas 12 tahun lalu
induk
melakukan
5d37911882

+ 3 - 0
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)

+ 4 - 4
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java

@@ -2332,17 +2332,17 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
   
   /**
    * 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<String, DeprecatedKeyInfo> 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());
     }
   }
 }