Fix OAuthProtocol equality predicate The way OAuthProtocol was checked for equality was not performing well and triggering stack-overflows because of the recursive equality check. Change-Id: I6140b544fbffcd156dca379ebfdf0b82f0334004
diff --git a/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java b/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java index 088b70e..f1ef494 100644 --- a/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java +++ b/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java
@@ -238,7 +238,16 @@ @Override public boolean equals(Object obj) { - return Objects.deepEquals(this, obj); + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AccessToken other = (AccessToken) obj; + return Objects.equals(this.accessToken, other.accessToken) + && Objects.equals(this.raw, other.raw) + && Objects.equals(this.tokenType, other.tokenType); } public boolean isError() {