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

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

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

jonesde
Author: jonesde
Date: Fri Aug  3 14:37:12 2007
New Revision: 562591

URL: http://svn.apache.org/viewvc?view=rev&rev=562591
Log:
Added code to handle bad shipmentIds coming in and return an error message instead of an NPE for the Show Shipment incoming message

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?view=diff&rev=562591&r1=562590&r2=562591
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java Fri Aug  3 14:37:12 2007
@@ -115,7 +115,7 @@
         String confirmation = UtilXml.childElementValue(senderElement, "of:CONFIRMATION"); // of
         String authId = UtilXml.childElementValue(senderElement, "of:AUTHID"); // of
 
-        Map result = new HashMap();
+        Map result = FastMap.newInstance();
         result.put("logicalId", logicalId);
         result.put("component", component);
         result.put("task", task);
@@ -163,13 +163,22 @@
         try {
             shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
         } catch (GenericEntityException e) {
-            String errMsg = "Error Shipment from database: "+ e.toString();
+            String errMsg = "Error getting Shipment from database: "+ e.toString();
+            Debug.logInfo(e, errMsg, module);
             errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericEntityException"));
-            Debug.logInfo(e, module);
-            result.putAll(ServiceUtil.returnError(errMsg));
+        }
+        
+        if (shipment == null) {
+            String errMsg = "Could not find Shipment id ID [" + shipmentId + "]";
+            errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "ShipmentIdNotValid"));
+        }
+        
+        if (errorMapList.size() > 0) {
+            result.putAll(ServiceUtil.returnError("Errors found getting shipment information for incoming Show Shipment message"));
             result.put("errorMapList", errorMapList);
             return result;
-        }                    
+        }
+
         String shipGroupSeqId = shipment.getString("primaryShipGroupSeqId");                
         String originFacilityId = shipment.getString("originFacilityId");