You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Cédric Couralet (JIRA)" <ji...@apache.org> on 2014/05/27 08:44:01 UTC
[jira] [Created] (CONFIGURATION-580) Unexpected trimming when value
contains escaped delimiter
Cédric Couralet created CONFIGURATION-580:
---------------------------------------------
Summary: Unexpected trimming when value contains escaped delimiter
Key: CONFIGURATION-580
URL: https://issues.apache.org/jira/browse/CONFIGURATION-580
Project: Commons Configuration
Issue Type: Bug
Components: Type conversion
Affects Versions: 1.9, 1.10
Reporter: Cédric Couralet
Priority: Minor
When parsing a property string value containing a delimiter character,
the resulting String is trimmed.
See the following example :
{code:java}
BaseConfiguration conf = new BaseConfiguration();
conf.setProperty("test1", "test\r\n");
conf.setProperty("test2", "test\\,test");
conf.setProperty("test3", "test\\,test\r\n");
System.out.println("*" + conf.getString("test1") + "*");
System.out.println("*" + conf.getString("test2") + "*");
System.out.println("*" + conf.getString("test3") + "*");
{code}
Expected :
{noformat}
*test
*
*test,test*
*test,test
*
{noformat}
Actual:
{noformat}
*test
*
*test,test*
*test,test*
{noformat}
This is caused by the {{flatten}} method in {{PropertyConverter}} which calls {{split(value,delimiter)}} which results in
{{split(value,delimiter,true)}} causing the trimming.
There is a workaround by using the value from another property :
{noformat}
test1=test\,test
test2=${test1}\r\n
{noformat}
--
This message was sent by Atlassian JIRA
(v6.2#6252)