curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject curator git commit: Schema's equals() hashCode() needed updating
Date Tue, 03 May 2016 15:42:33 GMT
Repository: curator
Updated Branches:
  refs/heads/CURATOR-322 ea0537036 -> f2ef8b3ac


Schema's equals() hashCode() needed updating


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/f2ef8b3a
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/f2ef8b3a
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/f2ef8b3a

Branch: refs/heads/CURATOR-322
Commit: f2ef8b3ac687de9badccfa5f4250f38fe332cb7d
Parents: ea05370
Author: randgalt <randgalt@apache.org>
Authored: Tue May 3 10:42:25 2016 -0500
Committer: randgalt <randgalt@apache.org>
Committed: Tue May 3 10:42:25 2016 -0500

----------------------------------------------------------------------
 .../org/apache/curator/framework/schema/Schema.java    | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/f2ef8b3a/curator-framework/src/main/java/org/apache/curator/framework/schema/Schema.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/schema/Schema.java
b/curator-framework/src/main/java/org/apache/curator/framework/schema/Schema.java
index 6d08244..fc4919e 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/schema/Schema.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/schema/Schema.java
@@ -180,6 +180,7 @@ public class Schema
         return path;
     }
 
+    // intentionally only path and pathRegex
     @Override
     public boolean equals(Object o)
     {
@@ -194,14 +195,22 @@ public class Schema
 
         Schema schema = (Schema)o;
 
-        return pathRegex.equals(schema.pathRegex);
+        //noinspection SimplifiableIfStatement
+        if ( !pathRegex.equals(schema.pathRegex) )
+        {
+            return false;
+        }
+        return path.equals(schema.path);
 
     }
 
+    // intentionally only path and pathRegex
     @Override
     public int hashCode()
     {
-        return pathRegex.hashCode();
+        int result = pathRegex.hashCode();
+        result = 31 * result + path.hashCode();
+        return result;
     }
 
     @Override


Mime
View raw message