Author: sichen
Date: Thu Jun 21 10:35:00 2007
New Revision: 549561
URL: http://svn.apache.org/viewvc?view=rev&rev=549561
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/trunk/applications/product/servicedef/services_shipment_ups.xml
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
Modified: ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml?view=diff&rev=549561&r1=549560&r2=549561
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml
(original)
+++ ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml Thu
Jun 21 10:35:00 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/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java?view=diff&rev=549561&r1=549560&r2=549561
==============================================================================
---
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
(original)
+++
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
Thu Jun 21 10:35:00 2007
@@ -1871,6 +1871,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);
}