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

[configuration] PropertiesConfiguration doesn't handle trailing backslashes properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Nightly Builds
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 35119

    Description

      When a .properties file is parsed, we only look at the last character to check
      if the value is spread over several lines, but this is not sufficient. As
      specified by the javadoc for java.util.Properties:

      "Note that it is not sufficient to only examine the character preceding a line
      terminator sequence to see if the line terminator is escaped; there must be an
      odd number of contiguous backslashes for the line terminator to be escaped.
      Since the input is processed from left to right, a non-zero even number of 2n
      contiguous backslashes before a line terminator (or elsewhere) encodes n
      backslashes after escape processing."

      Currently this file:

      key1=abc
      key2=xyz

      is parsed as a file containing a single property:

      key1 -> abc\key2=xyz

      It should be parsed as a configuration containing two properties:

      key1 -> abc\
      key2 -> xyz

      Attachments

        Activity

          People

            Unassigned Unassigned
            ebourg Emmanuel Bourg
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: