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 put my pattern as:

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

Reply via email to