dgraham 2003/02/24 19:27:40 Modified: src/share/org/apache/struts/util RequestUtils.java Log: Fixed PR# 17312 (retrieveUserLocale throws exception without sessions). Revision Changes Path 1.87 +19 -7 jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java Index: RequestUtils.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v retrieving revision 1.86 retrieving revision 1.87 diff -u -r1.86 -r1.87 --- RequestUtils.java 8 Feb 2003 23:34:37 -0000 1.86 +++ RequestUtils.java 25 Feb 2003 03:27:40 -0000 1.87 @@ -873,11 +873,23 @@ * @return current user locale */ public static Locale retrieveUserLocale(PageContext pageContext, String locale) { - if (locale == null) + Locale userLocale = null; + HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); + HttpSession session = request.getSession(false); + + if (locale == null) { locale = Globals.LOCALE_KEY; - Locale userLocale = (Locale) pageContext.getAttribute(locale, PageContext.SESSION_SCOPE); - if (userLocale == null) + } + + // Only check session if sessions are enabled + if (session != null) { + userLocale = (Locale) pageContext.getAttribute(locale, PageContext.SESSION_SCOPE); + } + + if (userLocale == null) { userLocale = defaultLocale; + } + return userLocale; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]