You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Grant Henke (JIRA)" <ji...@apache.org> on 2016/01/13 19:18:39 UTC
[jira] [Updated] (KAFKA-2999) Errors enum should be a 1 to 1
mapping of error codes and exceptions
[ https://issues.apache.org/jira/browse/KAFKA-2999?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Grant Henke updated KAFKA-2999:
-------------------------------
Status: Patch Available (was: Open)
> Errors enum should be a 1 to 1 mapping of error codes and exceptions
> --------------------------------------------------------------------
>
> Key: KAFKA-2999
> URL: https://issues.apache.org/jira/browse/KAFKA-2999
> Project: Kafka
> Issue Type: Bug
> Affects Versions: 0.9.0.0
> Reporter: Grant Henke
> Assignee: Grant Henke
>
> Errors has functionality to map from code to exception and from exception to code. This requires the mapping to be 1 to 1 or else unexpected behavior may occur.
> In the current code (below), a generic ApiException will result in an INVALID_COMMIT_OFFSET_SIZE error, because that is the last occurrence in the Enum.
> {code:title=Error.java|borderStyle=solid}
> ...
> for (Errors error : Errors.values()) {
> codeToError.put(error.code(), error);
> if (error.exception != null)
> classToError.put(error.exception.getClass(), error);
> }
> ...
> {code}
> This should be fixed and some tests should be written to validate it's not broken.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)