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

ConfigDef validators require a default value

    XMLWordPrintableJSON

    Details

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

      Description

      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.

      ConfigDef def = new ConfigDef();
      def.define(key, Type.STRING, null, ValidString.in("ONE", "TWO", "THREE"), Importance.HIGH, "docs");
      
      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)
      

        Attachments

          Activity

            People

            • Assignee:
              jcustenborder Jeremy Custenborder
              Reporter:
              jcustenborder Jeremy Custenborder
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: