[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3451) FacesMessages.createFacesMessageFromRessourceBundle interpolates twice the message (the first time being wrong)

Stephane Epardaud (JIRA) jira-events at lists.jboss.org
Tue Sep 23 08:00:20 EDT 2008


FacesMessages.createFacesMessageFromRessourceBundle interpolates twice the message (the first time being wrong)
---------------------------------------------------------------------------------------------------------------

                 Key: JBSEAM-3451
                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3451
             Project: Seam
          Issue Type: Bug
    Affects Versions: 2.0.1.GA
            Reporter: Stephane Epardaud


If I call FacesMessages.addMessageFromResourceBundle("key", 3) with in my resource bundle:

key={0,choice,0#foo|0<bar}

I get "3" instead of "bar".

This is because in FacesMessages.createFacesMessage(Severity severity, String key, String defaultMessageTemplate, Object... params) the message is gotten from the SeamResourceBundle with calls Interpolator.interpolate("{0,choice,0#foo|0<bar}") (with NO parameter), which returns "{0}" because of the lack of parameters.

Then later on in FacesMessages.createFacesMessage(Severity severity, String messageTemplate, Object... params) the expected interpolation happens again and calls Interpolator.interpolate("{0}", 3) which returns "3" naturally.

I really doubt this double interpolation of message formats is wanted. Suppose that the first interpolation of EL "#{foo}" would return a string like "#{bar}", the second interpolation would evaluate "#{bar}" even though this might not be the desired behaviour.

In any case double interpolation breaks MessageFormat formatting (which is supposed to be handled) and I'm not sure it is documented. If it is expected behaviour it is really not clear to me why someone would want that.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list