[Yanel-dev] weird locale-related exceptions

Josias Thöny josias.thoeny at wyona.com
Wed Mar 21 13:58:27 CET 2007


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




More information about the Yanel-development mailing list