]
Stephane Epardaud commented on JBSEAM-3451:
-------------------------------------------
Furthermore, by looking at Interpolator.interpolate() I wonder how I could produce a left
curly brace in my message. MessageFormat is pretty clear (although hard to understand) on
how to produce curly braces and how to quote them, but I don't see any such handling
in Interpolator.interpolate.
For instance I doubt that
Interpolator.interpolate("'''{0}'''") would produce
"{0}" rather than "'''{0}'''".
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: