[seam-issues] [JBoss JIRA] Resolved: (SEAMINTL-44) BundleTemplateMessage breaks with non-String ResourceBundles

Ken Finnigan (JIRA) jira-events at lists.jboss.org
Mon Aug 15 20:45:02 EDT 2011

     [ https://issues.jboss.org/browse/SEAMINTL-44?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ken Finnigan resolved SEAMINTL-44.

    Resolution: Rejected

After thinking there was a simple solution, changing the return type to Object would significantly break the existing use case of BundleTemplateMessages which is message processing.

If you require a pure label from a resource bundle, as opposed to a message with severity, etc, then please use the Bundles class

> BundleTemplateMessage breaks with non-String ResourceBundles
> ------------------------------------------------------------
>                 Key: SEAMINTL-44
>                 URL: https://issues.jboss.org/browse/SEAMINTL-44
>             Project: Seam International
>          Issue Type: Bug
>          Components: Messages
>    Affects Versions: 3.0.0.Final
>            Reporter: Nicklas Karlsson
>            Assignee: Ken Finnigan
>             Fix For: 3.1.0.Beta1
>   Original Estimate: 6 hours
>  Remaining Estimate: 6 hours
> BundleTemplateMessages has in build()
> {code}
>         try {
>             text = bundles.get(clientLocale, textKey.getBundle()).getString(textKey.getKey());
>         } catch (Exception e) {
>             log.warn("Could not load bundle: " + textKey);
>             text = textDefault;
>         }
> {code}
> which will result in a ClassCastException if the resource is non-string (because ResourceBundle.getString implementation casts getObject to String) and is further translated to a "Could not load bundle" warning followed by the BundleKey being outputted. 
> Since ResourceBundle.getString is final, there is no way of overloading this behaviour. Using toString on a non-null resource would give some flexibility to this, perhaps.

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


More information about the seam-issues mailing list