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 ddec45f8c1 Fixed: Two regressions in the minilang-to-Groovy conversion
of CommonServicesScript.groovy (OFBIZ-13610)
ddec45f8c1 is described below
commit ddec45f8c16eff99ff7a1a2962aadf9e1c60b722
Author: Mridul Pathak <[email protected]>
AuthorDate: Sat Sep 26 16:37:15 2026 +0530
Fixed: Two regressions in the minilang-to-Groovy conversion of
CommonServicesScript.groovy (OFBIZ-13610)
convertUom() no longer skips the configured decimal-scale rounding step
when the converted value is legitimately zero, since Groovy treats a zero
BigDecimal as falsy and the previous truthiness check masked that case;
switched to an explicit null check, matching the original mini-lang which gated
this step only on roundingMode being present.
getFileUploadProgressStatus() now truncates readPercent to an int as the
original mini-lang did, instead of returning a full-precision BigDecimal from
Groovy's division, matching the servicedef's declared Integer OUT type.
---
.../main/groovy/org/apache/ofbiz/common/CommonServicesScript.groovy | 4 ++--
1 file changed, 2 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 2b1b0ace49..3fbea3be04 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
@@ -119,7 +119,7 @@ Map convertUom() {
// round result, if UomConversion[Dated] so specifies
decimalScale = uomConversion.decimalScale ?: parameters.defaultDecimalScale
roundingMode = uomConversion.roundingMode ?: parameters.defaultRoundingMode
- if (convertedValue && roundingMode) {
+ if (convertedValue != null && roundingMode) {
if (roundingMode instanceof String) {
String modeStr = roundingMode.replace('ROUND_',
'').replaceAll('([a-z])([A-Z])', '$1_$2').toUpperCase()
try {
@@ -168,7 +168,7 @@ Map getFileUploadProgressStatus() {
result.bytesRead = uploadProgressListener.getBytesRead()
result.hasStarted = uploadProgressListener.hasStarted()
- result.readPercent = (result.bytesRead * 100) / result.contentLength
+ result.readPercent = (int) ((result.bytesRead * 100) /
result.contentLength)
}
return result
}