svn commit: r1824127 - in /ofbiz/ofbiz-framework/trunk/applications: accounting/src/main/java/org/apache/ofbiz/accounting/agreement/ accounting/src/main/java/org/apache/ofbiz/accounting/invoice/ accounting/src/main/java/org/apache/ofbiz/accounting/paym...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1824127 - in /ofbiz/ofbiz-framework/trunk/applications: accounting/src/main/java/org/apache/ofbiz/accounting/agreement/ accounting/src/main/java/org/apache/ofbiz/accounting/invoice/ accounting/src/main/java/org/apache/ofbiz/accounting/paym...

jleroux@apache.org
Author: jleroux
Date: Tue Feb 13 12:47:11 2018
New Revision: 1824127

URL: http://svn.apache.org/viewvc?rev=1824127&view=rev
Log:
Improved: Replace all "BigDecimal ZERO" by BigDecimal.ZERO
(OFBIZ-9572)

Replace (and removes) "BigDecimal ZERO" by BigDecimal.ZERO where a ZERO var
makes no sense, ie when no scale/rounding is used.

Replaces the pattern for ZERO var creation in several files using
new UtilNumber.getRoundingMode()

No ZERO var creation and scale/rounding when confusion with several scale and
rounding is possible hence just BigDecimal.ZERO used.
Like in InvoiceServices.java and InvoiceWorker.java


Modified:
    ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java
    ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
    ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java
    ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java
    ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
    ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
    ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java
    ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickServices.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageServices.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java?rev=1824127&r1=1824126&r2=1824127&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java Tue Feb 13 12:47:11 2018
@@ -20,6 +20,7 @@
 package org.apache.ofbiz.accounting.agreement;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
