You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2026/09/15 11:49:00 UTC

[jira] [Commented] (OFBIZ-13583) convertUom and getVisualThemeResources regressions

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

ASF subversion and git services commented on OFBIZ-13583:
---------------------------------------------------------

Commit 43222d5b3cb608896bb461c4c55534d359291b11 in ofbiz-framework's branch refs/heads/trunk from Mridul Pathak
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=43222d5b3c ]

Fixed: Two regressions in the minilang-to-Groovy conversion of CommonServicesScript.groovy (OFBIZ-13583)

- convertUom's guard `if (parameters.originalValue && uomConversion.conversionFactor)` treated numeric 0 as falsy, skipping the multiplication and returning convertedValue: null instead of 0 for a zero originalValue, risking NPEs in downstream code expecting a BigDecimal
- getVisualThemeResources's fallback read the theme id via plain UtilProperties.getPropertyValue, which only checks general.properties; switched to EntityUtilProperties.getPropertyValue so it also honors a general/VISUAL_THEME SystemProperty override, matching the convention already used for this exact property in CmsEvents.java and DataResourceWorker.java (the original minilang hardcoded a literal FLAT_GREY here, but that theme currently has no VisualThemeResource seed data of its own, so a literal revert would leave the fallback permanently broken; this instead keeps the property-based fallback but makes it consistent with how the rest of the codebase reads this property)

Both fixes were verified against the original minilang and current codebase conventions, and covered by a temporary RED/GREEN test before removal.


> convertUom and getVisualThemeResources regressions
> --------------------------------------------------
>
>                 Key: OFBIZ-13583
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-13583
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework/common
>    Affects Versions: Upcoming Branch, 24.09.07
>            Reporter: Mridul Pathak
>            Assignee: Mridul Pathak
>            Priority: Major
>
> Two issues in {{CommonServicesScript.groovy}}:
> # {{convertUom}}: the non-custom conversion path is guarded by {{if (parameters.originalValue && uomConversion.conversionFactor)}}. Groovy treats numeric {{0}} as falsy, so converting an {{originalValue}} of exactly {{0}} skips the multiplication entirely and returns {{convertedValue: null}} instead of {{0}}, which can NPE downstream callers expecting a {{BigDecimal}}. The original minilang ran the calculation unconditionally.
> # {{getVisualThemeResources}}: the fallback theme is sourced from {{UtilProperties.getPropertyValue('general', 'VISUAL_THEME', 'FLAT_GREY')}} instead of the originally-hardcoded literal {{"FLAT_GREY"}}. On a stock install this property resolves to a different theme, so the "safety net" fallback no longer guarantees a query against the one theme that's always present in seed data.
> Needs fixing: change the {{convertUom}} guard to not treat a real, present {{0}} value as absent (e.g. check {{parameters.originalValue != null}}), and hardcode the {{getVisualThemeResources}} fallback back to the literal {{"FLAT_GREY"}}.



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