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 2016/10/07 20:09:20 UTC

[jira] [Resolved] (CONFIGURATION-640) Colon in properties file value no longer unescaped in commons configuration 2

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

Oliver Heger resolved CONFIGURATION-640.
----------------------------------------
       Resolution: Fixed
    Fix Version/s: 2.2

A fix has been applied in revision 1763821.

In Configuration 1.x, unescaping was done for all characters except for the list delimiter character. This was changed for Configuration 2.x because here the list delimiter character is not known to the configuration, but is managed by the ListDelimiterHandler. As a side-effect, the unescaping got lost.

The fix now adds a special handling for a number of characters that are listed in the Javadocs of the _Properties.store()_ method to be always escaped:
http://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#store-java.io.Writer-java.lang.String-

> Colon in properties file value no longer unescaped in commons configuration 2
> -----------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-640
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-640
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 2.1
>            Reporter: Tom Byttebier
>            Priority: Minor
>             Fix For: 2.2
>
>
> A properties file create with java escape a colon in for example a path like 
> C:\test as {noformat}C\:\\test{noformat}
> When reading this property value in commons configuration the colon is unescaped, C:\test
> When reading the property value in commons configuration 2 the colon is no longer unescaped, C\:\test.
> Snipped of the code I used for reading the property
> {code}
> final ConfigurationBuilder<PropertiesConfiguration> builder =                            new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class).configure(new Parameters().properties().setFile(path.toFile());
> final PropertiesConfiguration propertiesConfiguration = builder.getConfiguration();
> Assert.assertEquals("C:\\test", propertiesConfiguration.getString("test2"));
> {code}
> I've read this [section|http://commons.apache.org/proper/commons-configuration/userguide_v1.10/howto_properties.html#Special_Characters_and_Escaping] so I'm aware of the changes to escaping, but I'm not sure how the escaping of the colon fits into this and if there is a way around this.



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