@@ -45,16 +46,9 @@ public class AgreementServices {
 
     public static final String module = AgreementServices.class.getName();
     // set some BigDecimal properties
-    private static BigDecimal ZERO = BigDecimal.ZERO;
-    private static int decimals = -1;
-    private static int rounding = -1;
-    static {
-        decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
-        rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
-
-        // set zero to the proper scale
-        if (decimals != -1) ZERO = ZERO.setScale(decimals, rounding);
-    }
+    public static final int decimals = UtilNumber.getBigDecimalScale("finaccount.decimals");
+    public static final RoundingMode rounding = UtilNumber.getRoundingMode("finaccount.rounding");
+    public static final BigDecimal ZERO = BigDecimal.ZERO.setScale(decimals, rounding);
     public static final String resource = "AccountingUiLabels";
 
     /**

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java?rev=1824127&r1=1824126&r2=1824127&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java Tue Feb 13 12:47:11 2018
@@ -108,7 +108,6 @@ public class InvoiceServices {
     public static final String module = InvoiceServices.class.getName();
 
     // set some BigDecimal properties
-    private static final BigDecimal ZERO = BigDecimal.ZERO;
     private static final int DECIMALS = UtilNumber.getBigDecimalScale("invoice.decimals");
     private static final RoundingMode ROUNDING = UtilNumber.getRoundingMode("invoice.rounding");
     private static final int TAX_DECIMALS = UtilNumber.getBigDecimalScale("salestax.calc.decimals");
@@ -217,10 +216,10 @@ public class InvoiceServices {
             BigDecimal orderQuantity = orh.getTotalOrderItemsQuantity();
 
             // these variables are for pro-rating order amounts across invoices, so they should not be rounded off for maximum accuracy
-            BigDecimal invoiceShipProRateAmount = ZERO;
-            BigDecimal invoiceShippableQuantity = ZERO;
-            BigDecimal invoiceSubTotal = ZERO;
-            BigDecimal invoiceQuantity = ZERO;
+            BigDecimal invoiceShipProRateAmount = BigDecimal.ZERO;
+            BigDecimal invoiceShippableQuantity = BigDecimal.ZERO;
+            BigDecimal invoiceSubTotal = BigDecimal.ZERO;
+            BigDecimal invoiceQuantity = BigDecimal.ZERO;
 
             GenericValue billingAccount = orderHeader.getRelatedOne("BillingAccount", false);
             String billingAccountId = billingAccount != null ? billingAccount.getString("billingAccountId") : null;
@@ -406,7 +405,7 @@ public class InvoiceServices {
                     billingQuantity = itemIssuance.getBigDecimal("quantity");
                     BigDecimal cancelQty = itemIssuance.getBigDecimal("cancelQuantity");
                     if (cancelQty == null) {
-                        cancelQty = ZERO;
+                        cancelQty = BigDecimal.ZERO;
                     }
                     billingQuantity = billingQuantity.subtract(cancelQty).setScale(DECIMALS, ROUNDING);
                 } else if (shipmentReceipt != null) {
@@ -415,12 +414,12 @@ public class InvoiceServices {
                     BigDecimal orderedQuantity = OrderReadHelper.getOrderItemQuantity(orderItem);
                     BigDecimal invoicedQuantity = OrderReadHelper.getOrderItemInvoicedQuantity(orderItem);
                     billingQuantity = orderedQuantity.subtract(invoicedQuantity);
-                    if (billingQuantity.compareTo(ZERO) < 0) {
-                        billingQuantity = ZERO;
+                    if (billingQuantity.compareTo(BigDecimal.ZERO) < 0) {
+                        billingQuantity = BigDecimal.ZERO;
                     }
                 }
                 if (billingQuantity == null) {
-                    billingQuantity = ZERO;
+                    billingQuantity = BigDecimal.ZERO;
                 }
 
                 // check if shipping applies to this item.  Shipping is calculated for sales invoices, not purchase invoices.
@@ -568,7 +567,7 @@ public class InvoiceServices {
                     }
 
                     BigDecimal originalOrderItemQuantity = OrderReadHelper.getOrderItemQuantity(originalOrderItem);
-                    BigDecimal amount = ZERO;
+                    BigDecimal amount = BigDecimal.ZERO;
                     if (originalOrderItemQuantity.signum() != 0) {
                         if (adj.get("amount") != null) {
                                 if("PROMOTION_ADJUSTMENT".equals(adj.getString("orderAdjustmentTypeId")) && adj.get("productPromoId") != null) {
@@ -972,7 +971,7 @@ public class InvoiceServices {
             // Map of commission Lists (of Maps) for each party.
             // Determine commissions for various parties.
             for (GenericValue invoiceItem : invoiceItems) {
-                BigDecimal amount = ZERO;
+                BigDecimal amount = BigDecimal.ZERO;
                 BigDecimal quantity = invoiceItem.getBigDecimal("quantity");
                 amount = invoiceItem.getBigDecimal("amount");
                 amount = isReturn ? amount.negate() : amount;
@@ -1498,7 +1497,7 @@ public class InvoiceServices {
 
             // now we will check each issuance and make sure it hasn't already been billed
             for (GenericValue issue : billItems) {
-                BigDecimal issueQty = ZERO;
+                BigDecimal issueQty = BigDecimal.ZERO;
 
                 if ("ShipmentReceipt".equals(issue.getEntityName())) {
                     issueQty = issue.getBigDecimal("quantityAccepted");
@@ -1540,7 +1539,7 @@ public class InvoiceServices {
 
                     // add up the already billed total
                     if (billed.size() > 0) {
-                        BigDecimal billedQuantity = ZERO;
+                        BigDecimal billedQuantity = BigDecimal.ZERO;
                         for (GenericValue oib : billed) {
                             BigDecimal qty = oib.getBigDecimal("quantity");
                             if (qty != null) {
@@ -1563,11 +1562,11 @@ public class InvoiceServices {
                         } else {
                             issue.set("quantity", billAvail);
                         }
-                        billAvail = ZERO;
+                        billAvail = BigDecimal.ZERO;
                     } else {
                         // now have been billed
                         if(issueQty == null){
-                            issueQty = ZERO;
+                            issueQty = BigDecimal.ZERO;
                         }
                         billAvail = billAvail.subtract(issueQty).setScale(DECIMALS, ROUNDING);
                     }
@@ -1635,7 +1634,7 @@ public class InvoiceServices {
 
                 // Total the additional shipping charges for the shipments
                 Map<GenericValue, BigDecimal> additionalShippingCharges = new HashMap<>();
-                BigDecimal totalAdditionalShippingCharges = ZERO;
+                BigDecimal totalAdditionalShippingCharges = BigDecimal.ZERO;
                 if (UtilValidate.isNotEmpty(invoiceableShipments)) {
                     for (GenericValue shipment : invoiceableShipments) {
                         if (shipment.get("additionalShippingCharge") == null) {
@@ -2077,8 +2076,8 @@ public class InvoiceServices {
             String invoiceId = (String) serviceResults.get("invoiceId");
 
             // keep track of the invoice total vs the promised return total (how much the customer promised to return)
-            BigDecimal invoiceTotal = ZERO;
-            BigDecimal promisedTotal = ZERO;
+            BigDecimal invoiceTotal = BigDecimal.ZERO;;
+            BigDecimal promisedTotal = BigDecimal.ZERO;
 
             // loop through shipment receipts to create invoice items and return item billings for each item and adjustment
             int invoiceItemSeqNum = 1;
@@ -2169,14 +2168,14 @@ public class InvoiceServices {
                 invoiceItemSeqId = UtilFormatOut.formatPaddedNumber(invoiceItemSeqNum, INVOICE_ITEM_SEQUENCE_ID_DIGITS);
 
                 // keep a running total (note: a returnItem may have many receipts. hence, the promised total quantity is the receipt quantityAccepted + quantityRejected)
-                BigDecimal cancelQuantity = ZERO;
+                BigDecimal cancelQuantity = BigDecimal.ZERO;
                 if (shipmentReceiptFound) {
                     cancelQuantity = item.getBigDecimal("quantityRejected");
                 } else if (itemIssuanceFound) {
                     cancelQuantity = item.getBigDecimal("cancelQuantity");
                 }
                 if (cancelQuantity == null) {
-                    cancelQuantity = ZERO;
+                    cancelQuantity = BigDecimal.ZERO;
                 }
                 BigDecimal actualAmount = returnPrice.multiply(quantity).setScale(DECIMALS, ROUNDING);
                 BigDecimal promisedAmount = returnPrice.multiply(quantity.add(cancelQuantity)).setScale(DECIMALS, ROUNDING);
@@ -2245,7 +2244,7 @@ public class InvoiceServices {
             }
 
             // ratio of the invoice total to the promised total so far or zero if the amounts were zero
-            BigDecimal actualToPromisedRatio = ZERO;
+            BigDecimal actualToPromisedRatio = BigDecimal.ZERO;
             if (invoiceTotal.signum() != 0) {
                 actualToPromisedRatio = invoiceTotal.divide(promisedTotal, 100, ROUNDING);  // do not round ratio
             }
@@ -2372,10 +2371,10 @@ public class InvoiceServices {
             }
         }
 
-        BigDecimal totalPayments = ZERO;
+        BigDecimal totalPayments = BigDecimal.ZERO;
         for (BigDecimal amount : payments.values()) {
             if (amount == null) {
-                amount = ZERO;
+                amount = BigDecimal.ZERO;
             }
             totalPayments = totalPayments.add(amount).setScale(DECIMALS, ROUNDING);
         }
@@ -2413,11 +2412,11 @@ public class InvoiceServices {
 
     private static BigDecimal calcHeaderAdj(Delegator delegator, GenericValue adj, String invoiceTypeId, String invoiceId, String invoiceItemSeqId,
             BigDecimal divisor, BigDecimal multiplier, BigDecimal baseAmount, int decimals, RoundingMode rounding, GenericValue userLogin, LocalDispatcher dispatcher, Locale locale) {
-        BigDecimal adjAmount = ZERO;
+        BigDecimal adjAmount = BigDecimal.ZERO;
         if (adj.get("amount") != null) {
 
             // pro-rate the amount
-            BigDecimal amount = ZERO;
+            BigDecimal amount = BigDecimal.ZERO;
             if("DONATION_ADJUSTMENT".equals(adj.getString("orderAdjustmentTypeId"))) {
                 amount=baseAmount;
             } else if (divisor.signum() != 0) { // make sure the divisor is not 0 to avoid NaN problems; just leave the amount as 0 and skip it in essense
@@ -2473,7 +2472,7 @@ public class InvoiceServices {
             // pro-rate the amount
             BigDecimal percent = adj.getBigDecimal("sourcePercentage");
             percent = percent.divide(new BigDecimal(100), 100, rounding);
-            BigDecimal amount = ZERO;
+            BigDecimal amount = BigDecimal.ZERO;
             // make sure the divisor is not 0 to avoid NaN problems; just leave the amount as 0 and skip it in essense
             if (divisor.signum() != 0) {
                 // multiply first then divide to avoid rounding errors
@@ -2577,7 +2576,7 @@ public class InvoiceServices {
         if (amountApplied != null) {
             context.put("amountApplied", amountApplied);
         } else {
-            context.put("amountApplied", ZERO);
+            context.put("amountApplied", BigDecimal.ZERO);
         }
 
         return updatePaymentApplicationDefBd(dctx, context);
@@ -2686,7 +2685,7 @@ public class InvoiceServices {
 
         // avoid null pointer exceptions.
         if (amountApplied == null) {
-            amountApplied = ZERO;
+            amountApplied = BigDecimal.ZERO;
         }
         // makes no sense to have an item numer without an invoice number
         if (invoiceId == null) {
@@ -2696,7 +2695,7 @@ public class InvoiceServices {
         // retrieve all information and perform checking on the retrieved info.....
 
         // Payment.....
-        BigDecimal paymentApplyAvailable = ZERO;
+        BigDecimal paymentApplyAvailable = BigDecimal.ZERO;
         // amount available on the payment reduced by the already applied amounts
         GenericValue payment = null;
         String currencyUomId = null;
@@ -2729,7 +2728,7 @@ public class InvoiceServices {
         }
 
         // the "TO" Payment.....
-        BigDecimal toPaymentApplyAvailable = ZERO;
+        BigDecimal toPaymentApplyAvailable = BigDecimal.ZERO;
         GenericValue toPayment = null;
         if (toPaymentId != null && !toPaymentId.equals("")) {
             try {
@@ -2830,9 +2829,9 @@ public class InvoiceServices {
         }
 
         // get the invoice (item) information
-        BigDecimal invoiceApplyAvailable = ZERO;
+        BigDecimal invoiceApplyAvailable = BigDecimal.ZERO;
         // amount available on the invoice reduced by the already applied amounts
-        BigDecimal invoiceItemApplyAvailable = ZERO;
+        BigDecimal invoiceItemApplyAvailable = BigDecimal.ZERO;
         // amount available on the invoiceItem reduced by the already applied amounts
         GenericValue invoice = null;
         GenericValue invoiceItem = null;
@@ -3024,12 +3023,12 @@ public class InvoiceServices {
 
                 // check if the payment for too much application if an existing
                 // application record is changed
-                if (paymentApplyAvailable.compareTo(ZERO) == 0) {
+                if (paymentApplyAvailable.compareTo(BigDecimal.ZERO) == 0) {
                     newPaymentApplyAvailable = paymentApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied).setScale(DECIMALS, ROUNDING);
                 } else {
                     newPaymentApplyAvailable = paymentApplyAvailable.add(paymentApplyAvailable).subtract(amountApplied).setScale(DECIMALS, ROUNDING);
                 }
-                if (newPaymentApplyAvailable.compareTo(ZERO) < 0) {
+                if (newPaymentApplyAvailable.compareTo(BigDecimal.ZERO) < 0) {
                     errorMessageList.add(UtilProperties.getMessage(resource,
                             "AccountingPaymentNotEnough",
                             UtilMisc.<String, Object>toMap("paymentId", paymentId,
@@ -3045,7 +3044,7 @@ public class InvoiceServices {
                         // record for the whole invoice
                         if (invoiceItemSeqId == null && paymentApplication.get("invoiceItemSeqId") == null) {
                             newInvoiceApplyAvailable = invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied).setScale(DECIMALS, ROUNDING);
-                            if (invoiceApplyAvailable.compareTo(ZERO) < 0) {
+                            if (invoiceApplyAvailable.compareTo(BigDecimal.ZERO) < 0) {
                                 errorMessageList.add(UtilProperties.getMessage(resource,
                                         "AccountingInvoiceNotEnough",
                                         UtilMisc.<String, Object>toMap("tooMuch", newInvoiceApplyAvailable.negate(),
@@ -3054,7 +3053,7 @@ public class InvoiceServices {
                         } else if (invoiceItemSeqId == null && paymentApplication.get("invoiceItemSeqId") != null) {
                             // check if the item number changed from a real Item number to a null value
                             newInvoiceApplyAvailable = invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied).setScale(DECIMALS, ROUNDING);
-                            if (invoiceApplyAvailable.compareTo(ZERO) < 0) {
+                            if (invoiceApplyAvailable.compareTo(BigDecimal.ZERO) < 0) {
                                 errorMessageList.add(UtilProperties.getMessage(resource,
                                         "AccountingInvoiceNotEnough",
                                         UtilMisc.<String, Object>toMap("tooMuch", newInvoiceApplyAvailable.negate(),
@@ -3064,7 +3063,7 @@ public class InvoiceServices {
                             // check if the item number changed from a null value to
                             // a real Item number
                             newInvoiceItemApplyAvailable = invoiceItemApplyAvailable.subtract(amountApplied).setScale(DECIMALS, ROUNDING);
-                            if (newInvoiceItemApplyAvailable.compareTo(ZERO) < 0) {
+                            if (newInvoiceItemApplyAvailable.compareTo(BigDecimal.ZERO) < 0) {
                                 errorMessageList.add(UtilProperties.getMessage(resource,
                                         "AccountingItemInvoiceNotEnough",
                                         UtilMisc.<String, Object>toMap("tooMuch", newInvoiceItemApplyAvailable.negate(),
@@ -3075,7 +3074,7 @@ public class InvoiceServices {
                             // check if the real item numbers the same
                             // item number the same numeric value
                             newInvoiceItemApplyAvailable = invoiceItemApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied).setScale(DECIMALS, ROUNDING);
-                            if (newInvoiceItemApplyAvailable.compareTo(ZERO) < 0) {
+                            if (newInvoiceItemApplyAvailable.compareTo(BigDecimal.ZERO) < 0) {
                                 errorMessageList.add(UtilProperties.getMessage(resource,
                                         "AccountingItemInvoiceNotEnough",
                                         UtilMisc.<String, Object>toMap("tooMuch", newInvoiceItemApplyAvailable.negate(),
@@ -3085,7 +3084,7 @@ public class InvoiceServices {
                         } else {
                             // item number changed only check new item
                             newInvoiceItemApplyAvailable = invoiceItemApplyAvailable.add(amountApplied).setScale(DECIMALS, ROUNDING);
-                            if (newInvoiceItemApplyAvailable.compareTo(ZERO) < 0) {
+                            if (newInvoiceItemApplyAvailable.compareTo(BigDecimal.ZERO) < 0) {
                                 errorMessageList.add(UtilProperties.getMessage(resource,
                                         "AccountingItemInvoiceNotEnough",
                                         UtilMisc.<String, Object>toMap("tooMuch", newInvoiceItemApplyAvailable.negate(),
@@ -3108,7 +3107,7 @@ public class InvoiceServices {
 
                         // check the invoice
                         newInvoiceApplyAvailable = invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied").subtract(amountApplied)).setScale(DECIMALS, ROUNDING);
-                        if (newInvoiceApplyAvailable.compareTo(ZERO) < 0) {
+                        if (newInvoiceApplyAvailable.compareTo(BigDecimal.ZERO) < 0) {
                             errorMessageList.add(UtilProperties.getMessage(resource,
                                     "AccountingInvoiceNotEnough",
                                     UtilMisc.<String, Object>toMap("tooMuch", invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied),
@@ -3121,7 +3120,7 @@ public class InvoiceServices {
                 // changed,
                 if (toPaymentId != null && toPaymentId.equals(paymentApplication.getString("toPaymentId"))) {
                     newToPaymentApplyAvailable = toPaymentApplyAvailable.subtract(paymentApplication.getBigDecimal("amountApplied")).add(amountApplied).setScale(DECIMALS, ROUNDING);
-                    if (newToPaymentApplyAvailable.compareTo(ZERO) < 0) {
+                    if (newToPaymentApplyAvailable.compareTo(BigDecimal.ZERO) < 0) {
                         errorMessageList.add(UtilProperties.getMessage(resource,
                                 "AccountingPaymentNotEnough",
                                 UtilMisc.<String, Object>toMap("paymentId", toPaymentId,
@@ -3132,7 +3131,7 @@ public class InvoiceServices {
                     // billing account entered number has changed so we have to
                     // check the new billing account number.
                     newToPaymentApplyAvailable = toPaymentApplyAvailable.add(amountApplied).setScale(DECIMALS, ROUNDING);
-                    if (newToPaymentApplyAvailable.compareTo(ZERO) < 0) {
+                    if (newToPaymentApplyAvailable.compareTo(BigDecimal.ZERO) < 0) {
                         errorMessageList.add(UtilProperties.getMessage(resource,
                                 "AccountingPaymentNotEnough",
                                 UtilMisc.<String, Object>toMap("paymentId", toPaymentId,
@@ -3271,7 +3270,7 @@ public class InvoiceServices {
                 paymentApplyAvailable = amountApplied;
             }
             for (GenericValue currentInvoiceItem : invoiceItems) {
-                if (paymentApplyAvailable.compareTo(ZERO) > 0) {
+                if (paymentApplyAvailable.compareTo(BigDecimal.ZERO) > 0) {
                     break;
                 }
                 if (debug) {
@@ -3292,9 +3291,9 @@ public class InvoiceServices {
                 } catch (GenericEntityException e) {
                     return ServiceUtil.returnError(e.getMessage());
                 }
-                BigDecimal tobeApplied = ZERO;
+                BigDecimal tobeApplied = BigDecimal.ZERO;
                 // item total amount - already applied (if any)
-                BigDecimal alreadyApplied = ZERO;
+                BigDecimal alreadyApplied = BigDecimal.ZERO;
                 if (UtilValidate.isNotEmpty(paymentApplications)) {
                     // application(s) found, add them all together
                     Iterator<GenericValue> p = paymentApplications.iterator();
@@ -3320,7 +3319,7 @@ public class InvoiceServices {
                     paymentApplyAvailable = paymentApplyAvailable.subtract(tobeApplied);
                 } else {
                     tobeApplied = paymentApplyAvailable;
-                    paymentApplyAvailable = ZERO;
+                    paymentApplyAvailable = BigDecimal.ZERO;
                 }
 
                 // create application payment record but check currency
@@ -3371,7 +3370,7 @@ public class InvoiceServices {
         GenericValue orderAdjustment = (GenericValue) context.get("orderAdjustment");
         Map<String, Object> result = ServiceUtil.returnSuccess();
 
-        BigDecimal invoicedTotal = ZERO;
+        BigDecimal invoicedTotal = BigDecimal.ZERO;
         List<GenericValue> invoicedAdjustments = null;
         try {
             invoicedAdjustments = EntityQuery.use(delegator).from("OrderAdjustmentBilling").where("orderAdjustmentId", orderAdjustment.get("orderAdjustmentId")).queryList();

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java?rev=1824127&r1=1824126&r2=1824127&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java Tue Feb 13 12:47:11 2018
@@ -51,7 +51,6 @@ import org.apache.ofbiz.entity.util.Enti
 public final class InvoiceWorker {
 
     public static final String module = InvoiceWorker.class.getName();
-    private static final BigDecimal ZERO = BigDecimal.ZERO;
     private static final int decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
     private static final RoundingMode rounding = UtilNumber.getRoundingMode("invoice.rounding");
     private static final int taxDecimals = UtilNumber.getBigDecimalScale("salestax.calc.decimals");
@@ -109,7 +108,7 @@ public final class InvoiceWorker {
         }
         BigDecimal amount = invoiceItem.getBigDecimal("amount");
         if (amount == null) {
-            amount = ZERO;
+            amount = BigDecimal.ZERO;
         }
         return quantity.multiply(amount).setScale(decimals, rounding);
     }
@@ -126,7 +125,7 @@ public final class InvoiceWorker {
     }
 
     public static BigDecimal getInvoiceTaxTotal(GenericValue invoice) {
-        BigDecimal taxTotal = ZERO;
+        BigDecimal taxTotal = BigDecimal.ZERO;
         Map<String, Set<String>> taxAuthPartyAndGeos = InvoiceWorker.getInvoiceTaxAuthPartyAndGeos(invoice);
         for (Map.Entry<String, Set<String>> taxAuthPartyGeos : taxAuthPartyAndGeos.entrySet()) {
             String taxAuthPartyId = taxAuthPartyGeos.getKey();
@@ -161,7 +160,7 @@ public final class InvoiceWorker {
       * @return Return the total amount of the invoice
       */
      public static BigDecimal getInvoiceTotal(GenericValue invoice, Boolean actualCurrency) {
-        BigDecimal invoiceTotal = ZERO;
+        BigDecimal invoiceTotal = BigDecimal.ZERO;
         BigDecimal invoiceTaxTotal = InvoiceWorker.getInvoiceTaxTotal(invoice);
 
         List<GenericValue> invoiceItems = null;
@@ -407,7 +406,7 @@ public final class InvoiceWorker {
             throw new IllegalArgumentException("Null delegator is not allowed in this method");
         }
 
-        BigDecimal invoiceApplied = ZERO;
+        BigDecimal invoiceApplied = BigDecimal.ZERO;
         List<GenericValue> paymentApplications = null;
 
         // lookup payment applications which took place before the asOfDateTime for this invoice
@@ -488,7 +487,7 @@ public final class InvoiceWorker {
      * @return the applied total as BigDecimal
      */
     public static BigDecimal getInvoiceItemApplied(GenericValue invoiceItem) {
-        BigDecimal invoiceItemApplied = ZERO;
+        BigDecimal invoiceItemApplied = BigDecimal.ZERO;
         List<GenericValue> paymentApplications = null;
         try {
             paymentApplications = invoiceItem.getRelated("PaymentApplication", null, null, false);
@@ -530,7 +529,7 @@ public final class InvoiceWorker {
             if (UtilValidate.isNotEmpty(acctgTransEntries)) {
                 GenericValue acctgTransEntry = (acctgTransEntries.get(0)).getRelated("AcctgTransEntry", null, null, false).get(0);
                 BigDecimal origAmount = acctgTransEntry.getBigDecimal("origAmount");
-                if (origAmount.compareTo(ZERO) == 1) {
+                if (origAmount.compareTo(BigDecimal.ZERO) == 1) {
                     conversionRate = acctgTransEntry.getBigDecimal("amount").divide(acctgTransEntry.getBigDecimal("origAmount"), new MathContext(100)).setScale(decimals,rounding);
                 }
             }
@@ -591,7 +590,7 @@ public final class InvoiceWorker {
      */
     @Deprecated
     public static Map<String, Object> getInvoiceTaxByTaxAuthGeoAndParty(GenericValue invoice) {
-        BigDecimal taxGrandTotal = ZERO;
+        BigDecimal taxGrandTotal = BigDecimal.ZERO;
         List<Map<String, Object>> taxByTaxAuthGeoAndPartyList = new LinkedList<>();
         List<GenericValue> invoiceItems = null;
         if (invoice != null) {
@@ -623,16 +622,16 @@ public final class InvoiceWorker {
                         //get all records for invoices filtered by taxAuthGeoId and taxAurhPartyId
                         List<GenericValue> invoiceItemsByTaxAuthGeoAndPartyIds = EntityUtil.filterByAnd(invoiceItems, UtilMisc.toMap("taxAuthGeoId", taxAuthGeoId, "taxAuthPartyId", taxAuthPartyId));
                         if (UtilValidate.isNotEmpty(invoiceItemsByTaxAuthGeoAndPartyIds)) {
-                            BigDecimal totalAmount = ZERO;
+                            BigDecimal totalAmount = BigDecimal.ZERO;
                             //Now for each invoiceItem record get and add amount.
                             for (GenericValue invoiceItem : invoiceItemsByTaxAuthGeoAndPartyIds) {
                                 BigDecimal amount = invoiceItem.getBigDecimal("amount");
                                 if (amount == null) {
-                                    amount = ZERO;
+                                    amount = BigDecimal.ZERO;
                                 }
                                 totalAmount = totalAmount.add(amount).setScale(taxDecimals, taxRounding);
                             }
-                            totalAmount = totalAmount.setScale(UtilNumber.getBigDecimalScale("salestax.calc.decimals"), UtilNumber.getBigDecimalRoundingMode("salestax.rounding"));
+                            totalAmount = totalAmount.setScale(UtilNumber.getBigDecimalScale("salestax.calc.decimals"), UtilNumber.getRoundingMode("salestax.rounding"));
                             taxByTaxAuthGeoAndPartyList.add(UtilMisc.<String, Object>toMap("taxAuthPartyId", taxAuthPartyId, "taxAuthGeoId", taxAuthGeoId, "totalAmount", totalAmount));
                             taxGrandTotal = taxGrandTotal.add(totalAmount);
                         }
@@ -737,13 +736,13 @@ public final class InvoiceWorker {
      */
     private static BigDecimal getTaxTotalForInvoiceItems(List<GenericValue> taxInvoiceItems) {
         if (taxInvoiceItems == null) {
-            return ZERO;
+            return BigDecimal.ZERO;
         }
-        BigDecimal taxTotal = ZERO;
+        BigDecimal taxTotal = BigDecimal.ZERO;
         for (GenericValue taxInvoiceItem : taxInvoiceItems) {
             BigDecimal amount = taxInvoiceItem.getBigDecimal("amount");
             if (amount == null) {
-                amount = ZERO;
+                amount = BigDecimal.ZERO;
             }
             BigDecimal quantity = taxInvoiceItem.getBigDecimal("quantity");
             if (quantity == null) {

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java?rev=1824127&r1=1824126&r2=1824127&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java Tue Feb 13 12:47:11 2018
@@ -20,10 +20,10 @@ package org.apache.ofbiz.accounting.paym
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
@@ -54,18 +54,9 @@ public class BillingAccountWorker {
 
     public static final String module = BillingAccountWorker.class.getName();
     public static final String resourceError = "AccountingUiLabels";
-    private static BigDecimal ZERO = BigDecimal.ZERO;
-    private static int decimals = -1;
-    private static int rounding = -1;
-    static {
-        decimals = UtilNumber.getBigDecimalScale("order.decimals");
-        rounding = UtilNumber.getBigDecimalRoundingMode("order.rounding");
-
-        // set zero to the proper scale
-        if (decimals != -1) {
-            ZERO = ZERO.setScale(decimals);
-        }
-    }
+    public static final int decimals = UtilNumber.getBigDecimalScale("order.decimals");
+    public static final RoundingMode rounding = UtilNumber.getRoundingMode("order.rounding");
+    public static final BigDecimal ZERO = BigDecimal.ZERO.setScale(decimals, rounding);
 
     public static List<Map<String, Object>> makePartyBillingAccountList(GenericValue userLogin, String currencyUomId, String partyId, Delegator delegator, LocalDispatcher dispatcher) throws GeneralException {
         List<Map<String, Object>> billingAccountList = new LinkedList<>();

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1824127&r1=1824126&r2=1824127&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java Tue Feb 13 12:47:11 2018
@@ -19,6 +19,7 @@
 package org.apache.ofbiz.accounting.payment;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.sql.Timestamp;
 import java.util.Collection;
 import java.util.Date;
@@ -81,23 +82,13 @@ public class PaymentGatewayServices {
     public static final String REFUND_SERVICE_TYPE = "PRDS_PAY_REFUND";
     public static final String CREDIT_SERVICE_TYPE = "PRDS_PAY_CREDIT";
     private static final int TX_TIME = 300;
-    private static BigDecimal ZERO = BigDecimal.ZERO;
-    private static int decimals;
-    private static int rounding;
+    public static final int decimals = UtilNumber.getBigDecimalScale("order.decimals");
+    public static final RoundingMode rounding = UtilNumber.getRoundingMode("order.rounding");
+    public static final BigDecimal ZERO = BigDecimal.ZERO.setScale(decimals, rounding);
     public static final String resource = "AccountingUiLabels";
     public static final String resourceError = "AccountingErrorUiLabels";
     public static final String resourceOrder = "OrderUiLabels";
 
-    static {
-        decimals = UtilNumber.getBigDecimalScale("order.decimals");
-        rounding = UtilNumber.getBigDecimalRoundingMode("order.rounding");
-
-        // set zero to the proper scale
-        if (decimals != -1) {
-            ZERO = ZERO.setScale(decimals);
-        }
-    }
-
     /**
      * Authorizes a single order preference with an option to specify an amount. The result map has the Booleans
      * "errors" and "finished" which notify the user if there were any errors and if the authorization was finished.

Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=1824127&r1=1824126&r2=1824127&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Tue Feb 13 12:47:11 2018
@@ -19,6 +19,7 @@
 package org.apache.ofbiz.manufacturing.jobshopmgt;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.sql.Timestamp;
 import java.util.Date;
 import java.util.HashMap;
@@ -69,17 +70,9 @@ public class ProductionRunServices {
     public static final String resourceOrder = "OrderErrorUiLabels";
     public static final String resourceProduct = "ProductUiLabels";    
 
-    private static BigDecimal ZERO = BigDecimal.ZERO;
-    private static BigDecimal ONE = BigDecimal.ONE;
-    private static int decimals = -1;
-    private static int rounding = -1;
-    static {
-        decimals = UtilNumber.getBigDecimalScale("order.decimals");
-        rounding = UtilNumber.getBigDecimalRoundingMode("order.rounding");
-        // set zero to the proper scale
-        ZERO = ZERO.setScale(decimals);
-        ONE = ONE.setScale(decimals);
-    }
+    public static final int decimals = UtilNumber.getBigDecimalScale("order.decimals");
+    public static final RoundingMode rounding = UtilNumber.getRoundingMode("finaccount.rounding");
+    public static final BigDecimal ZERO = BigDecimal.ZERO.setScale(decimals, rounding);
 
     /**
      * Cancels a ProductionRun.

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java?rev=1824127&r1=1824126&r2=1824127&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java Tue Feb 13 12:47:11 2018
@@ -20,6 +20,7 @@
 package org.apache.ofbiz.order.order;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.sql.Timestamp;
 import java.util.Date;
 import java.util.HashMap;
@@ -74,18 +75,9 @@ public class OrderReturnServices {
     public static final String resourceProduct = "ProductUiLabels";
 
     //  set some BigDecimal properties
-    private static BigDecimal ZERO = BigDecimal.ZERO;
-    private static int decimals = -1;
-    private static int rounding = -1;
-    static {
-        decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
-        rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
-
-        // set zero to the proper scale
-        if (decimals != -1) {
-            ZERO = ZERO.setScale(decimals);
-        }
-    }
+    public static final int decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
+    public static final RoundingMode rounding = UtilNumber.getRoundingMode("invoice.rounding");
+    public static final BigDecimal ZERO = BigDecimal.ZERO.setScale(decimals, rounding);
 
     // locate the return item's initial inventory item cost
     public static Map<String, Object> getReturnItemInitialCost(DispatchContext dctx, Map<String, ? extends Object> context) {

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1824127&r1=1824126&r2=1824127&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java Tue Feb 13 12:47:11 2018
@@ -94,7 +94,6 @@ public class ShoppingCart implements Ite
     public static final int taxCalcScale = UtilNumber.getBigDecimalScale("salestax.calc.decimals");
     public static final int taxFinalScale = UtilNumber.getBigDecimalScale("salestax.final.decimals");
     public static final RoundingMode taxRounding = UtilNumber.getRoundingMode("salestax.rounding");
-    public static final BigDecimal ZERO = BigDecimal.ZERO;
     public static final MathContext generalRounding = new MathContext(10);
 
 
@@ -2676,7 +2675,7 @@ public class ShoppingCart implements Ite
 
     /** Returns the tax amount from the cart object. */
     public BigDecimal getTotalSalesTax() {
-        BigDecimal totalTax = ZERO;
+        BigDecimal totalTax = BigDecimal.ZERO;
         for (int i = 0; i < shipInfo.size(); i++) {
             CartShipInfo csi = this.getShipInfo(i);
             totalTax = totalTax.add(csi.getTotalTax(this)).setScale(taxCalcScale, taxRounding);
@@ -4858,7 +4857,7 @@ public class ShoppingCart implements Ite
         }
 
         public BigDecimal getTotal() {
-            BigDecimal shipItemTotal = ZERO;
+            BigDecimal shipItemTotal = BigDecimal.ZERO;
             for (CartShipItemInfo info : shipItemInfo.values()) {
                 shipItemTotal = shipItemTotal.add(info.getItemSubTotal());
             }
@@ -4872,7 +4871,7 @@ public class ShoppingCart implements Ite
             public BigDecimal quantity = BigDecimal.ZERO;
 
             public BigDecimal getItemTax(ShoppingCart cart) {
-                BigDecimal itemTax = ZERO;
+                BigDecimal itemTax = BigDecimal.ZERO;
 
                 for (int i = 0; i < itemTaxAdj.size(); i++) {
                     GenericValue v = itemTaxAdj.get(i);
@@ -4968,7 +4967,7 @@ public class ShoppingCart implements Ite
         }
 
         public List<GenericValue> makeOrderPaymentInfos(Delegator delegator, ShoppingCart cart) {
-            BigDecimal maxAmount = ZERO;
+            BigDecimal maxAmount = BigDecimal.ZERO;
             GenericValue valueObj = this.getValueObject(delegator);
             List<GenericValue> values = new LinkedList<>();
             if (valueObj != null) {

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickServices.java?rev=1824127&r1=1824126&r2=1824127&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickServices.java Tue Feb 13 12:47:11 2018
@@ -32,8 +32,6 @@ import org.apache.ofbiz.service.ServiceU
 
 public class VerifyPickServices {
 
-    private static BigDecimal ZERO = BigDecimal.ZERO;
-
     public static Map<String, Object> verifySingleItem(DispatchContext dctx, Map<String, ? extends Object> context) {
         Locale locale = (Locale) context.get("locale");
         VerifyPickSession pickSession = (VerifyPickSession) context.get("verifyPickSession");
@@ -70,7 +68,7 @@ public class VerifyPickServices {
                 String quantityStr = quantityMap.get(rowKey);
                 if (UtilValidate.isNotEmpty(quantityStr)) {
                     BigDecimal quantity = new BigDecimal(quantityStr);
-                    if (quantity.compareTo(ZERO) > 0) {
+                    if (quantity.compareTo(BigDecimal.ZERO) > 0) {
                         try {
                             pickSession.createRow(orderId, orderItemSeqId, shipGroupSeqId, productId, originGeoId, quantity, locale);
                         } catch (Exception ex) {

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java?rev=1824127&r1=1824126&r2=1824127&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java Tue Feb 13 12:47:11 2018
@@ -56,7 +56,6 @@ public class VerifyPickSession implement
 
     private transient Delegator _delegator = null;
     private transient LocalDispatcher _dispatcher = null;
-    private static BigDecimal ZERO = BigDecimal.ZERO;
 
     public VerifyPickSession() {
     }
@@ -112,7 +111,7 @@ public class VerifyPickSession implement
             BigDecimal qtyRemain = quantity;
 
             for (GenericValue reservation : reservations) {
-                if (qtyRemain.compareTo(ZERO) > 0) {
+                if (qtyRemain.compareTo(BigDecimal.ZERO) > 0) {
                     if (!productId.equals(reservation.getRelatedOne("InventoryItem", false).getString("productId"))) {
                         continue;
                     }
@@ -141,7 +140,7 @@ public class VerifyPickSession implement
                     }
                 }
             }
-            if (qtyRemain.compareTo(ZERO) == 0) {
+            if (qtyRemain.compareTo(BigDecimal.ZERO) == 0) {
                 for (Map.Entry<GenericValue, BigDecimal> entry : reserveQtyMap.entrySet()) {
                     GenericValue reservation = entry.getKey();
                     BigDecimal qty = entry.getValue();
@@ -287,7 +286,7 @@ public class VerifyPickSession implement
     }
 
     public BigDecimal getVerifiedQuantity(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, String inventoryItemId) {
-        BigDecimal total = ZERO;
+        BigDecimal total = BigDecimal.ZERO;
         for (VerifyPickSessionRow pickRow : this.getPickRows(orderId)) {
             if (orderItemSeqId.equals(pickRow.getOrderItemSeqId()) && shipGroupSeqId.equals(pickRow.getShipGroupSeqId()) && productId.equals(pickRow.getProductId())) {
                 if (inventoryItemId == null || inventoryItemId.equals(pickRow.getInventoryItemId())) {
@@ -340,7 +339,7 @@ public class VerifyPickSession implement
     }
 
     public BigDecimal getReservedQty(String orderId, String orderItemSeqId, String shipGroupSeqId) {
-        BigDecimal reservedQty = ZERO;
+        BigDecimal reservedQty = BigDecimal.ZERO;
         try {
             GenericValue reservation = EntityUtil.getFirst(this.getDelegator().findByAnd("OrderItemAndShipGrpInvResAndItemSum", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "shipGroupSeqId", shipGroupSeqId), null, false));
             reservedQty = reservation.getBigDecimal("totQuantityAvailable");
@@ -352,8 +351,8 @@ public class VerifyPickSession implement
 
     protected void checkVerifiedQty(String orderId, Locale locale) throws GeneralException {
 
-        BigDecimal verifiedQty = ZERO;
-        BigDecimal orderedQty = ZERO;
+        BigDecimal verifiedQty = BigDecimal.ZERO;
+        BigDecimal orderedQty = BigDecimal.ZERO;
 
         List<GenericValue> orderItems = this.getDelegator().findByAnd("OrderItem", UtilMisc.toMap("orderId", orderId, "statusId", "ITEM_APPROVED"), null, false);
         for (GenericValue orderItem : orderItems) {

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageServices.java?rev=1824127&r1=1824126&r2=1824127&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageServices.java Tue Feb 13 12:47:11 2018
@@ -36,8 +36,6 @@ import org.apache.ofbiz.service.ServiceU
 
 public class WeightPackageServices {
 
-    private static BigDecimal ZERO = BigDecimal.ZERO;
-
     public static Map<String, Object> setPackageInfo(DispatchContext dctx, Map<String, ? extends Object> context) {
         Delegator delegator = dctx.getDelegator();
         WeightPackageSession weightPackageSession = (WeightPackageSession) context.get("weightPackageSession");
@@ -59,13 +57,13 @@ public class WeightPackageServices {
             }
         }
         // Check package weight, it must be greater than ZERO
-        if (UtilValidate.isEmpty(packageWeight) || packageWeight.compareTo(ZERO) <= 0) {
+        if (UtilValidate.isEmpty(packageWeight) || packageWeight.compareTo(BigDecimal.ZERO) <= 0) {
             return ServiceUtil.returnError(UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorPackageWeightCannotBeNullOrZero", locale));
         }
         try {
             // Checked no of packages, it should not be greater than ordered quantity
             List<GenericValue> orderItems = EntityQuery.use(delegator).from("OrderItem").where("orderId", orderId, "statusId", "ITEM_APPROVED").queryList();
-            BigDecimal orderedItemQty = ZERO;
+            BigDecimal orderedItemQty = BigDecimal.ZERO;
             for (GenericValue orderItem : orderItems) {
                 orderedItemQty = orderedItemQty.add(orderItem.getBigDecimal("quantity"));
             }
@@ -104,7 +102,7 @@ public class WeightPackageServices {
         }
 
         // Check package weight, it must be greater than ZERO
-        if (UtilValidate.isEmpty(packageWeight) || packageWeight.compareTo(ZERO) <= 0) {
+        if (UtilValidate.isEmpty(packageWeight) || packageWeight.compareTo(BigDecimal.ZERO) <= 0) {
             return ServiceUtil.returnError(UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorPackageWeightCannotBeNullOrZero", locale));
         }
 
@@ -139,7 +137,7 @@ public class WeightPackageServices {
         BigDecimal newEstimatedShippingCost = (BigDecimal) context.get("newEstimatedShippingCost");
 
         if (UtilValidate.isEmpty(newEstimatedShippingCost)) {
-            newEstimatedShippingCost = ZERO;
+            newEstimatedShippingCost = BigDecimal.ZERO;
         }
 
         weightPackageSession.setDimensionUomId(dimensionUomId);

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=1824127&r1=1824126&r2=1824127&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java Tue Feb 13 12:47:11 2018
@@ -67,7 +67,6 @@ public class WeightPackageSession implem
 
     private transient Delegator _delegator = null;
     private transient LocalDispatcher _dispatcher = null;
-    private static BigDecimal ZERO = BigDecimal.ZERO;
     private static RoundingMode rounding = UtilNumber.getRoundingMode("invoice.rounding");
 
     public WeightPackageSession() {
@@ -204,7 +203,7 @@ public class WeightPackageSession implem
     }
 
     public BigDecimal getShippableWeight(String orderId) {
-        BigDecimal shippableWeight = ZERO;
+        BigDecimal shippableWeight = BigDecimal.ZERO;
         for (WeightPackageSessionLine packedLine : this.getPackedLines(orderId)) {
             shippableWeight = shippableWeight.add(packedLine.getPackageWeight());
         }
@@ -352,7 +351,7 @@ public class WeightPackageSession implem
 
     protected BigDecimal upsShipmentConfirm() throws GeneralException {
         Delegator delegator = this.getDelegator();
-        BigDecimal actualCost = ZERO;
+        BigDecimal actualCost = BigDecimal.ZERO;
         List<GenericValue> shipmentRouteSegments = EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", shipmentId).queryList();
         if (UtilValidate.isNotEmpty(shipmentRouteSegments)) {
             for (GenericValue shipmentRouteSegment : shipmentRouteSegments) {
@@ -391,7 +390,7 @@ public class WeightPackageSession implem
         BigDecimal estimatedShipCost = this.getEstimatedShipCost();
         BigDecimal doEstimates = new BigDecimal(UtilProperties.getPropertyValue("shipment", "shipment.default.cost_actual_over_estimated_percent_allowed", "10"));
         BigDecimal diffInShipCostInPerc;
-        if (estimatedShipCost.compareTo(ZERO) == 0) {
+        if (estimatedShipCost.compareTo(BigDecimal.ZERO) == 0) {
             diffInShipCostInPerc = actualShippingCost;
         } else {
             diffInShipCostInPerc = (((actualShippingCost.subtract(estimatedShipCost)).divide(estimatedShipCost, 2, rounding)).multiply(new BigDecimal(100))).abs();
@@ -498,7 +497,7 @@ public class WeightPackageSession implem
     }
 
     public BigDecimal getShipmentCostEstimate(String shippingContactMechId, String shipmentMethodTypeId, String carrierPartyId, String carrierRoleTypeId, String orderId, String productStoreId, List<GenericValue> shippableItemInfo, BigDecimal shippableTotal, BigDecimal shippableWeight, BigDecimal shippableQuantity) {
-        BigDecimal shipmentCostEstimate = ZERO;
+        BigDecimal shipmentCostEstimate = BigDecimal.ZERO;
         Map<String, Object> shipCostEstimateResult = null;
         try {
             Map<String, Object> shipCostEstimateMap = new HashMap<String, Object>();
@@ -541,7 +540,7 @@ public class WeightPackageSession implem
     }
 
     protected Integer getOrderedQuantity(String orderId) {
-        BigDecimal orderedQuantity = ZERO;
+        BigDecimal orderedQuantity = BigDecimal.ZERO;
         try {
             List<GenericValue> orderItems = getDelegator().findByAnd("OrderItem", UtilMisc.toMap("orderId", orderId, "statusId", "ITEM_APPROVED"), null, false);
             for (GenericValue orderItem : orderItems) {