- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 17 May 2010 15:39:24 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action In directory hutz:/tmp/cvs-serv9101/src/org/w3c/unicorn/action Modified Files: LanguageAction.java Log Message: fixed: threw a NullPointerException if the client browser did not specify an Accept-Language header Index: LanguageAction.java =================================================================== RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/LanguageAction.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- LanguageAction.java 12 Apr 2010 14:10:03 -0000 1.26 +++ LanguageAction.java 17 May 2010 15:39:21 -0000 1.27 @@ -71,7 +71,10 @@ velocityContext.put("messages", messages); velocityContext.put("baseUri", "./"); velocityContext.put("availableLocales", Language.getAvailableLocales()); - velocityContext.put("native_lang", Language.getAvailableLocale(req.getHeader("Accept-Language")).getName()); + if (req.getHeader("Accept-Language") != null) + velocityContext.put("native_lang", Language.getAvailableLocale(req.getHeader("Accept-Language")).getName()); + else + velocityContext.put("native_lang", Language.getDefaultLocale().getName()); velocityContext.put("translator_name", req.getAttribute("translator_name")); velocityContext.put("translator_mail", req.getAttribute("translator_mail")); velocityContext.put("translator_comments", req.getAttribute("translator_comments"));
Received on Monday, 17 May 2010 15:39:25 UTC