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

CombinedConfiguration doesn't take escaped characters into account.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 1.5
    • Component/s: None
    • Labels:
      None

      Description

      Hi,

      I've tried to used CombinedConfiguration but it seems escaped characters are not taken into account :

      import org.apache.commons.configuration.CombinedConfiguration;
      import org.apache.commons.configuration.ConfigurationException;
      import org.apache.commons.configuration.PropertiesConfiguration;

      import junit.framework.TestCase;

      public class TestProp extends TestCase {

      public void testprop() throws ConfigurationException

      { // test.properties contains : // without_escape=aa,bb // with_escape=aa\,bb // with_2escapes=aa\\,bb String prop_filename = "c:\\tmp\\test.properties"; PropertiesConfiguration properties_config = new PropertiesConfiguration(prop_filename); CombinedConfiguration combined_config = new CombinedConfiguration(); combined_config.addConfiguration(properties_config); System.out.println("Properties config"); System.out.println(properties_config.getString("without_escape")); System.out.println(properties_config.getString("with_escape")); System.out.println(properties_config.getString("with_2escapes")); System.out.println("\nCombined config"); System.out.println(combined_config.getString("without_escape")); System.out.println(combined_config.getString("with_escape")); System.out.println(combined_config.getString("with_2escapes")); }

      }

      Result :
      ---------
      Properties config
      aa
      aa,bb
      aa,bb

      Combined config
      aa
      aa
      aa

      Thanks !
      Franck

        Attachments

          Activity

            People

            • Assignee:
              oheger Oliver Heger
              Reporter:
              franckv Franck Valentin
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: