You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2007/10/06 09:15:13 UTC

svn commit: r582464 - /ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java

Author: jonesde
Date: Sat Oct  6 00:15:12 2007
New Revision: 582464

URL: http://svn.apache.org/viewvc?rev=582464&view=rev
Log:
Improved send message code to better handle errors and save off the send error status if that happens; closes hole where a message can be marked as sent but not actually successfully sent

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

Modified: ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java?rev=582464&r1=582463&r2=582464&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java Sat Oct  6 00:15:12 2007
@@ -932,6 +932,19 @@
             }
             
             Map sendMessageReturn = OagisServices.sendMessageText(outText, out, sendToUrl, saveToDirectory, saveToFilename);
+            if (sendMessageReturn != null && ServiceUtil.isError(sendMessageReturn)) {
+                try {
+                    Map uomiCtx = FastMap.newInstance();
+                    uomiCtx.putAll(omiPkMap);
+                    uomiCtx.put("processingStatusId", "OAGMP_SEND_ERROR");
+                    uomiCtx.put("userLogin", userLogin);
+                    dispatcher.runSync("updateOagisMessageInfo", uomiCtx, 60, true);
+                } catch (GenericServiceException e) {
+                    String errMsg = UtilProperties.getMessage(ServiceUtil.resource, "OagisErrorInCreatingDataForOagisMessageInfoEntity", (Locale) context.get("locale"));
+                    Debug.logError(e, errMsg, module);
+                }
+                return sendMessageReturn;
+            }
 
             if (Debug.infoOn()) Debug.logInfo("Message send done for oagisSendProcessShipment for orderId [" + orderId + "], sendToUrl=[" + sendToUrl + "], saveToDirectory=[" + saveToDirectory + "], saveToFilename=[" + saveToFilename + "]", module);
             try {
@@ -944,10 +957,6 @@
                 String errMsg = UtilProperties.getMessage(ServiceUtil.resource, "OagisErrorInCreatingDataForOagisMessageInfoEntity", (Locale) context.get("locale"));
                 Debug.logError(e, errMsg, module);
             }
-            
-            if (sendMessageReturn != null) {
-                return sendMessageReturn;
-            }
         } catch (Throwable t) {
             String errMsg = "System Error doing Process Shipment message for orderId [" + orderId + "] shipmentId [" + shipmentId + "] message [" + omiPkMap + "]: " + t.toString();
             Debug.logError(t, errMsg, module);
@@ -1172,6 +1181,19 @@
             }
 
             Map sendMessageReturn = OagisServices.sendMessageText(outText, out, sendToUrl, saveToDirectory, saveToFilename);
+            if (sendMessageReturn != null && ServiceUtil.isError(sendMessageReturn)) {
+                try {
+                    Map uomiCtx = FastMap.newInstance();
+                    uomiCtx.putAll(omiPkMap);
+                    uomiCtx.put("processingStatusId", "OAGMP_SEND_ERROR");
+                    uomiCtx.put("userLogin", userLogin);
+                    dispatcher.runSync("updateOagisMessageInfo", uomiCtx, 60, true);
+                } catch (GenericServiceException e) {
+                    String errMsg = UtilProperties.getMessage(ServiceUtil.resource, "OagisErrorInCreatingDataForOagisMessageInfoEntity", (Locale) context.get("locale"));
+                    Debug.logError(e, errMsg, module);
+                }
+                return sendMessageReturn;
+            }
 
             try {
                 Map uomiCtx = FastMap.newInstance();
@@ -1182,10 +1204,6 @@
             } catch (GenericServiceException e) {
                 String errMsg = UtilProperties.getMessage(ServiceUtil.resource, "OagisErrorInCreatingDataForOagisMessageInfoEntity", (Locale) context.get("locale"));
                 Debug.logError(e, errMsg, module);
-            }
-
-            if (sendMessageReturn != null) {
-                return sendMessageReturn;
             }
         } catch (Throwable t) {
             String errMsg = "System Error doing Receive Delivery message for returnId [" + returnId + "] orderId [" + orderId + "] message [" + omiPkMap + "]: " + t.toString();