[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-4401) Component locale-config (org.jboss.seam.international.localeConfig) does not set the locale things in JSF context if JSF is not initialized before Seam

Denis Forveille (JIRA) jira-events at lists.jboss.org
Wed Sep 2 15:58:23 EDT 2009


Component locale-config (org.jboss.seam.international.localeConfig) does not set the locale things in JSF context if JSF is not initialized before Seam
-------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: JBSEAM-4401
                 URL: https://jira.jboss.org/jira/browse/JBSEAM-4401
             Project: Seam
          Issue Type: Bug
    Affects Versions: 2.2.0.GA, 2.2.1.CR1
         Environment: WebSphere v7.0.0.5 (That is bundled with JSF-RI 1.2_07+)
            Reporter: Denis Forveille


Using the localeConfig component by declaring <international:locale-config default-locale="fr" supported-locales="fr en" /> in component.xml does not work as-is.

It works if JSF is initialized BEFORE Seam by adding  the lines
  <listener><listener-class>com.sun.faces.config.ConfigureListener</listener-class></listener>
before 
  <listener><listener-class>org.jboss.seam.servlet.SeamListener</listener-class></listener>
in web.xml

If the JSF listener is not there, JSF is not initialized when Seam bootstraps its application scope components, and so the faces application context is not available

In the case of the localeConfig component, line 136 of org.jboss.seam.international.LocaleConfig throws an IllegalStateException that is silently swallowed (!) when JSF is not initialized
Doing so the the default locales and supported locales are not defined to JSF thanks to the test in line 58.

IMHO, at a minimum this should be stated in the doc that the component works only if JSF is initialized before seam, or somehting should be changed in the code to set the JSF locale things when JSF application context is initialized

org.jboss.seam.international.LocaleConfig  lines around 136:
   private Application getApplication()
   {
      try
      {
         ApplicationFactory factory = (ApplicationFactory) FactoryFinder
            .getFactory(FactoryFinder.APPLICATION_FACTORY);
         return factory.getApplication();
      }
      catch (IllegalStateException e)
      {
         // just in case, for units and the like
         // if we can't do it, it just wan't meant to be
         return null;
      }
   }

around line 58:
   @Create
   public void initLocaleConfig()
   {
      Application application = getApplication();
      if (application == null)
      {
         return;
      }
 



-- 
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