Sabine Schwanitz wrote:
Oliver Heger schrieb:

Hi Oliver,

thanks for responding.
I was already thinking about disabling the mode in the configuration file, unfortunately that does not work:
Here is my complete
config-file:
<properties fileName="ShopMessageResources.properties" delimiterParsingDisabled="true"/>

This is the right way to disable the delimiter parsing. If this does not work for you, this may be due to a bug that was reported against version 1.4 [1] and has been fixed in the mean time. So you might give a recent snapshot a try or build from subversion [2].

Oliver

[1] http://issues.apache.org/jira/browse/CONFIGURATION-283
[2] http://commons.apache.org/configuration/cvs-usage.html

code:

public void testDelimiterDisabled() throws Exception {

Configuration config = ShopPropertiesConfiguration.getShopConfiguration();
       String contents = config.getString("contact.instructions");
String expected = "Hier haben Sie die Möglichkeit, sich mit uns in Verbindung zu setzen."; System.out.println(contents); // this brings "Hier haben Sie die Möglichkeit"
       assertNotNull(contents);
       assertEquals(expected, contents);

}

ShopPropertiesConfiguration:
private static final String shopConfigName = "shop-config.xml";
private static Configuration configuration;

public static Configuration getShopConfiguration() throws Exception {

       if (configuration == null) {
DefaultConfigurationBuilder shopBuilder = new DefaultConfigurationBuilder(
               shopConfigName);

           configuration = shopBuilder.getConfiguration();
       }
       return configuration;
   }
}

The only workaround i found now, is using a very rare used unicode as delimiter before loading configurations

Sabine
Sabine,

setting the delimiter parsing disabled flag on the DefaultConfigurationBuilder does not affect the loaded configurations, but only the builder itself. You can disable this mode for the sub configurations in the configuration definition file for each single configuration, e.g.:

<properties filename="test.properties" delimiterParsingDisabled="true"/>

HTH
Oliver




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

Reply via email to