You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Oliver Heger (JIRA)" <ji...@apache.org> on 2014/10/09 21:47:34 UTC
[jira] [Updated] (CONFIGURATION-427) XMLPropertyListConfiguration
cannot save arrays in the correct plist form
[ https://issues.apache.org/jira/browse/CONFIGURATION-427?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oliver Heger updated CONFIGURATION-427:
---------------------------------------
Attachment: configuration-427-2.patch
Based on your proposal, I have created a patch. It also checks whether the object to be added is a list. In addition, it checks for arrays and converts them to lists. Please double-check whether this solves the original issue.
The problem I see with this approach and the way {{XMLPropertyListConfiguration}} is implemented is that the internal data representation used by this class differs from the way other hierarchical configuration implementations store their data. For instance, a list structure is stored in a single node with a value of type {{List}}; other configurations use multiple nodes for the single values of the list. So the enhanced query facilities offered by hierarchical configurations do not work well here.
It would probably be a better solution to store the data in the "native" representation used by hierarchical configurations and to convert to PList-specific structures when saving to disk. But this is probably not trivial to implement.
> XMLPropertyListConfiguration cannot save arrays in the correct plist form
> -------------------------------------------------------------------------
>
> Key: CONFIGURATION-427
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-427
> Project: Commons Configuration
> Issue Type: Bug
> Components: Format
> Affects Versions: 1.6
> Environment: should show up in any environment, as the test cases are disabled for arrays and maps:
> http://commons.apache.org/configuration/xref-test/org/apache/commons/configuration/plist/TestXMLPropertyListConfiguration.html#199
> I was testing 1.6 using groovy console under Mac OS X 10.6
> Reporter: matthew smith
> Assignee: Emmanuel Bourg
> Priority: Minor
> Attachments: configuration-427-2.patch, configuration-427.patch
>
>
> {code:java}
> groovy> import org.apache.commons.configuration.plist.*
> groovy> def config = new XMLPropertyListConfiguration()
> groovy> config.addProperty("things", ['chair', 'hat', 'door'])
> groovy> config.save(System.out)
> {code}
> results in
>
> {code:xml}
> <?xml version="1.0"?>
> <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
> <plist version="1.0">
> <dict>
> <key>things</key>
> <string>chair</string>
> <key>things</key>
> <string>hat</string>
> <key>things</key>
> <string>door</string>
> </dict>
> </plist>
> {code}
> expecting
> {code:xml}
> <?xml version="1.0"?>
> <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
> <plist version="1.0">
> <dict>
> <key>things</key>
> <array>
> <string>chair</string>
> <string>hat</string>
> <string>door</string>
> </array>
> </dict>
> </plist>
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)