You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Oliver Heger (JIRA)" <ji...@apache.org> on 2011/04/29 21:50:03 UTC

[jira] [Resolved] (CONFIGURATION-449) Advanced Java MessageFormat patterns not respected

     [ https://issues.apache.org/jira/browse/CONFIGURATION-449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Heger resolved CONFIGURATION-449.
----------------------------------------

    Resolution: Invalid

This is the default list handling behavior of Commons Configuration. A description (and a possible solution for your problem) can be found here: http://commons.apache.org/configuration/userguide/howto_basicfeatures.html#List_handling


> Advanced Java MessageFormat patterns not respected
> --------------------------------------------------
>
>                 Key: CONFIGURATION-449
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-449
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.6
>            Reporter: Maxx
>             Fix For: 1.7
>
>
> Hi,
> I'm using a standard Java properties file, containing this :
> my.label = Year {0,date,yyyy}
> The problem I encountered is that this pattern (*) is truncated while loading it with Apache Commons Configuration:
> (service code)
>        // confPath being the path to an .xml file containing all the .properties file paths
>        ConfigurationFactory configurationFactory = new ConfigurationFactory(confPath);
>        configurationFactory.setBasePath(getApplicationRoot());
>        configuration = configurationFactory.getConfiguration();
> (client code)
>         String labelPattern = configuration.getString("my.label");
> I have labelPattern = Year {0
> which ended in the MessageFormat with a java.lang.IllegalArgumentException: Unmatched braces in the pattern.
> So I have to escape the commas in my pattern with a single backslash (here I had to enter two, because one backslash isn't displayed):
> my.label = Year {0\\,date\\,yyyy}
> Don't understand why..?!
> (*) see http://download.oracle.com/javase/6/docs/api/java/text/MessageFormat.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira