[ 
https://issues.apache.org/jira/browse/KAFKA-2999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15096718#comment-15096718
 ] 

ASF GitHub Bot commented on KAFKA-2999:
---------------------------------------

GitHub user granthenke opened a pull request:

    https://github.com/apache/kafka/pull/766

    KAFKA-2999: Errors enum should be a 1 to 1 mapping of error codes and…

    … exceptions

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/granthenke/kafka errors-map

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/766.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #766
    
----
commit 86ce814a533b90147f862a2114e40d360181cd7c
Author: Grant Henke <[email protected]>
Date:   2016-01-13T18:04:39Z

    KAFKA-2999: Errors enum should be a 1 to 1 mapping of error codes and 
exceptions

----


> 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