DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17371>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17371

HtmlTag throws NPE when sessions are disabled and locale property is false

           Summary: HtmlTag throws NPE when sessions are disabled and locale
                    property is false
           Product: Struts
           Version: Nightly Build
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Custom Tags
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


If a page that uses <html:html locale="false"> (which is the default) also uses
<%@ page session="false" %>, HtmlTag will throw an NPE. The problem is with the
following code in the getCurrentLocale method:

HttpSession session = pageContext.getSession();
if (this.locale && (session == null)) {
  session = ((HttpServletRequest) this.pageContext.getRequest()).getSession();
}
Locale current = (Locale) session.getAttribute(Globals.LOCALE_KEY);

If this.locale is false and pageContext.getSession() returns null, then the
session variable will still be null when session.getAttribute is invoked.

It's also questionable whether HtmlTag should blindly be creating a session or
setting the Globals.LOCALE_KEY session attribute. This should be handled by
RequestProcessor.processLocale.

A patch will follow that has currentLocale and getCurrentLocale just call
RequestUtils.retrieveUserLocale.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to