Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINOR: Implement ApiError#equals and hashCode #9390

Merged
merged 1 commit into from Oct 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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