DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27775>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27775

Configuration: Comma-escaping in PropertiesConfiguration broken

           Summary: Configuration: Comma-escaping in PropertiesConfiguration
                    broken
           Product: Commons
           Version: Nightly Builds
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Configuration
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


According to the PropertiesConfiguration docs, multiple items are separated by
commas, and commas within a single item are escaped with a (single) backslash.
So a property "first item, second\,item" should contain two elements: "first
item" and "second,item". In the current version this doesn't work any more;
instead *two backslashes* are required to escape a comma.

Here is a test case for reproducing this bug:


# Store this in a text file test.properties:
test = first item, second\,item
testdouble = first item, second\\,item


// Execute this code to reproduce the bug:
org.apache.commons.configuration.PropertiesConfiguration pc =
new org.apache.commons.configuration.PropertiesConfiguration();
pc.load(new java.io.FileInputStream("test.properties"));

// should return "2" and "second,item" but returns "3" and "second" instead
System.out.println(pc.getList("test").size());
System.out.println(pc.getList("test").get(1));

System.out.println(pc.getList("testdouble").size());
System.out.println(pc.getList("testdouble").get(1));


This behavior was tested against the latest nightly build (20040317).

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to