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 2e439d88db Improved: Replace deprecated BigDecimal.ROUND_HALF by RoundingMode.HALF (OFBIZ-13103) 2e439d88db is described below commit 2e439d88dbfe5dada2c07d47347ab4806b98d26f Author: Jacques Le Roux <jacques.le.r...@les7arts.com> AuthorDate: Fri May 24 16:50:17 2024 +0200 Improved: Replace deprecated BigDecimal.ROUND_HALF by RoundingMode.HALF (OFBIZ-13103) Fixes a typo, it's RoundingMode.HALF_UP and not RoundingMode.ROUND_HALF_UP as with BigDecimal --- .../ofbiz/accounting/admin/AcctgAdminServices.groovy | 2 +- .../ofbiz/party/party/PartyFinancialHistory.groovy | 16 ++++++++-------- .../ofbiz/party/party/UnAppliedInvoicesForParty.groovy | 4 ++-- .../ofbiz/party/party/UnAppliedPaymentsForParty.groovy | 2 +- .../ofbiz/product/catalog/product/BestProducts.groovy | 2 +- .../main/java/org/apache/ofbiz/base/util/UtilNumber.java | 4 ++-- 6 files changed, 15 insertions(+), 15 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 46a6c9e061..f06e5d490d 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 @@ -158,7 +158,7 @@ Map getFXConversion() { BigDecimal conversionRate int decimalScale = 2 - int roundingMode = RoundingMode.ROUND_HALF_UP + int roundingMode = RoundingMode.HALF_UP if (rates) { conversionFactor = EntityUtil.getFirst(rates).getBigDecimal('conversionFactor') BigDecimal originalValue = BigDecimal.ONE diff --git a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyFinancialHistory.groovy b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyFinancialHistory.groovy index 88b30fb882..a07be54e2d 100644 --- a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyFinancialHistory.groovy +++ b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyFinancialHistory.groovy @@ -63,12 +63,12 @@ while (invIterator.next()) { Boolean isSalesInvoice = EntityTypeUtil.hasParentType(delegator, 'InvoiceType', 'invoiceTypeId', (String) invoice.getString('invoiceTypeId'), 'parentTypeId', 'SALES_INVOICE') if (isPurchaseInvoice) { - totalInvPuApplied += InvoiceWorker.getInvoiceApplied(invoice, actualCurrency).setScale(2, RoundingMode.ROUND_HALF_UP) - totalInvPuNotApplied += InvoiceWorker.getInvoiceNotApplied(invoice, actualCurrency).setScale(2, RoundingMode.ROUND_HALF_UP) + totalInvPuApplied += InvoiceWorker.getInvoiceApplied(invoice, actualCurrency).setScale(2, RoundingMode.HALF_UP) + totalInvPuNotApplied += InvoiceWorker.getInvoiceNotApplied(invoice, actualCurrency).setScale(2, RoundingMode.HALF_UP) } else if (isSalesInvoice) { - totalInvSaApplied += InvoiceWorker.getInvoiceApplied(invoice, actualCurrency).setScale(2, RoundingMode.ROUND_HALF_UP) - totalInvSaNotApplied += InvoiceWorker.getInvoiceNotApplied(invoice, actualCurrency).setScale(2, RoundingMode.ROUND_HALF_UP) + totalInvSaApplied += InvoiceWorker.getInvoiceApplied(invoice, actualCurrency).setScale(2, RoundingMode.HALF_UP) + totalInvSaNotApplied += InvoiceWorker.getInvoiceNotApplied(invoice, actualCurrency).setScale(2, RoundingMode.HALF_UP) } else { logError('InvoiceType: ' + invoice.invoiceTypeId + ' without a valid parentTypeId: ' + invoice.parentTypeId @@ -103,12 +103,12 @@ payIterator = from('PaymentAndType').where(payExprs).cursorScrollInsensitive().d while (payIterator.next()) { payment = payIterator.next() if (payment.parentTypeId == 'DISBURSEMENT' || payment.parentTypeId == 'TAX_PAYMENT') { - totalPayOutApplied += PaymentWorker.getPaymentApplied(payment, actualCurrency).setScale(2, RoundingMode.ROUND_HALF_UP) - totalPayOutNotApplied += PaymentWorker.getPaymentNotApplied(payment, actualCurrency).setScale(2, RoundingMode.ROUND_HALF_UP) + totalPayOutApplied += PaymentWorker.getPaymentApplied(payment, actualCurrency).setScale(2, RoundingMode.HALF_UP) + totalPayOutNotApplied += PaymentWorker.getPaymentNotApplied(payment, actualCurrency).setScale(2, RoundingMode.HALF_UP) } else if (payment.parentTypeId == 'RECEIPT') { - totalPayInApplied += PaymentWorker.getPaymentApplied(payment, actualCurrency).setScale(2, RoundingMode.ROUND_HALF_UP) - totalPayInNotApplied += PaymentWorker.getPaymentNotApplied(payment, actualCurrency).setScale(2, RoundingMode.ROUND_HALF_UP) + totalPayInApplied += PaymentWorker.getPaymentApplied(payment, actualCurrency).setScale(2, RoundingMode.HALF_UP) + totalPayInNotApplied += PaymentWorker.getPaymentNotApplied(payment, actualCurrency).setScale(2, RoundingMode.HALF_UP) } else { logError('PaymentTypeId: ' + payment.paymentTypeId + ' without a valid parentTypeId: ' + payment.parentTypeId diff --git a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedInvoicesForParty.groovy b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedInvoicesForParty.groovy index d802a46ad2..5173c693a4 100644 --- a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedInvoicesForParty.groovy +++ b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedInvoicesForParty.groovy @@ -50,7 +50,7 @@ invIterator = from('InvoiceAndType').where(invExprs).cursorScrollInsensitive().d invoiceList = [] while (invIterator.next()) { invoice = invIterator.next() - unAppliedAmount = InvoiceWorker.getInvoiceNotApplied(invoice, actualCurrency).setScale(2, RoundingMode.ROUND_HALF_UP) + unAppliedAmount = InvoiceWorker.getInvoiceNotApplied(invoice, actualCurrency).setScale(2, RoundingMode.HALF_UP) if (unAppliedAmount.signum() == 1) { if (actualCurrency == true) { invoiceCurrencyUomId = invoice.currencyUomId @@ -61,7 +61,7 @@ while (invIterator.next()) { invoiceDate: invoice.invoiceDate, unAppliedAmount: unAppliedAmount, invoiceCurrencyUomId: invoiceCurrencyUomId, - amount: InvoiceWorker.getInvoiceTotal(invoice, actualCurrency).setScale(2, RoundingMode.ROUND_HALF_UP), + amount: InvoiceWorker.getInvoiceTotal(invoice, actualCurrency).setScale(2, RoundingMode.HALF_UP), invoiceTypeId: invoice.invoiceTypeId, invoiceParentTypeId: invoice.parentTypeId]) } diff --git a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedPaymentsForParty.groovy b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedPaymentsForParty.groovy index d105889078..fb1773554b 100644 --- a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedPaymentsForParty.groovy +++ b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedPaymentsForParty.groovy @@ -52,7 +52,7 @@ payIterator = from('PaymentAndType').where(payExprs).cursorScrollInsensitive().d while (payIterator.next()) { payment = payIterator.next() - unAppliedAmount = PaymentWorker.getPaymentNotApplied(payment, actualCurrency).setScale(2, RoundingMode.ROUND_HALF_UP) + unAppliedAmount = PaymentWorker.getPaymentNotApplied(payment, actualCurrency).setScale(2, RoundingMode.HALF_UP) if (unAppliedAmount.signum() == 1) { if (actualCurrency == true && payment.actualCurrencyAmount && payment.actualCurrencyUomId) { amount = payment.actualCurrencyAmount diff --git a/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/product/BestProducts.groovy b/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/product/BestProducts.groovy index 1ec7153767..1f499e94f0 100644 --- a/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/product/BestProducts.groovy +++ b/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/product/BestProducts.groovy @@ -94,7 +94,7 @@ while (itr <= 5) { } if (!orderItemDetail.isEmpty()) { if (orderItemDetail.amount) { - orderItemDetail.amount = orderItemDetail.amount.setScale(2, RoundingMode.ROUND_HALF_UP) + orderItemDetail.amount = orderItemDetail.amount.setScale(2, RoundingMode.HALF_UP) } topSellingProducts.add(orderItemDetail) bestSellingProducts.remove(orderItemDetail) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java index 048c1c4b16..659a507a22 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java @@ -217,7 +217,7 @@ public final class UtilNumber { * Method to get BigDecimal rounding mode from a property * @param file - Name of the property file * @param property - Name of the config property from ARITH_PROP_FILE (e.g., "invoice.rounding") - * @return int - Rounding mode to pass to BigDecimal's methods. Defaults to RoundingMode.ROUND_HALF_UP + * @return int - Rounding mode to pass to BigDecimal's methods. Defaults to RoundingMode.HALF_UP * @deprecated Use {@link #getRoundingMode(String, String)} instead */ @Deprecated @@ -228,7 +228,7 @@ public final class UtilNumber { /** * Method to get BigDecimal rounding mode from a property. Use the default ARITH_PROP_FILE properties file * @param property - Name of the config property from ARITH_PROP_FILE (e.g., "invoice.rounding") - * @return int - Rounding mode to pass to BigDecimal's methods. Defaults to RoundingMode.ROUND_HALF_UP + * @return int - Rounding mode to pass to BigDecimal's methods. Defaults to RoundingMode.HALF_UP * @deprecated Use {@link #getRoundingMode(String)} instead */ @Deprecated