You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Mridul Pathak (Jira)" <ji...@apache.org> on 2026/09/19 14:44:00 UTC

[jira] [Closed] (OFBIZ-13605) calculateShoppingListDeepTotalPrice() silently drops failed price/subtotal

     [ https://issues.apache.org/jira/browse/OFBIZ-13605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mridul Pathak closed OFBIZ-13605.
---------------------------------
    Resolution: Not A Bug

Retracting this finding. The flagged return error(...) inside the .each closure follows a run service: call, and GroovyBaseScript.runService() already throws before that check is ever reached — confirmed by tracing the code and reproducing it with a forced sub-service failure. A real failure still correctly aborts the method today. Closing as not a bug.

> calculateShoppingListDeepTotalPrice() silently drops failed price/subtotal
> --------------------------------------------------------------------------
>
>                 Key: OFBIZ-13605
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-13605
>             Project: OFBiz
>          Issue Type: Bug
>          Components: order
>    Affects Versions: Upcoming Branch, 24.09.07
>            Reporter: Mridul Pathak
>            Assignee: Mridul Pathak
>            Priority: Major
>
> h3. Needs fixing
> {{applications/order/src/main/groovy/org/apache/ofbiz/order/shoppinglist/ShoppingListServicesScript.groovy}}'s {{calculateShoppingListDeepTotalPrice()}} has {{return error(...)}} inside two separate {{.each { }}} loops: once when {{calculateProductPrice}} fails for a shopping list item, and once when the recursive {{calculateShoppingListDeepTotalPrice}} call fails for a child shopping list. In both cases, {{return}} only exits that closure invocation, not the enclosing method, so the failure is silently absorbed — the loop simply moves on to the next item/child list without adding anything for the failed one, and the method returns a *plausible-looking but understated* {{totalPrice}} instead of an error. This is worse than a crash: the caller has no way to know the total is wrong. Needs fixing: convert both {{.each}} loops back to plain {{for}} loops so a failure correctly aborts {{calculateShoppingListDeepTotalPrice()}} with an error instead of silently producing a wrong total.
> Also present on release24.09, at the same path, in the identical form (both {{.each}} call sites).
> Acceptance criteria: fixed, with a regression test that forces one of the two failure paths and asserts the service returns an error rather than a silently-understated total.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)