commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Franck Valentin (JIRA)" <j...@apache.org>
Subject [jira] Created: (CONFIGURATION-283) CombinedConfiguration doesn't take escaped characters into account.
Date Mon, 02 Jul 2007 12:39:04 GMT
CombinedConfiguration doesn't take escaped characters into account.
-------------------------------------------------------------------

                 Key: CONFIGURATION-283
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-283
             Project: Commons Configuration
          Issue Type: Bug
    Affects Versions: 1.4
            Reporter: Franck Valentin


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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message