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

Jeremy Custenborder commented on KAFKA-3237:
--------------------------------------------

There are two test cases [testInvalidDefaultRange() and 
testInvalidDefaultString()|https://github.com/apache/kafka/blob/trunk/clients/src/test/java/org/apache/kafka/common/config/ConfigDefTest.java#L118-L126]
 which test the defaults passed in with ConfigDef.define(). Does checking the 
default really matter? The exception text is going to be the same if checked 
during define or when parse() is called. Correcting the behavior in the 
description requires removal of these two test cases. Does that sound valid?

> ConfigDef validators require a default value
> --------------------------------------------
>
>                 Key: KAFKA-3237
>                 URL: https://issues.apache.org/jira/browse/KAFKA-3237
>             Project: Kafka
>          Issue Type: Bug
>          Components: config
>    Affects Versions: 0.9.0.0
>            Reporter: Jeremy Custenborder
>            Priority: Minor
>
> I should be able to add a ConfigDef that has a validator but does has null as 
> the default value. This would allow me to have a required property that is 
> restricted to certain strings in this example. This exception should be 
> thrown upon call to ConfigDef.parse instead. 
> {code}
> ConfigDef def = new ConfigDef();
> def.define(key, Type.STRING, null, ValidString.in("ONE", "TWO", "THREE"), 
> Importance.HIGH, "docs");
> {code}
> {code}
> Invalid value null for configuration test: String must be one of: ONE, TWO, 
> THREE
> org.apache.kafka.common.config.ConfigException: Invalid value null for 
> configuration enum_test: String must be one of: ONE, TWO, THREE
>       at 
> org.apache.kafka.common.config.ConfigDef$ValidString.ensureValid(ConfigDef.java:349)
>       at 
> org.apache.kafka.common.config.ConfigDef$ConfigKey.<init>(ConfigDef.java:375)
> {code}



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

Reply via email to