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-13606) removeImageBySize() silently swallows a failed sub-service call inside a .each closure

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

Mridul Pathak closed OFBIZ-13606.
---------------------------------
    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.

> removeImageBySize() silently swallows a failed sub-service call inside a .each closure
> --------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-13606
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-13606
>             Project: OFBiz
>          Issue Type: Bug
>          Components: product/catalog
>    Affects Versions: Upcoming Branch, 24.09.07
>            Reporter: Mridul Pathak
>            Assignee: Mridul Pathak
>            Priority: Major
>
> h3. Needs fixing
> {{applications/product/src/main/groovy/org/apache/ofbiz/product/product/imagemanagement/ImageManagementServicesScript.groovy}}'s {{removeImageBySize()}} has {{return error(serviceResult.errorMessage)}} inside a {{contentAssocs.each { GenericValue contentAssoc -> ... } }} closure, guarding the result of {{removeProductContentForImageManagement}}. Since {{return}} inside a Groovy closure only exits that closure invocation, a failure here does not abort {{removeImageBySize()}} — the method just moves on and eventually returns {{success()}} regardless. The original minilang-to-Groovy conversion used a plain {{for}} loop here (correct); a later, purely stylistic "Codenarc integration rebased" commit converted it to {{.each { }}} with no other logic change, introducing this bug. Needs fixing: convert the {{.each}} loop back to a plain {{for}} loop so a failed {{removeProductContentForImageManagement}} call correctly aborts {{removeImageBySize()}} with an error.
> Also present on release24.09, at the same path, in the identical form.
> Acceptance criteria: fixed, with a regression test that forces {{removeProductContentForImageManagement}} to fail and asserts {{removeImageBySize()}} returns an error rather than silently succeeding.



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