commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johan Maasing (JIRA)" <>
Subject [jira] [Created] (CONFIGURATION-516) escapes double qoutes " unecessary
Date Tue, 20 Nov 2012 15:44:58 GMT
Johan Maasing created CONFIGURATION-516:

             Summary: escapes double qoutes " unecessary
                 Key: CONFIGURATION-516
             Project: Commons Configuration
          Issue Type: Bug
    Affects Versions: 1.9
            Reporter: Johan Maasing
            Priority: Minor

Add a property with a value containing " (double quote character) and saving it back to file
will result in the value being modified and unecessary escaping of the quote character.

The reason is that PropertiesConfig calls into the StringEscapeUtils#escapeJavaStyleString
that escapes quotes. This is not correct for propertiesfiles.
says "Escapes are not necessary for single and double quotes"

Here is a test case:

public void shouldNotEscapeQuotesInTheResult() throws ConfigurationException, IOException
    final String value = "\"${TEST_TEMP_DIR}\"";
    PropertiesConfiguration testConfig = new PropertiesConfiguration();
    testConfig.addProperty("testKey1", value);
    File testFile = new File(tempTestDir.getPath() + "\\"); ;
    String testFileContent = FileUtils.readFileToString(testFile);

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message