You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2016/04/22 10:33:10 UTC

[02/13] james-project git commit: JAMES-1717 Error response should have equals and hashCode

JAMES-1717 Error response should have equals and hashCode


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/76f852e8
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/76f852e8
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/76f852e8

Branch: refs/heads/master
Commit: 76f852e847e13ecf724aa7f4ef3209668b1a2b40
Parents: 3dd21e3
Author: Benoit Tellier <bt...@linagora.com>
Authored: Thu Apr 7 16:11:15 2016 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Fri Apr 22 15:26:24 2016 +0700

----------------------------------------------------------------------
 .../apache/james/jmap/methods/ErrorResponse.java  | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/76f852e8/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/ErrorResponse.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/ErrorResponse.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/ErrorResponse.java
index 32b2c36..c0565ab 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/ErrorResponse.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/ErrorResponse.java
@@ -19,6 +19,7 @@
 
 package org.apache.james.jmap.methods;
 
+import java.util.Objects;
 import java.util.Optional;
 
 import com.google.common.annotations.VisibleForTesting;
@@ -69,4 +70,21 @@ public class ErrorResponse implements Method.Response {
     public Optional<String> getDescription() {
         return description;
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+
+        ErrorResponse that = (ErrorResponse) o;
+
+        return Objects.equals(this.type, that.type)
+            && Objects.equals(this.description, that.description);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(type, description);
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org