Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-2999

Errors enum should be a 1 to 1 mapping of error codes and exceptions

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.0.0
    • Fix Version/s: 0.10.0.0
    • Component/s: None
    • Labels:
      None

      Description

      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.

      Error.java
      ...
      for (Errors error : Errors.values()) {
         codeToError.put(error.code(), error);
         if (error.exception != null)
            classToError.put(error.exception.getClass(), error);
      }
      ...
      

      This should be fixed and some tests should be written to validate it's not broken.

        Attachments

          Activity

            People

            • Assignee:
              granthenke Grant Henke
              Reporter:
              granthenke Grant Henke
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: