You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2016/05/19 19:02:33 UTC

[18/35] curator git commit: Schema's equals() hashCode() needed updating

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-3.0
Commit: f2ef8b3ac687de9badccfa5f4250f38fe332cb7d
Parents: ea05370
Author: randgalt <ra...@apache.org>
Authored: Tue May 3 10:42:25 2016 -0500
Committer: randgalt <ra...@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