hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1077727 - /hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/metrics2/MetricsTag.java
Date Fri, 04 Mar 2011 04:48:50 GMT
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 <llu@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



Mime
View raw message