commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Heger (JIRA)" <>
Subject [jira] [Commented] (CONFIGURATION-605) XMLConfiguration drops configuration key immediately following one whose value contains a comma
Date Sat, 25 Jul 2015 19:00:04 GMT


Oliver Heger commented on CONFIGURATION-605:

With the help of your test project (thanks again very much) I was able to figure out what
is going wrong: The problem was in the {{handleDelimiters()}} method of {{XMLConfiguration}}.
Here nodes with multiple values are handled in a special way. The node with the first value
is removed from the parent node, then for each value a new node is added. Removing of the
first node caused the bug because this operation also affected the DOM currently processed.

In Configuration 2.0 the code has been reworked. List delimiter parsing and management of
references to DOM elements are now handled in a different way. I adapted your unit test for
the new version and committed it. It runs successfully showing that the issue does no longer
exist. So can we mark this issue as resolved in version 2.0?

> XMLConfiguration drops configuration key immediately following one whose value contains
a comma
> -----------------------------------------------------------------------------------------------
>                 Key: CONFIGURATION-605
>                 URL:
>             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>
>  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|]. I also posted this as
[a question on Stack Overflow|] before posting

This message was sent by Atlassian JIRA

View raw message