You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/02/25 14:29:10 UTC
DO NOT REPLY [Bug 17371] New: -
HtmlTag throws NPE when sessions are disabled and locale property is false
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: struts-dev@jakarta.apache.org
ReportedBy: kris@dotech.com
CC: kris@dotech.com
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: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org