This is an automated email from the ASF dual-hosted git repository.

mridulpathak pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 43222d5b3c Fixed: Two regressions in the minilang-to-Groovy conversion 
of CommonServicesScript.groovy (OFBIZ-13583)
43222d5b3c is described below

commit 43222d5b3cb608896bb461c4c55534d359291b11
Author: Mridul Pathak <[email protected]>
AuthorDate: Tue Sep 15 16:33:24 2026 +0530

    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 ow [...]
    
    Both fixes were verified against the original minilang and current codebase 
conventions, and covered by a temporary RED/GREEN test before removal.
---
 .../main/groovy/org/apache/ofbiz/common/CommonServicesScript.groovy  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/framework/common/src/main/groovy/org/apache/ofbiz/common/CommonServicesScript.groovy
 
b/framework/common/src/main/groovy/org/apache/ofbiz/common/CommonServicesScript.groovy
index 2838add480..fce2148454 100644
--- 
a/framework/common/src/main/groovy/org/apache/ofbiz/common/CommonServicesScript.groovy
+++ 
b/framework/common/src/main/groovy/org/apache/ofbiz/common/CommonServicesScript.groovy
@@ -24,6 +24,7 @@ import java.sql.Timestamp
 import org.apache.ofbiz.base.util.UtilDateTime
 import org.apache.ofbiz.base.util.UtilProperties
 import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.util.EntityUtilProperties
 import org.apache.ofbiz.service.ModelService
 import org.apache.ofbiz.webapp.event.FileUploadProgressListener
 
@@ -111,7 +112,7 @@ Map convertUom() {
     }
     else { // not custom conversion
         // do the conversion
-        if (parameters.originalValue && uomConversion.conversionFactor) {
+        if (parameters.originalValue != null && 
uomConversion.conversionFactor) {
             convertedValue = parameters.originalValue * 
uomConversion.conversionFactor as BigDecimal
             convertedValue = convertedValue.setScale(15, 
RoundingMode.HALF_EVEN)
         }
@@ -191,7 +192,7 @@ Map getVisualThemeResources() {
     if (!resourceList) {
         // if not found use the good old initial ofbiz theme so the system 
will at least start up and will be usable
         logWarning("Could not find the ${visualThemeId} theme, reverting back 
to the good old OFBiz theme...")
-        visualThemeId = UtilProperties.getPropertyValue('general', 
'VISUAL_THEME', 'FLAT_GREY')
+        visualThemeId = EntityUtilProperties.getPropertyValue('general', 
'VISUAL_THEME', 'FLAT_GREY', delegator)
         resourceList = from('VisualThemeResource')
             .where(visualThemeId: visualThemeId)
             .orderBy('resourceTypeEnumId', 'sequenceId')

Reply via email to