Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-5401

Can't override default configuration type map value using an empty map

    XMLWordPrintableJSON

Details

    Description

      Assume you are using the following configuration type:

          public interface MyConfig {
              public default SortedMap<String, String> getMap() { 
              	SortedMap<String, String> defaultMap = new TreeMap<>();
              	defaultMap.put("key1", "default1");
              	defaultMap.put("key2", "default2");
              	return defaultMap;
              }        
          }
      

      So, you can then declare the following values in the actual configuration dictionary for the "map" key:

      map.key1=value1
      map.key2=value2
      ...
      
      or
      
      map={key1.value1, key2.value2}
      

      But assuming that you now want to register in config admin a configuration dictionary with an empty map for the "map" key: it is not currently possible, because if you don't declare any values for the "map" key, then the default value of the configuration type will be returned (see FELIX-5399).

      And if you declare the following value for the "map" key:

      map={}

      then it does not work too because the "toMap" method in the Configurable.java class does not check empty "{}" declaration.

      Attachments

        Activity

          People

            pderop Pierre De Rop
            pderop Pierre De Rop
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: