You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Pierre De Rop (JIRA)" <ji...@apache.org> on 2016/11/06 23:08:58 UTC

[jira] [Resolved] (FELIX-5401) Can't override default configuration type map value using an empty map

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

Pierre De Rop resolved FELIX-5401.
----------------------------------
    Resolution: Fixed

I think it's ok now.

> Can't override default configuration type map value using an empty map
> ----------------------------------------------------------------------
>
>                 Key: FELIX-5401
>                 URL: https://issues.apache.org/jira/browse/FELIX-5401
>             Project: Felix
>          Issue Type: Bug
>          Components: Dependency Manager
>    Affects Versions: org.apache.felix.dependencymanager-r8
>            Reporter: Pierre De Rop
>            Assignee: Pierre De Rop
>            Priority: Minor
>             Fix For: org.apache.felix.dependencymanager-r9
>
>
> Assume you are using the following configuration type:
> {code}
>     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;
>         }        
>     }
> {code}
> So, you can then declare the following values in the actual configuration dictionary for the "map" key:
> {code}
> map.key1=value1
> map.key2=value2
> ...
> or
> map={key1.value1, key2.value2}
> {code}
> 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.



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