Author: adrianc
Date: Tue Apr 1 13:32:12 2014
New Revision: 1583663
URL:
http://svn.apache.org/r1583663Log:
Fix for quirky user-selected time zone behavior. Changing the time zone in one session did not update other sessions.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java?rev=1583663&r1=1583662&r2=1583663&view=diff==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java Tue Apr 1 13:32:12 2014
@@ -676,19 +676,22 @@ public class UtilHttp {
public static TimeZone getTimeZone(HttpServletRequest request) {
HttpSession session = request.getSession();
- TimeZone timeZone = (TimeZone) session.getAttribute("timeZone");
- if (timeZone == null) {
- String tzId = null;
- Map<String, String> userLogin = UtilGenerics.cast(session.getAttribute("userLogin"));
- if (userLogin != null) {
- tzId = userLogin.get("lastTimeZone");
+ TimeZone timeZone = null;
+ Map<String, String> userLogin = UtilGenerics.cast(session.getAttribute("userLogin"));
+ if (userLogin != null) {
+ String tzId = userLogin.get("lastTimeZone");
+ if (tzId != null) {
+ timeZone = TimeZone.getTimeZone(tzId);
}
- timeZone = UtilDateTime.toTimeZone(tzId);
- session.setAttribute("timeZone", timeZone);
}
+ if (timeZone == null) {
+ timeZone = TimeZone.getDefault();
+ }
+ session.setAttribute("timeZone", timeZone);
return timeZone;
}
+
/**
* Get the currency string from the session.
* @param session HttpSession object to use for lookup