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

ConsumerConfig does not honor default java.util.Properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • 0.8.2.0
    • None
    • consumer
    • None

    Description

      When creating a ConsumerConfig from java.util.Properties, an IllegalArgumentException is thrown when the Properties instance is converted to a VerifiableProperties instance. To reproduce:

      package com.test;
      
      import kafka.consumer.ConsumerConfig;
      
      import java.util.Properties;
      
      public class ContainsKeyTest {
          public static void main(String[] args) {
              Properties defaultProperties = new Properties();
              defaultProperties.put("zookeeper.connect", "192.168.50.4:2181");
              defaultProperties.put("zookeeper.session.timeout.ms", "400");
              defaultProperties.put("zookeeper.sync.time.ms", "200");
              defaultProperties.put("auto.commit.interval.ms", "1000");
              defaultProperties.put("group.id", "consumerGroup");
      
              Properties props = new Properties(defaultProperties);
      
              //prints 192.168.50.4:2181
              System.out.println(props.getProperty("zookeeper.connect"));  
      
              //throws java.lang.IllegalArgumentException: requirement failed: Missing required property 'zookeeper.connect'
              ConsumerConfig config = new ConsumerConfig(props); 
          }
      }
      

      This is easy enough to work around, but default Properties should be honored by not calling containsKey inside of kafka.utils.VerifiableProperties#getString

      Attachments

        Issue Links

          Activity

            People

              granthenke Grant Henke
              whaley Jason Whaley
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: