Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0037964Openbravo ERPZ. Otherspublic2018-02-18 19:122018-03-02 21:18
shuehner 
Triage Omni OMS 
normalminorhave not tried
closedfixed 
5
 
3.0PR18Q23.0PR18Q2 
dmiguelez
Core
No
0037964: JDK 9: fix new BigDecimal related deprecation warnigns
JDK9 deprecated some constants in BigDecimal class related to rounding which are commonly used with the setScale & divide functions.

However a simple replacement of the old constants with the new Enum Values is enough to fix this
- BigDecimal.ROUND_HALF_UP -> RoundingMode.HALF_UP
- BigDecimal.ROUND_HALF_EVEN -> RoundingMode.HALF_EVEN
etc..

Note: That requires new import java.math.RoundingMode if not present.

Because of the huge number of cases that can be faster + safer fixed half-automatically by doing
a.) Search replace of UP,EVEN,CEILING cases of above in all java files
b.) Adding missing import when required
find . -name *.java | xargs -n1 sed -i 's#BigDecimal.ROUND_HALF_EVEN#RoundingMode.HALF_EVEN#'
find . -name *.java | xargs -n1 sed -i 's#BigDecimal.ROUND_HALF_UP#RoundingMode.HALF_UP#'
Compile with java9 and observe many new eclipse warnings related to BigDecimal
No tags attached.
blocks feature request 0037083 closed alostale support JDK 9 
Issue History
2018-02-18 19:12shuehnerNew Issue
2018-02-18 19:12shuehnerAssigned To => Triage Finance
2018-02-18 19:12shuehnerModules => Core
2018-02-18 19:12shuehnerTriggers an Emergency Pack => No
2018-02-18 19:12shuehnerRelationship addedblocks 0037083
2018-02-18 19:13shuehnerNote Added: 0102481
2018-02-23 11:21hgbotCheckin
2018-02-23 11:21hgbotNote Added: 0102818
2018-02-23 11:21hgbotCheckin
2018-02-23 11:21hgbotNote Added: 0102819
2018-02-23 11:21hgbotCheckin
2018-02-23 11:21hgbotNote Added: 0102820
2018-02-23 11:22dmiguelezStatusnew => scheduled
2018-02-23 11:22dmiguelezStatusscheduled => resolved
2018-02-23 11:22dmiguelezFixed in SCM revision => https://code.openbravo.com/erp/devel/pi/rev/91cc3fec7716f11eb9cba45fae6cef599250780f [^]
2018-02-23 11:22dmiguelezResolutionopen => fixed
2018-02-23 11:22dmiguelezReview Assigned To => dmiguelez
2018-02-23 11:22dmiguelezNote Added: 0102822
2018-02-23 11:22dmiguelezStatusresolved => closed
2018-02-23 11:22dmiguelezFixed in Version => 3.0PR18Q2
2018-03-02 21:18hudsonbotCheckin
2018-03-02 21:18hudsonbotNote Added: 0102948
2018-03-02 21:18hudsonbotCheckin
2018-03-02 21:18hudsonbotNote Added: 0102949
2018-03-02 21:18hudsonbotCheckin
2018-03-02 21:18hudsonbotNote Added: 0102950

Notes
(0102481)
shuehner   
2018-02-18 19:13   
Using above commands + adding manually import leads to following diffstat
 64 files changed, 341 insertions(+), 288 deletions(-)

That takes care about 99% of all cases except 4-5 files which don't use above constant but numeric magic-value for rounding which is probably bad style anyway.
(0102818)
hgbot   
2018-02-23 11:21   
Repository: erp/devel/pi
Changeset: 91cc3fec7716f11eb9cba45fae6cef599250780f
Author: Stefan Hühner <stefan.huehner <at> openbravo.com>
Date: Sun Feb 18 19:15:11 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/91cc3fec7716f11eb9cba45fae6cef599250780f [^]

Issue 37964. Fix most of new JDK9 BigDecimal related deprecation warnings.

All changes are:
- BigDecimal.ROUND_HALF_UP -> RoundingMode.HALF_UP
- BigDecimal.ROUND_HALF_EVEN -> RoundingMode.HALF_EVEN
- BigDecimal.ROUND_CEILING -> RoundingMode.CEILING
- Adding java.math.RoundingMode import when required

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/DoubtFulDebtPickEditLines.java
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentMonitorProcess.java
M modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportDao.java
M src-test/src/org/openbravo/advpaymentmngt/test/FundsTransferTest.java
M src-test/src/org/openbravo/test/costing/utils/TestCostingUtils.java
M src-test/src/org/openbravo/test/taxes/TaxesTest.java
M src/org/openbravo/common/actionhandler/OrderCreatePOLines.java
M src/org/openbravo/common/actionhandler/SRMOPickEditLines.java
M src/org/openbravo/common/actionhandler/ServiceOrderLineRelate.java
M src/org/openbravo/common/actionhandler/copyfromorderprocess/UpdatePricesAndAmounts.java
M src/org/openbravo/costing/AverageAlgorithm.java
M src/org/openbravo/costing/CostingMigrationProcess.java
M src/org/openbravo/erpCommon/ad_actionButton/CopyFromInvoice.java
M src/org/openbravo/erpCommon/ad_actionButton/CopyFromOrder.java
M src/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java
M src/org/openbravo/erpCommon/ad_actionButton/CreateWorkEffort.java
M src/org/openbravo/erpCommon/ad_actionButton/ExpenseSOrder.java
M src/org/openbravo/erpCommon/ad_callouts/SE_Expense_Amount.java
M src/org/openbravo/erpCommon/ad_callouts/SE_Expense_Product.java
M src/org/openbravo/erpCommon/ad_callouts/SL_CreateFromMultiple_Conversion.java
M src/org/openbravo/erpCommon/ad_callouts/SL_CreateLines_Conversion_UOM.java
M src/org/openbravo/erpCommon/ad_callouts/SL_GlobalUse_Conversion.java
M src/org/openbravo/erpCommon/ad_callouts/SL_InOut_Conversion.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Internal_Consumption_Conversion.java
M src/org/openbravo/erpCommon/ad_callouts/SL_InvAmtUpd_AmtUnitCost.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Inventory_Conversion.java
M src/org/openbravo/erpCommon/ad_callouts/SL_InvoiceTax_Amt.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Amt.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Conversion.java
M src/org/openbravo/erpCommon/ad_callouts/SL_JournalLineAmt.java
M src/org/openbravo/erpCommon/ad_callouts/SL_MachineCost.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Movement_Conversion.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Order_Conversion.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product.java
M src/org/openbravo/erpCommon/ad_callouts/SL_ProductionPlan_Conversion.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Production_Conversion.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Project_Margin.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Project_Planned.java
M src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Amt.java
M src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Conversion.java
M src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Product.java
M src/org/openbravo/erpCommon/ad_callouts/SL_SequenceProduct_Conversion.java
M src/org/openbravo/erpCommon/ad_callouts/SL_WorkRequirement_Conversion.java
M src/org/openbravo/erpCommon/ad_forms/AcctServer.java
M src/org/openbravo/erpCommon/ad_forms/DocDoubtfulDebt.java
M src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java
M src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java
M src/org/openbravo/erpCommon/ad_forms/DocFINReconciliation.java
M src/org/openbravo/erpCommon/ad_forms/DocInvoice.java
M src/org/openbravo/erpCommon/ad_forms/DocLCCost.java
M src/org/openbravo/erpCommon/ad_forms/DocMatchInv.java
M src/org/openbravo/erpCommon/ad_forms/FactLine.java
M src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPending.java
M src/org/openbravo/erpCommon/ad_process/ConvertQuotationIntoOrder.java
M src/org/openbravo/erpCommon/ad_process/CreateCashFlowStatement.java
M src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice.java
M src/org/openbravo/erpCommon/ad_process/PaymentMonitor.java
M src/org/openbravo/erpCommon/ad_reports/MInOutTraceReports.java
M src/org/openbravo/erpCommon/ad_reports/ReportParetoProduct.java
M src/org/openbravo/erpCommon/ad_reports/ReportProjectProgress.java
M src/org/openbravo/erpCommon/businessUtility/PriceAdjustment.java
M src/org/openbravo/event/ServiceRelationEventHandler.java
---
(0102819)
hgbot   
2018-02-23 11:21   
Repository: erp/devel/pi
Changeset: bdaaadb9d483c6c7708477eeb9b19c875c019aad
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Thu Feb 22 10:49:57 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/bdaaadb9d483c6c7708477eeb9b19c875c019aad [^]

Related to Issue 37964. While setting the precission for a BigDecimal,
use the RoundingMode class to retrieve the precission instead of setting
the constant value manually. It makes the code easier to read by using
RoundingMode

---
M src/org/openbravo/erpCommon/ad_callouts/SE_CalculateExchangeRate.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Conversion_Rate.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Payment_Amounts.java
---
(0102820)
hgbot   
2018-02-23 11:21   
Repository: erp/devel/pi
Changeset: 5312e81083972045d1db1a804ccee1608339f61a
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Thu Feb 22 11:33:30 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/5312e81083972045d1db1a804ccee1608339f61a [^]

Related to Issue 37964.

Added missing RoundingMode (it was a mistake done by the developer, it was
intended to round to 2 decimals)
Changed wrong Logger class definitions

---
M src-test/src/org/openbravo/advpaymentmngt/test/PaymentTest_02.java
M src-test/src/org/openbravo/advpaymentmngt/test/PaymentTest_03.java
---
(0102822)
dmiguelez   
2018-02-23 11:22   
Code Review + Testing Ok
(0102948)
hudsonbot   
2018-03-02 21:18   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/05dece3dc80b [^]
Maturity status: Test
(0102949)
hudsonbot   
2018-03-02 21:18   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/05dece3dc80b [^]
Maturity status: Test
(0102950)
hudsonbot   
2018-03-02 21:18   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/05dece3dc80b [^]
Maturity status: Test