Grant Henke created KAFKA-2999:
----------------------------------

             Summary: 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)

Reply via email to