Author: adrianc
Date: Wed Aug 6 14:13:09 2008
New Revision: 683414
URL:
http://svn.apache.org/viewvc?rev=683414&view=revLog:
Minilang set-calendar improvement - supply default local and time zone when they aren't available.
There was a problem with the set-calendar operation when it was called from the job scheduler - a NPE was thrown. This commit fixes that.
Modified:
ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetCalendar.java
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetCalendar.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetCalendar.java?rev=683414&r1=683413&r2=683414&view=diff==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetCalendar.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetCalendar.java Wed Aug 6 14:13:09 2008
@@ -121,9 +121,15 @@
if (locale == null) {
locale = methodContext.getLocale();
}
+ if (locale == null) {
+ locale = Locale.getDefault();
+ }
if (timeZone == null) {
timeZone = methodContext.getTimeZone();
}
+ if (timeZone == null) {
+ timeZone = TimeZone.getDefault();
+ }
fromStamp = (Timestamp) ObjectType.simpleTypeConvert(newValue, "Timestamp", UtilDateTime.DATE_TIME_FORMAT, timeZone, locale, true);
} catch (Exception e) {
// Catching all exceptions - even potential ClassCastException