You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Chetan Mehrotra (JIRA)" <ji...@apache.org> on 2014/05/27 11:13:01 UTC

[jira] [Resolved] (OAK-1857) Support collection object conversion to String[] in ConfigurationParameters

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

Chetan Mehrotra resolved OAK-1857.
----------------------------------

    Resolution: Fixed

Fixed in http://svn.apache.org/r1597727

> Support collection object conversion to String[] in ConfigurationParameters
> ---------------------------------------------------------------------------
>
>                 Key: OAK-1857
>                 URL: https://issues.apache.org/jira/browse/OAK-1857
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: core
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>            Priority: Minor
>         Attachments: OAK-1857.patch
>
>
> {{ConfigurationParameters}} currently only converts simple type to the desired target type. For array type if the object value type matches the target type then it is returned otherwise an error is thrown
> In OSGi configuration its possible that a multi value property is returned as array or collection [1]. To support such case we should try to convert a value to String[] from collection also
> In particular following case should pass
> {code}
>     @Test
>     public void testCollectionAsArray() throws Exception{
>         String[] testArray = {"t"};
>         ConfigurationParameters options = ConfigurationParameters.of(Collections.singletonMap("test", Arrays.asList(testArray)));
>         assertArrayEquals(testArray, options.getConfigValue("test", null, String[].class));
>     }
> {code}
> [1] http://www.osgi.org/javadoc/r2/org/osgi/service/cm/Configuration.html



--
This message was sent by Atlassian JIRA
(v6.2#6252)