[ 
https://issues.apache.org/jira/browse/OFBIZ-5130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14213428#comment-14213428
 ] 

Divesh Dutta edited comment on OFBIZ-5130 at 11/15/14 7:09 AM:
---------------------------------------------------------------

Hi [~dagarwal82] and other Developers, 

I would like to know why are you setting up mutual variants? What is the 
business case you are trying to solve? What are you trying to achieve by 
setting up mutual variants ? 
 IMO setting up mutual variant is wrong product data set up. And due to this 
wrong data set up, getProductCost causes never ending recursive loop. 

In general you calculate product cost for finished good, and if you have 
virtual variant set up, then you calculate product cost for variant and if 
variant does not have cost then you calculate product cost for virtual.

You can also have set up where you have product A manufactured with Product B 
and Product C. And you would like to calculate costing of Product A. But 
Product itself does not have any cost set up. Product B and Product C have cost 
data. So adding cost of product B and C , you will get cost of Product A. And 
you have this kind of requirement,  then you can have look at 
DemoStandardCosting.xml file in ecommerce component. 

But I still don't understand why will you need to set up data like:

Cost of product A = 0
Cost of product B = 0
B is variant of A and A is variant of B. ?





was (Author: diveshdut):
Hi [~dagarwal82] 

I would like to know why are you setting up mutual variants? What is the 
business case you are trying to solve? What are you trying to achieve by 
setting up mutual variants ? 
 IMO setting up mutual variant is wrong product data set up. And due to this 
wrong data set up, getProductCost causes never ending recursive loop. 

In general you calculate product cost for finished good, and if you have 
virtual variant set up, then you calculate product cost for variant and if 
variant does not have cost then you calculate product cost for virtual.

You can also have set up where you have product A manufactured with Product B 
and Product C. And you would like to calculate costing of Product A. But 
Product itself does not have any cost set up. Product B and Product C have cost 
data. So adding cost of product B and C , you will get cost of Product A. And 
you have this kind of requirement,  then you can have look at 
DemoStandardCosting.xml file in ecommerce component. 

But I still don't understand why will you need to set up data like:

Cost of product A = 0
Cost of product B = 0
B is variant of A and A is variant of B. ?




> getProductCost causes stack overflow if product has mutual variants
> -------------------------------------------------------------------
>
>                 Key: OFBIZ-5130
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5130
>             Project: OFBiz
>          Issue Type: Bug
>          Components: product
>    Affects Versions: Trunk
>            Reporter: Deepak Agarwal
>            Assignee: Ashish Vijaywargiya
>              Labels: crash
>         Attachments: OFBiz-5130.patch
>
>
> Cost of product A = 0
> Cost of product B = 0
> B is variant of A and A is variant of B.
> Now getProductCost causes a never ending recursive loop. This causes jvm to 
> exit (prior to Jdk1.6_34, atleast in my knowledge) without any crash dump.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to