details:   /erp/devel/pi/rev/f351257d12c3
changeset: 12296:f351257d12c3
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Fri May 20 12:31:11 2011 +0200
summary:   Solve failing build, Related to issue 17264: When exporting a 
dataset in OB3, date fields are not correct.

diffstat:

 src/org/openbravo/base/model/domaintype/DateDomainType.java |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r fb6bad1388c8 -r f351257d12c3 
src/org/openbravo/base/model/domaintype/DateDomainType.java
--- a/src/org/openbravo/base/model/domaintype/DateDomainType.java       Thu May 
19 12:47:24 2011 +0200
+++ b/src/org/openbravo/base/model/domaintype/DateDomainType.java       Fri May 
20 12:31:11 2011 +0200
@@ -33,8 +33,11 @@
 
   private final SimpleDateFormat xmlDateFormat = new 
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'");
 
+  private final SimpleDateFormat previousXmlDateFormat = new 
SimpleDateFormat("yyyy-MM-dd");
+
   public DateDomainType() {
     xmlDateFormat.setLenient(true);
+    previousXmlDateFormat.setLenient(true);
   }
 
   /**
@@ -58,7 +61,11 @@
       if (strValue == null || strValue.trim().length() == 0) {
         return null;
       }
-      return xmlDateFormat.parse(strValue);
+      if (strValue.contains("T")) {
+        return xmlDateFormat.parse(strValue);
+      } else {
+        return previousXmlDateFormat.parseObject(strValue);
+      }
     } catch (ParseException e) {
       throw new IllegalArgumentException(e);
     }

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to