Emil Lundberg created CONFIGURATION-605:
-------------------------------------------
Summary: 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.9, 1.8, 1.7, 1.6, 1.5, 1.4, 1.3, 1.10
Environment: $ uname -a
Linux <hostname> 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:
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>");
when passed into [`XMLConfiguration#load(Reader)`][commons-doc-xml] and then to
[`ConfigurationUtils#toString`][commons-doc-utils], comes out like this:
test1=[a, b, c]
test3=
test4=[a, b,b, c]
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][github]. I also
posted this as [a question on Stack Overflow][stack-overflow] before posting
here.
[commons-doc-xml]:
https://commons.apache.org/proper/commons-configuration/javadocs/v1.10/apidocs/org/apache/commons/configuration/XMLConfiguration.html#load(java.io.Reader)
[commons-doc-utils]:
https://commons.apache.org/proper/commons-configuration/javadocs/v1.10/apidocs/index.html?org/apache/commons/configuration/ConfigurationUtils.html
[github]: https://github.com/emlun/commons-xmlconfiguration-ignored-key/
[stack-overflow]:
https://stackoverflow.com/questions/31516549/why-does-xmlconfiguration-ignore-the-configuration-key-immediately-following-one
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)