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

Jason Pickens updated CONFIGURATION-750:
----------------------------------------
    Description: 
This is the same as CONFIGURATION-427 except that it applies to {{setProperty}} 
which was missed in the original fix.
{code:java}
final FileBasedConfigurationBuilder<FileBasedConfiguration> builder =
        new FileBasedConfigurationBuilder<>(XMLPropertyListConfiguration.class);
final FileBasedConfiguration configuration = builder.getConfiguration();
configuration.setProperty("things", ['chair', 'hat', 'door']);
final FileHandler fileHandler = new FileHandler(configuration);
fileHandler.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}

  was:
This is the same as CONFIGURATION-427 except that it applies to {{setProperty}} 
which was missed in the original fix.
{code:java}
groovy> import org.apache.commons.configuration.plist.* 
groovy> def config = new XMLPropertyListConfiguration() 
groovy> config.setProperty("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}


> XMLPropertyListConfiguration cannot set arrays in the correct plist form
> ------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-750
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-750
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Format
>    Affects Versions: 2.5
>         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: Jason Pickens
>            Assignee: Emmanuel Bourg
>            Priority: Minor
>
> This is the same as CONFIGURATION-427 except that it applies to 
> {{setProperty}} which was missed in the original fix.
> {code:java}
> final FileBasedConfigurationBuilder<FileBasedConfiguration> builder =
>         new 
> FileBasedConfigurationBuilder<>(XMLPropertyListConfiguration.class);
> final FileBasedConfiguration configuration = builder.getConfiguration();
> configuration.setProperty("things", ['chair', 'hat', 'door']);
> final FileHandler fileHandler = new FileHandler(configuration);
> fileHandler.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
(v7.6.3#76005)

Reply via email to