You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Emmanuel Bourg (Commented) (JIRA)" <ji...@apache.org> on 2011/10/24 10:14:32 UTC

[jira] [Commented] (CONFIGURATION-342) DatabaseConfiguration.copy() loses list/array values

    [ https://issues.apache.org/jira/browse/CONFIGURATION-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13133884#comment-13133884 ] 

Emmanuel Bourg commented on CONFIGURATION-342:
----------------------------------------------

I suggest two solutions to this issue:
# either drop the unique constraint on the key and allow several entries with the same key
# concatenate the values with a separator

The fist solution is probably easier, but the list order will be lost (unless the results are sorted by rowId, but that's very database specific).
                
> DatabaseConfiguration.copy() loses list/array values
> ----------------------------------------------------
>
>                 Key: CONFIGURATION-342
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-342
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Type conversion
>    Affects Versions: 1.5
>            Reporter: Scott Wells
>             Fix For: 1.8
>
>         Attachments: ConfigurationUtil.java
>
>
> I've found a bug where adding a list property to a BaseConfiguration, then copying that full BaseConfiguration to a DatabaseConfiguration, the list is lost and only the first element is copied to the destination DatabaseConfiguration.  For example:
> {code:java}
> BaseConfiguration bc = new BaseConfiguration();
> bc.addProperty("myList", Arrays.asList("1", "2", "3", "4");
> DatabaseConfiguration dc = new DatabaseConfiguration(...);
> dc.copy(bc);
> List list = dc.getList("myList");
> // At this point, you'll get a single element list containing only "1"
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira