Skip to content

Commit

Permalink
MINOR: Implement ApiError#equals and hashCode (#9390)
Browse files Browse the repository at this point in the history
Reviewers: Mickael Maison <mickael.maison@gmail.com>
  • Loading branch information
cmccabe committed Oct 9, 2020
1 parent 147a190 commit 46e48d7
Showing 1 changed file with 17 additions and 0 deletions.
Expand Up @@ -21,6 +21,8 @@
import org.apache.kafka.common.protocol.Errors;
import org.apache.kafka.common.protocol.types.Struct;

import java.util.Objects;

import static org.apache.kafka.common.protocol.CommonFields.ERROR_CODE;
import static org.apache.kafka.common.protocol.CommonFields.ERROR_MESSAGE;

Expand Down Expand Up @@ -108,6 +110,21 @@ public ApiException exception() {
return error.exception(message);
}

@Override
public int hashCode() {
return Objects.hash(error, message);
}

@Override
public boolean equals(Object o) {
if (!(o instanceof ApiError)) {
return false;
}
ApiError other = (ApiError) o;
return Objects.equals(error, other.error) &&
Objects.equals(message, other.message);
}

@Override
public String toString() {
return "ApiError(error=" + error + ", message=" + message + ")";
Expand Down

0 comments on commit 46e48d7

Please sign in to comment.