You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2010/10/20 10:57:01 UTC
svn commit: r1024553 -
/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
Author: jonesde
Date: Wed Oct 20 08:57:01 2010
New Revision: 1024553
URL: http://svn.apache.org/viewvc?rev=1024553&view=rev
Log:
Fixed an occasional NPE, seems to happen when promo items are being added/removed
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=1024553&r1=1024552&r2=1024553&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 Wed Oct 20 08:57:01 2010
@@ -551,7 +551,6 @@ public class ShoppingCartServices {
if (UtilValidate.isNotEmpty(orderItems)) {
int itemIndex = 0;
for (GenericValue item : orderItems) {
-
List<GenericValue> orderItemAdjustments = orh.getOrderItemAdjustments(item);
// set the item's ship group info
List<GenericValue> shipGroupAssocs = orh.getOrderItemShipGroupAssocs(item);
@@ -574,11 +573,16 @@ public class ShoppingCartServices {
List<GenericValue> shipGroupItemAdjustments = EntityUtil.filterByAnd(orderItemAdjustments, UtilMisc.toMap("shipGroupSeqId", cartShipGroupIndexStr));
ShoppingCart.CartShipInfo csi = cart.getShipInfo(cartShipGroupIndex);
- List itemTaxAdj = csi.getShipItemInfo(cart.findCartItem(itemIndex)).itemTaxAdj;
- for(GenericValue shipGroupItemAdjustment : shipGroupItemAdjustments) {
- if ("SALES_TAX".equals(shipGroupItemAdjustment.get("orderAdjustmentTypeId"))) {
- itemTaxAdj.add(shipGroupItemAdjustment);
- continue;
+ ShoppingCartItem cartItem = cart.findCartItem(itemIndex);
+ 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;
+ }
}
}
}
Re: svn commit: r1024553 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
Posted by Jacques Le Roux <ja...@les7arts.com>.
You beat me on it Divesh, cool :o) !
Jacques
From: "Divesh Dutta" <di...@hotwaxmedia.com>
> Hello David,
>
> Hope you are doing well.
>
> Just wanted to know whether this fix should also go in release 10.04 ?
>
> Thanks
> --
> Divesh Dutta.
>
>
> On Oct 20, 2010, at 2:27 PM, jonesde@apache.org wrote:
>
>> Author: jonesde
>> Date: Wed Oct 20 08:57:01 2010
>> New Revision: 1024553
>>
>> URL: http://svn.apache.org/viewvc?rev=1024553&view=rev
>> Log:
>> Fixed an occasional NPE, seems to happen when promo items are being added/removed
>>
>> 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=1024553&r1=1024552&r2=1024553&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 Wed Oct 20 08:57:01 2010
>> @@ -551,7 +551,6 @@ public class ShoppingCartServices {
>> if (UtilValidate.isNotEmpty(orderItems)) {
>> int itemIndex = 0;
>> for (GenericValue item : orderItems) {
>> -
>> List<GenericValue> orderItemAdjustments = orh.getOrderItemAdjustments(item);
>> // set the item's ship group info
>> List<GenericValue> shipGroupAssocs = orh.getOrderItemShipGroupAssocs(item);
>> @@ -574,11 +573,16 @@ public class ShoppingCartServices {
>>
>> List<GenericValue> shipGroupItemAdjustments = EntityUtil.filterByAnd(orderItemAdjustments,
>> UtilMisc.toMap("shipGroupSeqId", cartShipGroupIndexStr));
>> ShoppingCart.CartShipInfo csi = cart.getShipInfo(cartShipGroupIndex);
>> - List itemTaxAdj = csi.getShipItemInfo(cart.findCartItem(itemIndex)).itemTaxAdj;
>> - for(GenericValue shipGroupItemAdjustment : shipGroupItemAdjustments) {
>> - if ("SALES_TAX".equals(shipGroupItemAdjustment.get("orderAdjustmentTypeId"))) {
>> - itemTaxAdj.add(shipGroupItemAdjustment);
>> - continue;
>> + ShoppingCartItem cartItem = cart.findCartItem(itemIndex);
>> + 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;
>> + }
>> }
>> }
>> }
>>
>>
>
>
>
Re: svn commit: r1024553 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
Posted by Divesh Dutta <di...@hotwaxmedia.com>.
Hello David,
Hope you are doing well.
Just wanted to know whether this fix should also go in release 10.04 ?
Thanks
--
Divesh Dutta.
On Oct 20, 2010, at 2:27 PM, jonesde@apache.org wrote:
> Author: jonesde
> Date: Wed Oct 20 08:57:01 2010
> New Revision: 1024553
>
> URL: http://svn.apache.org/viewvc?rev=1024553&view=rev
> Log:
> Fixed an occasional NPE, seems to happen when promo items are being added/removed
>
> 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=1024553&r1=1024552&r2=1024553&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 Wed Oct 20 08:57:01 2010
> @@ -551,7 +551,6 @@ public class ShoppingCartServices {
> if (UtilValidate.isNotEmpty(orderItems)) {
> int itemIndex = 0;
> for (GenericValue item : orderItems) {
> -
> List<GenericValue> orderItemAdjustments = orh.getOrderItemAdjustments(item);
> // set the item's ship group info
> List<GenericValue> shipGroupAssocs = orh.getOrderItemShipGroupAssocs(item);
> @@ -574,11 +573,16 @@ public class ShoppingCartServices {
>
> List<GenericValue> shipGroupItemAdjustments = EntityUtil.filterByAnd(orderItemAdjustments, UtilMisc.toMap("shipGroupSeqId", cartShipGroupIndexStr));
> ShoppingCart.CartShipInfo csi = cart.getShipInfo(cartShipGroupIndex);
> - List itemTaxAdj = csi.getShipItemInfo(cart.findCartItem(itemIndex)).itemTaxAdj;
> - for(GenericValue shipGroupItemAdjustment : shipGroupItemAdjustments) {
> - if ("SALES_TAX".equals(shipGroupItemAdjustment.get("orderAdjustmentTypeId"))) {
> - itemTaxAdj.add(shipGroupItemAdjustment);
> - continue;
> + ShoppingCartItem cartItem = cart.findCartItem(itemIndex);
> + 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;
> + }
> }
> }
> }
>
>