[ 
https://issues.apache.org/jira/browse/KAFKA-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jason Whaley updated KAFKA-2184:
--------------------------------
    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:

{code}
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); 
    }
}
{code}

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


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

{code}
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); 
    }
}
{code}

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



> ConsumerConfig does not honor default java.util.Properties
> ----------------------------------------------------------
>
>                 Key: KAFKA-2184
>                 URL: https://issues.apache.org/jira/browse/KAFKA-2184
>             Project: Kafka
>          Issue Type: Bug
>          Components: consumer
>    Affects Versions: 0.8.2.0
>            Reporter: Jason Whaley
>            Assignee: Neha Narkhede
>            Priority: Minor
>
> When creating a ConsumerConfig from java.util.Properties, an 
> IllegalArgumentException is thrown when the Properties instance is converted 
> to a VerifiableProperties instance.  To reproduce:
> {code}
> 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); 
>     }
> }
> {code}
> This is easy enough to work around, but default Properties should be honored 
> by not calling containsKey inside of 
> kafka.utils.VerifiableProperties#getString



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to