Author: sichen
Date: Thu Jun 21 10:35:28 2007
New Revision: 549562

URL: http://svn.apache.org/viewvc?view=rev&rev=549562
Log:
Fix a potential rollback crash if upsRateEstimateByPostalCode is called for an 
address with a missing zip code.  By returning failure instead of using service 
engine to validate zip code, we avoid a rollback which could crash checkout 
screens

Modified:
    
ofbiz/branches/release4.0/applications/product/servicedef/services_shipment_ups.xml
    
ofbiz/branches/release4.0/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java

Modified: 
ofbiz/branches/release4.0/applications/product/servicedef/services_shipment_ups.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/product/servicedef/services_shipment_ups.xml?view=diff&rev=549562&r1=549561&r2=549562
==============================================================================
--- 
ofbiz/branches/release4.0/applications/product/servicedef/services_shipment_ups.xml
 (original)
+++ 
ofbiz/branches/release4.0/applications/product/servicedef/services_shipment_ups.xml
 Thu Jun 21 10:35:28 2007
@@ -65,7 +65,9 @@
             will return a Map of serviceCode -> rate</description>
         <attribute name="serviceConfigProps" type="String" mode="IN" 
optional="true"/>
         <attribute name="initialEstimateAmt" type="Double" mode="IN" 
optional="true"/>
-        <attribute name="shippingPostalCode" type="String" mode="IN" 
optional="false"/>
+        <!-- The postal code must not be required or service validation could 
create an exception and break other things.  It will
+        be checked in the service and a Failure (not Error) will be returned 
if it is null -->
+        <attribute name="shippingPostalCode" type="String" mode="IN" 
optional="true"/>
         <attribute name="shipmentMethodTypeId" type="String" mode="IN" 
optional="false"/>
         <attribute name="carrierPartyId" type="String" mode="IN" 
optional="false"/>
         <attribute name="carrierRoleTypeId" type="String" mode="IN" 
optional="false"/>

Modified: 
ofbiz/branches/release4.0/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java?view=diff&rev=549562&r1=549561&r2=549562
==============================================================================
--- 
ofbiz/branches/release4.0/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
 (original)
+++ 
ofbiz/branches/release4.0/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
 Thu Jun 21 10:35:28 2007
@@ -1868,6 +1868,12 @@
         Double shippableQuantity = (Double) context.get("shippableQuantity");
         Double shippableWeight = (Double) context.get("shippableWeight");
         String isResidentialAddress = 
(String)context.get("isResidentialAddress");
+
+        // Important: DO NOT returnError here or you could trigger a 
transaction rollback and break other services.
+        if (UtilValidate.isEmpty(shippingPostalCode)) {
+            return ServiceUtil.returnFailure("Cannot estimate UPS Rate because 
postal code is missing");
+        }
+
         if (shippableTotal == null) {
             shippableTotal = new Double(0.00);
         }


Reply via email to