Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-1254

facesmessages are not always fully interpolated

    Details

      Description

      Whenever "FacesMessages.createFacesMessage(Severity severity, String messageTemplate, Object... params)" is called, the message is fully interpolated. Meaning, it will resolve EL expressions inside of the message itself. When "FacesMessages.createFacesMessage(Severity severity, String key, String defaultMessageTemplate, Object... params)", it does not do this full EL expression resolution. The code changes below would probably support this.

      private static String interpolateBundleMessage(String key, String defaultMessageTemplate, Object... params)
      {
      String messageTemplate = defaultMessageTemplate;
      if ( key!=null )
      {
      java.util.ResourceBundle resourceBundle = ResourceBundle.instance();
      if ( resourceBundle!=null )
      {
      try

      { String bundleMessage = resourceBundle.getString(key); if (bundleMessage!=null) messageTemplate = bundleMessage; }

      catch (MissingResourceException mre) {} //swallow
      }
      }
      return Interpolator.instance().interpolate(messageTemplate, params);
      }

      public static FacesMessage createFacesMessage(Severity severity, String key, String defaultMessageTemplate, Object... params)
      {
      String message = interpolateBundleMessage(key, defaultMessageTemplate, params);
      if ( !Strings.isEmpty(message) )

      { return createFacesMessage( severity, message, null); }

      else

      { return null; }

      }

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                pmuir Pete Muir
                Reporter:
                knaas Keith Naas (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: