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

jleroux 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 f6e6eb602d Fixed: Replace deprecated BigDecimal.ROUND_HALF by  
RoundingMode.HALF (OFBIZ-13103)
f6e6eb602d is described below

commit f6e6eb602d6dad04a6f12b36073aa7f86d30449d
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Fri May 24 18:09:59 2024 +0200

    Fixed: Replace deprecated BigDecimal.ROUND_HALF by  RoundingMode.HALF 
(OFBIZ-13103)
    
    RoundingMode.HALF_UP is not returning an int.
    This, at least, prevents integration tests to pass. Maybe more due to
    OFBIZ-13099 that need to be fixed anyway.
---
 .../org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy      | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
index f06e5d490d..c938bb1a79 100644
--- 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
+++ 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
@@ -18,8 +18,8 @@
 */
 package org.apache.ofbiz.accounting.admin
 
-import java.sql.Timestamp
 import java.math.RoundingMode
+import java.sql.Timestamp
 
 import org.apache.ofbiz.base.util.UtilDateTime
 import org.apache.ofbiz.base.util.UtilProperties
@@ -158,11 +158,10 @@ Map getFXConversion() {
 
     BigDecimal conversionRate
     int decimalScale = 2
-    int roundingMode = RoundingMode.HALF_UP
     if (rates) {
         conversionFactor = 
EntityUtil.getFirst(rates).getBigDecimal('conversionFactor')
         BigDecimal originalValue = BigDecimal.ONE
-        conversionRate = originalValue.divide(conversionFactor, decimalScale, 
roundingMode)
+        conversionRate = originalValue.divide(conversionFactor, decimalScale, 
RoundingMode.HALF_UP)
     } else {
         String errorMessage = 'Could not find conversion rate'
         logError(errorMessage)

Reply via email to