svn commit: r560137 - /ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r560137 - /ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java

apatel-2
Author: apatel
Date: Fri Jul 27 01:23:19 2007
New Revision: 560137

URL: http://svn.apache.org/viewvc?view=rev&rev=560137
Log:
improvements to how date is parsed.

Modified:
    ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java

Modified: ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java?view=diff&rev=560137&r1=560136&r2=560137
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java Fri Jul 27 01:23:19 2007
@@ -137,20 +137,27 @@
                     statusId = "INV_ON_HOLD";
                 }
                 
-                String snapshotDateStr = UtilXml.childElementValue(inventoryElement, "os:DATETIMEISO");
-
-                // In BOD the timestamp come in the format "yyyy-MM-dd'T'HH:mm:ss.SSSS'Z'Z"
-                // Parse this into a valid Timestamp Object
-                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSS'Z'Z");
-                Timestamp snapshotDate = null;
-                try {        
-                    snapshotDate = new Timestamp(sdf.parse(snapshotDateStr).getTime());
-                } catch (ParseException e) {
-                    String errMsg = "Error parsing Date: " + e.toString();
-                    errorMapList.add(UtilMisc.toMap("reasonCode", "ParseException", "description", errMsg));
-                    Debug.logError(e, errMsg, module);
+                String snapshotDateStr = UtilXml.childElementValue(inventoryElement, "os:DATETIMEISO");  
+                //Parse this into a valid Timestamp Object
+                Date dateTimeInvReceived = null;
+                Timestamp snapshotDate = null;      
+                try{
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSS'Z'Z");
+                    dateTimeInvReceived = sdf.parse(snapshotDateStr);
+                }catch(ParseException e){
+                    Debug.logInfo("Message does not have timezone information in date field", module);
+                    try{
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSS'Z'");
+                        dateTimeInvReceived = sdf.parse(snapshotDateStr);
+                    }catch(ParseException e1){
+                        String errMsg = "Error parsing Date: " + e1.toString();
+                        errorMapList.add(UtilMisc.toMap("reasonCode", "ParseException", "description", errMsg));
+                        Debug.logError(e, errMsg, module);
+                    }
+                }
+                if(dateTimeInvReceived !=null){
+                    snapshotDate = new Timestamp( dateTimeInvReceived.getTime() );
                 }
-
                 // get quantity on hand diff  
                 double quantityOnHandTotal = 0.0;