ShoppingCart.createDropShip() bug?

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

ShoppingCart.createDropShip() bug?

Ritesh Trivedi
Hi,

Seems like there is atleast 1 bug in createDropShip() method in ShoppingCart.java. First few lines (See below) tries to get ProductStore from cache - if one had cart alive in session for longer duration which would last longer than the server restart - this will cause an incorrect # of ship groups created and hence incorrect shipping. facilityid is not even used anywhere in that method - may be it needs to be removed completely. I am using Firefox 3.0 and during development I had to restart ofbiz but the FF kept the session information alive and got really discounted shipping rates !!

Also this pauses questions for other parts of the ofbiz code where the effect of cache and server restart might cause unwanted(potentially harmful) behavior.

if (UtilValidate.isNotEmpty(this.getProductStoreId())) {
            try {
                GenericValue productStore = delegator.findByPrimaryKeyCache("ProductStore", UtilMisc.toMap("productStoreId", this.getProductStoreId()));
                facilityId = productStore.getString("inventoryFacilityId");
            } catch (Exception e) {
                Debug.logError(UtilProperties.getMessage(resource_error,"OrderProblemGettingProductStoreRecords", locale) + e.getMessage(), module);
                return;
            }
        }

Here is my code version
Path: .
URL: http://svn.apache.org/repos/asf/ofbiz/trunk
Repository Root: http://svn.apache.org/repos/asf
Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
Revision: 653845
Node Kind: directory
Schedule: normal
Last Changed Author: bibryam
Last Changed Rev: 653787
Last Changed Date: 2008-05-06 07:15:24 -0700 (Tue, 06 May 2008)

I also have related question on createDropShip(). Seems like it can only be called 1ce during the lifetime of shoppingcart. If shoppingcart gets updated, this method will not create correct ship groups, one has to undo the ship group creation and call createDropShip again - this may loose other ship groups etc. Ofbiz gurus can correct me if I am wrong.
Reply | Threaded
Open this post in threaded view
|

Re: ShoppingCart.createDropShip() bug?

Scott Gray
If a value isn't found in the cache then it looks in the db so there is no
problem in using the cache for lookups.

Regards
Scott

2008/6/27 Ritz123 <[hidden email]>:

>
> Hi,
>
> Seems like there is atleast 1 bug in createDropShip() method in
> ShoppingCart.java. First few lines (See below) tries to get ProductStore
> from cache - if one had cart alive in session for longer duration which
> would last longer than the server restart - this will cause an incorrect #
> of ship groups created and hence incorrect shipping. facilityid is not even
> used anywhere in that method - may be it needs to be removed completely. I
> am using Firefox 3.0 and during development I had to restart ofbiz but the
> FF kept the session information alive and got really discounted shipping
> rates !!
>
> Also this pauses questions for other parts of the ofbiz code where the
> effect of cache and server restart might cause unwanted(potentially
> harmful)
> behavior.
>
> if (UtilValidate.isNotEmpty(this.getProductStoreId())) {
>            try {
>                GenericValue productStore =
> delegator.findByPrimaryKeyCache("ProductStore",
> UtilMisc.toMap("productStoreId", this.getProductStoreId()));
>                facilityId = productStore.getString("inventoryFacilityId");
>            } catch (Exception e) {
>
>
> Debug.logError(UtilProperties.getMessage(resource_error,"OrderProblemGettingProductStoreRecords",
> locale) + e.getMessage(), module);
>                return;
>            }
>        }
>
> Here is my code version
> Path: .
> URL: http://svn.apache.org/repos/asf/ofbiz/trunk
> Repository Root: http://svn.apache.org/repos/asf
> Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
> Revision: 653845
> Node Kind: directory
> Schedule: normal
> Last Changed Author: bibryam
> Last Changed Rev: 653787
> Last Changed Date: 2008-05-06 07:15:24 -0700 (Tue, 06 May 2008)
>
> I also have related question on createDropShip(). Seems like it can only be
> called 1ce during the lifetime of shoppingcart. If shoppingcart gets
> updated, this method will not create correct ship groups, one has to undo
> the ship group creation and call createDropShip again - this may loose
> other
> ship groups etc. Ofbiz gurus can correct me if I am wrong.
> --
> View this message in context:
> http://www.nabble.com/ShoppingCart.createDropShip%28%29-bug--tp18144143p18144143.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>