[Yanel-dev] weird locale-related exceptions

Michael Wechner michael.wechner at wyona.com
Fri Mar 23 17:42:12 CET 2007


Paloma Gomez wrote:

> Michael Wechner escribió:
>
>> Josias Thöny wrote:
>>
>>> Paloma Gomez wrote:
>>> [...]
>>>
>>>>
>>>> I think we should  prevent this exception from being thrown by 
>>>> checking if the requested locale is available and otherwise 
>>>> requesting the default one (en). WDYT? I'll go on looking into a 
>>>> possible solution for this problem ( I have to familiarise myself 
>>>> with the I18nTransformer2 first).
>>>
>>>
>>>
>>> Yes, I think the I18nTransformer* should do some kind of fallback to 
>>> "en" if the requested language does not exist, instead of throwing 
>>> an exception.
>>
>>
>>
>> I think we should make the default language configurable ;-)
>
>
> Should it be configurable per realm?


yes, I think so.

Cheers

Michi

>
> Regards,
> Paloma
>
>>
>> Cheers
>>
>> Michael
>>
>>> It may be necessary to implement that like so:
>>>
>>> try {
>>>     currentLocale = new Locale(language);
>>>     messageBundle = ResourceBundle.getBundle(messages, currentLocale);
>>> } catch (MissingResourceException e) {
>>>     currentLocale = new Locale("en");
>>>     messageBundle = ResourceBundle.getBundle(messages, currentLocale);
>>> }
>>>
>>> because I don't know any way to check the existence of a 
>>> ResourceBundle.
>>> I'm not sure, but I guess both the I18nTransformer and the 
>>> I18nTransformer2 should be fixed.
>>> It would be great if you could take a look into that, because 
>>> apparently you're the only one who encounters this problem.
>>>
>>> thanks,
>>> josias
>>>
>>>>
>>>> Regards,
>>>>
>>>> Paloma
>>>>
>>>>>
>>>>>
>>>>>>
>>>>>> Have a nice weekend,
>>>>>>
>>>>>> Paloma
>>>>>>
>>>>>> ---------------------------------------------------------------------------------------------------------------------- 
>>>>>>
>>>>>>
>>>>>> 11075 2007-03-16 17:55:37,707 [http-8080-Processor25] ERROR 
>>>>>> org.wyona.yanel.servlet.YanelServlet.setYanelOutput():1638  - 
>>>>>> Can't find bundle for base name global, locale es
>>>>>> java.util.MissingResourceException: Can't find bundle for base 
>>>>>> name global, locale es
>>>>>>    at 
>>>>>> java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:836) 
>>>>>>
>>>>>>    at 
>>>>>> java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:805)
>>>>>>   [...]
>>>>>> 11078 2007-03-16 17:55:37,710 [http-8080-Processor25] ERROR 
>>>>>> org.wyona.yanel.servlet.YanelServlet.doGet():240  - Can't find 
>>>>>> bundle for base name global, locale es
>>>>>> javax.servlet.ServletException: Can't find bundle for base name 
>>>>>> global, locale es
>>>>>>    at 
>>>>>> org.wyona.yanel.servlet.YanelServlet.setYanelOutput(YanelServlet.java:1639) 
>>>>>>
>>>>>>    at 
>>>>>> org.wyona.yanel.servlet.YanelServlet.getContent(YanelServlet.java:538) 
>>>>>>
>>>>>>    at 
>>>>>> org.wyona.yanel.servlet.YanelServlet.doGet(YanelServlet.java:237)
>>>>>>    at 
>>>>>> org.wyona.yanel.servlet.YanelServlet.service(YanelServlet.java:180)
>>>>>>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>>>>>>    at 
>>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) 
>>>>>>
>>>>>>    at 
>>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) 
>>>>>>
>>>>>>    [...]
>>>>>> 11083 2007-03-16 17:55:37,715 [http-8080-Processor25] ERROR 
>>>>>> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/yanel].[YanelServlet].invoke():253  
>>>>>> - Servlet.service() para servlet YanelServlet lanzó excepción
>>>>>> javax.servlet.ServletException: Can't find bundle for base name 
>>>>>> global, locale es
>>>>>>    at 
>>>>>> org.wyona.yanel.servlet.YanelServlet.setYanelOutput(YanelServlet.java:1639) 
>>>>>>
>>>>>>    at 
>>>>>> org.wyona.yanel.servlet.YanelServlet.getContent(YanelServlet.java:538) 
>>>>>>
>>>>>>    at 
>>>>>> org.wyona.yanel.servlet.YanelServlet.doGet(YanelServlet.java:237)
>>>>>>    at 
>>>>>> org.wyona.yanel.servlet.YanelServlet.service(YanelServlet.java:180)
>>>>>>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>>>>>>    at 
>>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) 
>>>>>>
>>>>>> [...]
>>>>>> --------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Yanel-development mailing list
>>>>>> Yanel-development at wyona.com
>>>>>> http://wyona.com/cgi-bin/mailman/listinfo/yanel-development
>>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Yanel-development mailing list
>>>>> Yanel-development at wyona.com
>>>>> http://wyona.com/cgi-bin/mailman/listinfo/yanel-development
>>>>>
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Yanel-development mailing list
>>>> Yanel-development at wyona.com
>>>> http://wyona.com/cgi-bin/mailman/listinfo/yanel-development
>>>>
>>>
>>>
>>> _______________________________________________
>>> Yanel-development mailing list
>>> Yanel-development at wyona.com
>>> http://wyona.com/cgi-bin/mailman/listinfo/yanel-development
>>>
>>
>>
>
>
> _______________________________________________
> Yanel-development mailing list
> Yanel-development at wyona.com
> http://wyona.com/cgi-bin/mailman/listinfo/yanel-development
>


-- 
Michael Wechner
Wyona      -   Open Source Content Management   -    Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner at wyona.com                        michi at apache.org
+41 44 272 91 61




More information about the Yanel-development mailing list