Re: svn commit: r1024553 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

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

Re: svn commit: r1024553 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Divesh Dutta
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, [hidden email] 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;
> +                                }
>                             }
>                         }
>                     }
>
>


Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1024553 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Jacques Le Roux
Administrator
You beat me on it Divesh, cool :o) !

Jacques

From: "Divesh Dutta" <[hidden email]>

> 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, [hidden email] 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;
>> +                                }
>>                             }
>>                         }
>>                     }
>>
>>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1024553 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Jacques Le Roux
Administrator
In reply to this post by Divesh Dutta
Though I will have wait a bit more because for now ASF SVN repo is read only, maybe why David did not do it himself...

To be aware at any moment I recommend to follow infrabot on Tweeter (very few posts)

HTH

Jacques

From: "Jacques Le Roux" <[hidden email]>

> You beat me on it Divesh, cool :o) !
>
> Jacques
>
> From: "Divesh Dutta" <[hidden email]>
>> 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, [hidden email] 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;
>>> +                                }
>>>                             }
>>>                         }
>>>                     }
>>>
>>>
>>
>>
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1024553 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Jacques Le Roux
Administrator
Answer: there are conflicts

Jacques

Jacques Le Roux wrote:

> Though I will have wait a bit more because for now ASF SVN repo is read only, maybe why David did not do it himself...
>
> To be aware at any moment I recommend to follow infrabot on Tweeter (very few posts)
>
> HTH
>
> Jacques
>
> From: "Jacques Le Roux" <[hidden email]>
>> You beat me on it Divesh, cool :o) !
>>
>> Jacques
>>
>> From: "Divesh Dutta" <[hidden email]>
>>> 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, [hidden email] 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;
>>>> +                                }
>>>>                             }
>>>>                         }
>>>>                     }