[
http://www.stripesframework.org/jira/browse/STS-789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ben Gunter resolved STS-789.
----------------------------
Resolution: Fixed
Fixed for 1.5.5. I decided not to try for backward compatibility by checking
for the presence of "''" in the message template. I think it's better just to
fix it fully and issue a warning about that with the release.
> SimpleMessage calling MessageFormat with replacement parameters when there
> are none
> -----------------------------------------------------------------------------------
>
> Key: STS-789
> URL: http://www.stripesframework.org/jira/browse/STS-789
> Project: Stripes
> Issue Type: Bug
> Components: Formatting
> Affects Versions: Release 1.5
> Reporter: Rick Grashel
> Assignee: Ben Gunter
> Fix For: Release 1.5.5, Release 1.6
>
> Attachments: diff.txt
>
>
> When using message bundles with <fmt:message> tags or using ordinary Java
> calls to get ResourceBundle messages, there is a very specific behavior with
> regards to single-quotes and replacement parameters.
> By default, if <fmt:message> is used without replacement parameters (
> <fmt:param> ), then the MessageFormat class is not used to render the
> message. This means that escaping of single-quotes (with two single-quotes)
> is not necessary for messages without replacement args. Here is the relevant
> excerpt of Apache's MessageSupport.java class (which is extended by the
> MessageTag):
> ...
> message = bundle.getString( key );
> // Perform parametric replacement if required
> if ( !params.isEmpty() )
> {
> Object[] messageArgs = params.toArray();
> MessageFormat formatter = new MessageFormat( "" ); // empty
> pattern, default Locale
> ...
> formatter.applyPattern( message );
> message = formatter.format( messageArgs );
> }
> ...
> The SimpleMessage in Stripes is always using the MessageFormat class to
> render messages. Because of this, there is a behavior inconsistency with
> regards to single-quotes. If you have a property declared in
> StripesResources as:
> my.property.key=This Is The User's Message
> The above property will be rendered as "This Is The User's Message" by
> <fmt:message>. However, SimpleMessage will render this message as "This Is
> The Users Message". SimpleMessage will strip out the single-quote. This is
> inconsistent behavior and means that quoted property messages cannot be
> re-used seamlessly between Stripes and regular JSTL <fmt> tags.
> The necessary fix is for SimpleMessage to only use MessageFormat for
> rendering messages if the replacementParameters passed into it have a length
> greater than zero.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development