Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-605

XMLConfiguration drops configuration key immediately following one whose value contains a comma

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.10
    • 2.0
    • Format
    • None

    Description

      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) and then to ConfigurationUtils#toString(Configuration), 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 and some additional test cases, see this GitHub repo. I also posted this as a question on Stack Overflow before posting here.

      Attachments

        Activity

          People

            Unassigned Unassigned
            emlun Emil Lundberg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: