svn commit: r1062762 - /ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java

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

svn commit: r1062762 - /ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java

jleroux@apache.org
Author: jleroux
Date: Mon Jan 24 13:12:02 2011
New Revision: 1062762

URL: http://svn.apache.org/viewvc?rev=1062762&view=rev
Log:
A patch from Norbert Rieger "NPE in EbayOrderServices.createShoppingCar" (https://issues.apache.org/jira/browse/OFBIZ-3926) - OFBIZ-3926

Due to missing property "stateProvinceGeoId" in shippingAddressCtx the following call raises an NPE (EbayOrderServices.createShoppingCart, line 1118ff):

List<GenericValue> shipInfo = PartyWorker.findMatchingPersonPostalAddresses(delegator, shippingAddressCtx.get("shippingAddressStreet1").toString(),
(UtilValidate.isEmpty(shippingAddressCtx.get("shippingAddressStreet2")) ? null : shippingAddressCtx.get("shippingAddressStreet2").toString()), shippingAddressCtx.get("city").toString(),
shippingAddressCtx.get("stateProvinceGeoId").toString(), shippingAddressCtx.get("shippingAddressPostalCode").toString(), null, shippingAddressCtx.get("countryGeoId").toString(), firstName, null, lastName);

Checking whether the property is set (not empty) will solve this.

JLR: Norbert did the same for shippingAddressStreet2. I did not check if others were missing, hopefully there are none...

Modified:
    ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java

Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java?rev=1062762&r1=1062761&r2=1062762&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java (original)
+++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java Mon Jan 24 13:12:02 2011
@@ -1115,9 +1115,19 @@ public class EbayOrderServices {
                     String city = (String) shippingAddressCtx.get("shippingAddressCityName");
                     EbayHelper.correctCityStateCountry(dispatcher, shippingAddressCtx, city, state, country);
 
-                    List<GenericValue> shipInfo = PartyWorker.findMatchingPersonPostalAddresses(delegator, shippingAddressCtx.get("shippingAddressStreet1").toString(),
-                            (UtilValidate.isEmpty(shippingAddressCtx.get("shippingAddressStreet2")) ? null : shippingAddressCtx.get("shippingAddressStreet2").toString()), shippingAddressCtx.get("city").toString(), shippingAddressCtx.get("stateProvinceGeoId").toString(),
-                            shippingAddressCtx.get("shippingAddressPostalCode").toString(), null, shippingAddressCtx.get("countryGeoId").toString(), firstName, null, lastName);
+                    List<GenericValue> shipInfo =
+                     PartyWorker.findMatchingPersonPostalAddresses
+                     (delegator,
+                     shippingAddressCtx.get("shippingAddressStreet1").toString(),
+                            (UtilValidate.isEmpty(shippingAddressCtx.get("shippingAddressStreet2")) ? null : shippingAddressCtx.get("shippingAddressStreet2").toString()),
+                             shippingAddressCtx.get("city").toString(),
+                            (UtilValidate.isEmpty(shippingAddressCtx.get("stateProvinceGeoId")) ? null : shippingAddressCtx.get("stateProvinceGeoId").toString()),
+                             shippingAddressCtx.get("shippingAddressPostalCode").toString(),
+                             null,
+                             shippingAddressCtx.get("countryGeoId").toString(),
+                             firstName,
+                             null,
+                             lastName);
                     if (UtilValidate.isNotEmpty(shipInfo)) {
                         GenericValue first = EntityUtil.getFirst(shipInfo);
                         partyId = first.getString("partyId");