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

Emil Lundberg updated CONFIGURATION-605:
----------------------------------------
    Description: 
The following XML document:

{noformat}
StringBuilder sb = new StringBuilder("<configuration>");}}
sb.append("<test1>a,b,c</test1>");
sb.append("<test2>a</test2>");
sb.append("<test3></test3>");
 sb.append("<test4>a,b\\,b,c</test4>");
sb.append("</configuration>");
{noformat}

when passed into {{XMLConfiguration#load(Reader)}} and then to 
{{ConfigurationUtils#toString(Configuration)}}, comes out like this:

{noformat}
test1=[a, b, c]
test3=
test4=[a, b,b, c]
{noformat}

I'm assuming this is a bug.

I've found two workarounds to this:

 1. Inserting any character between the {{test1}} and {{test2}} tags, i.e. 
{{<test1>a,b,c</test1> <test2>a</test2>}}
 2. Calling {{setDelimiterParsingDisabled(true)}} on the XMLConfiguration 
before loading the document

For reproduction with a minimal example and some additional test cases, see 
[this GitHub 
repo|https://github.com/emlun/commons-xmlconfiguration-ignored-key/]. I also 
posted this as [a question on Stack 
Overflow|https://stackoverflow.com/questions/31516549] before posting here.


  was:
The following XML document:

{noformat}
StringBuilder sb = new StringBuilder("<configuration>");}}
sb.append("<test1>a,b,c</test1>");
sb.append("<test2>a</test2>");
sb.append("<test3></test3>");
 sb.append("<test4>a,b\\,b,c</test4>");
sb.append("</configuration>");
{noformat}

when passed into {{XMLConfiguration#load(Reader)}} and then to 
{{ConfigurationUtils#toString(Configuration)}}, comes out like this:

{noformat}
test1=[a, b, c]
test3=
test4=[a, b,b, c]
{noformat}

I'm assuming this is a bug.

I've found two workarounds to this:

 1. Inserting any character between the {{test1}} and {{test2}} tags, i.e. 
{{<test1>a,b,c</test1> <test2>a</test2>}}
 2. Calling {{setDelimiterParsingDisabled(true)}} on the XMLConfiguration 
before loading the document

For reproduction with a minimal example, see [this GitHub 
repo|https://github.com/emlun/commons-xmlconfiguration-ignored-key/]. I also 
posted this as [a question on Stack 
Overflow|https://stackoverflow.com/questions/31516549] before posting here.



> XMLConfiguration drops configuration key immediately following one whose 
> value contains a comma
> -----------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-605
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-605
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Format
>    Affects Versions: 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.10
>         Environment: $ uname -a
> Linux 4.1.2-2-ARCH #1 SMP PREEMPT Wed Jul 15 08:30:32 UTC 2015 x86_64 
> GNU/Linux
> $ java -version
> openjdk version "1.8.0_45"
> OpenJDK Runtime Environment (build 1.8.0_45-b14)
> OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)
>            Reporter: Emil Lundberg
>            Priority: Minor
>
> The following XML document:
> {noformat}
> StringBuilder sb = new StringBuilder("<configuration>");}}
> sb.append("<test1>a,b,c</test1>");
> sb.append("<test2>a</test2>");
> sb.append("<test3></test3>");
>  sb.append("<test4>a,b\\,b,c</test4>");
> sb.append("</configuration>");
> {noformat}
> when passed into {{XMLConfiguration#load(Reader)}} and then to 
> {{ConfigurationUtils#toString(Configuration)}}, comes out like this:
> {noformat}
> test1=[a, b, c]
> test3=
> test4=[a, b,b, c]
> {noformat}
> I'm assuming this is a bug.
> I've found two workarounds to this:
>  1. Inserting any character between the {{test1}} and {{test2}} tags, i.e. 
> {{<test1>a,b,c</test1> <test2>a</test2>}}
>  2. Calling {{setDelimiterParsingDisabled(true)}} on the XMLConfiguration 
> before loading the document
> For reproduction with a minimal example and some additional test cases, see 
> [this GitHub 
> repo|https://github.com/emlun/commons-xmlconfiguration-ignored-key/]. I also 
> posted this as [a question on Stack 
> Overflow|https://stackoverflow.com/questions/31516549] before posting here.



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

Reply via email to