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 22:59:58 UTC

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

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

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

I think it is resolved.

> Can't override default configuration type list value using an empty list
> ------------------------------------------------------------------------
>
>                 Key: FELIX-5400
>                 URL: https://issues.apache.org/jira/browse/FELIX-5400
>             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 List<String> getList() { 
>         	return Arrays.asList("a", "b");
>         }        
>     }
> {code}
> So, you can then declare the following values in the actual configuration dictionary for the "list" key:
> {code}
> list=[a,b]
> or
> list.0=a
> list.1=b
> {code}
> But assuming that you now want to register in config admin a configuration dictionary with an empty list (you really want an empty list []): then it is not currently possible, because if you don't declare any values for the "list" key, then the default value of the configuration type will be returned (see FELIX5399).
> And if you declare the following value for the "list" key:
> list=[]
> then it does not work too  (an empty list won't be returned) because the "toCollection" method in the Configurable.java class calls: 
> {code}
> Arrays.asList(str.split("\\s*,\\s*"))
> {code}
> which then returns an array of size=1, instead of returning an array of zero size.



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