You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 05:48:50 UTC

svn commit: r1077727 - /hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/metrics2/MetricsTag.java

Author: omalley
Date: Fri Mar  4 04:48:50 2011
New Revision: 1077727

URL: http://svn.apache.org/viewvc?rev=1077727&view=rev
Log:
commit ce2db7ab1e3675a235b98801f838c9e334b28a5c
Author: Luke Lu <ll...@yahoo-inc.com>
Date:   Mon Sep 27 15:24:17 2010 -0700

     Fix metrics tag hash code for null values

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/metrics2/MetricsTag.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/metrics2/MetricsTag.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/metrics2/MetricsTag.java?rev=1077727&r1=1077726&r2=1077727&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/metrics2/MetricsTag.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/metrics2/MetricsTag.java Fri Mar  4 04:48:50 2011
@@ -78,6 +78,10 @@ public class MetricsTag {
     if (!this.description.equals(other.description())) {
       return false;
     }
+    if (this.value == null || other.value() == null) {
+      if (this.value == null && other.value() == null) return true;
+      return false;
+    }
     if (!this.value.equals(other.value())) {
       return false;
     }
@@ -86,7 +90,7 @@ public class MetricsTag {
 
   @Override
   public int hashCode() {
-    return name.hashCode() ^ value.hashCode();
+    return name.hashCode() ^ (value == null ? 0 : value.hashCode());
   }
 
   @Override