Kafka
  1. Kafka
  2. KAFKA-1198

NullPointerException in describe topic

    Details

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

      Description

      If topic is not specified, we get the following.

      bin/kafka-topics.sh --zookeeper localhost:2181 --describe
      (Error while executing topic command,java.lang.NullPointerException)

      Also, list topic seems to always list all topics even when topics are specified.

      1. KAFKA-1198.patch
        2 kB
        Guozhang Wang
      2. KAFKA-1198_2014-01-03_10:17:46.patch
        3 kB
        Guozhang Wang

        Activity

        Hide
        Guozhang Wang added a comment -

        1) List option will always get all the topics, only describe option will take the topic specification.

        2) the getTopics function does not check if opts.topicOpt is specified, and hence throws the NullPointerException.

        Proposed solution: check topicOpt unless it is the list option.

        Show
        Guozhang Wang added a comment - 1) List option will always get all the topics, only describe option will take the topic specification. 2) the getTopics function does not check if opts.topicOpt is specified, and hence throws the NullPointerException. Proposed solution: check topicOpt unless it is the list option.
        Hide
        Guozhang Wang added a comment -

        I tried the following with the current trunk HEAD and did not hit the Exception:

        1. start ZK
        2. start one broker
        3. bin/kafka-topics.sh --zookeeper localhost:2181 --describe returns empty.
        4. create a topic
        5. bin/kafka-topics.sh --zookeeper localhost:2181 --list returns the topic
        6. bin/kafka-topics.sh --zookeeper localhost:2181 --describe returns the description of the topic.

        Show
        Guozhang Wang added a comment - I tried the following with the current trunk HEAD and did not hit the Exception: 1. start ZK 2. start one broker 3. bin/kafka-topics.sh --zookeeper localhost:2181 --describe returns empty. 4. create a topic 5. bin/kafka-topics.sh --zookeeper localhost:2181 --list returns the topic 6. bin/kafka-topics.sh --zookeeper localhost:2181 --describe returns the description of the topic.
        Hide
        Guozhang Wang added a comment -

        I can re-produce this issue now, was having an older jar before.

        Show
        Guozhang Wang added a comment - I can re-produce this issue now, was having an older jar before.
        Hide
        Guozhang Wang added a comment -

        Created reviewboard https://reviews.apache.org/r/16579/
        against branch origin/trunk

        Show
        Guozhang Wang added a comment - Created reviewboard https://reviews.apache.org/r/16579/ against branch origin/trunk
        Hide
        Guozhang Wang added a comment -

        Updated reviewboard https://reviews.apache.org/r/16579/
        against branch origin/trunk

        Show
        Guozhang Wang added a comment - Updated reviewboard https://reviews.apache.org/r/16579/ against branch origin/trunk
        Hide
        Jun Rao added a comment -

        Thanks for the patch. +1 and committed trunk.

        Show
        Jun Rao added a comment - Thanks for the patch. +1 and committed trunk.

          People

          • Assignee:
            Guozhang Wang
            Reporter:
            Jun Rao
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development