Author: jonesde
Date: Thu Oct 21 07:56:26 2010
New Revision: 1025871
URL:
http://svn.apache.org/viewvc?rev=1025871&view=revLog:
Another fix for an NPE seen in the wild when there is no CartShipItemInfo object available for an order item
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=1025871&r1=1025870&r2=1025871&view=diff==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Thu Oct 21 07:56:26 2010
@@ -46,6 +46,7 @@ import org.ofbiz.entity.condition.Entity
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.order.order.OrderReadHelper;
import org.ofbiz.order.shoppingcart.ShoppingCart.CartShipInfo;
+import org.ofbiz.order.shoppingcart.ShoppingCart.CartShipInfo.CartShipItemInfo;
import org.ofbiz.product.config.ProductConfigWorker;
import org.ofbiz.product.config.ProductConfigWrapper;
import org.ofbiz.service.DispatchContext;
@@ -577,11 +578,16 @@ public class ShoppingCartServices {
if (cartItem == null) {
Debug.logWarning("In loadCartFromOrder could not find cart item for itemIndex=" + itemIndex + ", for orderId=" + orderId, module);
} else {
- List itemTaxAdj = csi.getShipItemInfo(cartItem).itemTaxAdj;
- for(GenericValue shipGroupItemAdjustment : shipGroupItemAdjustments) {
- if ("SALES_TAX".equals(shipGroupItemAdjustment.get("orderAdjustmentTypeId"))) {
- itemTaxAdj.add(shipGroupItemAdjustment);
- continue;
+ CartShipItemInfo cartShipItemInfo = csi.getShipItemInfo(cartItem);
+ if (cartShipItemInfo == null) {
+ Debug.logWarning("In loadCartFromOrder could not find CartShipItemInfo for itemIndex=" + itemIndex + ", for orderId=" + orderId, module);
+ } else {
+ List itemTaxAdj = cartShipItemInfo.itemTaxAdj;
+ for(GenericValue shipGroupItemAdjustment : shipGroupItemAdjustments) {
+ if ("SALES_TAX".equals(shipGroupItemAdjustment.get("orderAdjustmentTypeId"))) {
+ itemTaxAdj.add(shipGroupItemAdjustment);
+ continue;
+ }
}
}
}