Author: jaz
Date: Thu Apr 7 19:27:53 2011
New Revision: 1089946
URL:
http://svn.apache.org/viewvc?rev=1089946&view=revLog:
added fall back to default date formatter when conversion fails before
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java?rev=1089946&r1=1089945&r2=1089946&view=diff==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java Thu Apr 7 19:27:53 2011
@@ -522,7 +522,16 @@ public class DateTimeConverters implemen
try {
return new java.sql.Timestamp(df.parse(str).getTime());
} catch (ParseException e) {
- throw new ConversionException(e);
+ // before throwing an exception, try a generic format first
+ df = DateFormat.getDateTimeInstance();
+ if (timeZone != null) {
+ df.setTimeZone(timeZone);
+ }
+ try {
+ return new java.sql.Timestamp(df.parse(str).getTime());
+ } catch (ParseException e2) {
+ throw new ConversionException(e);
+ }
}
}
}