You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2014/07/30 08:40:54 UTC
svn commit: r1614559 - in /ofbiz/branches/release11.04: ./
applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
Author: jleroux
Date: Wed Jul 30 06:40:53 2014
New Revision: 1614559
URL: http://svn.apache.org/r1614559
Log:
"Applied fix from trunk for revision: 1614556"
------------------------------------------------------------------------
r1614556 | jleroux | 2014-07-30 08:40:23 +0200 (mer. 30 juil. 2014) | 1 ligne
Fixes a possible ArithmeticException: Division undefined
------------------------------------------------------------------------
Modified:
ofbiz/branches/release11.04/ (props changed)
ofbiz/branches/release11.04/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
Propchange: ofbiz/branches/release11.04/
------------------------------------------------------------------------------
Merged /ofbiz/trunk:r1614556
Modified: ofbiz/branches/release11.04/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java?rev=1614559&r1=1614558&r2=1614559&view=diff
==============================================================================
--- ofbiz/branches/release11.04/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java (original)
+++ ofbiz/branches/release11.04/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java Wed Jul 30 06:40:53 2014
@@ -512,7 +512,10 @@ public class InvoiceWorker {
List<GenericValue> acctgTransEntries = invoice.getRelated("AcctgTrans");
if (UtilValidate.isNotEmpty(acctgTransEntries)) {
GenericValue acctgTransEntry = (acctgTransEntries.get(0)).getRelated("AcctgTransEntry").get(0);
- conversionRate = acctgTransEntry.getBigDecimal("amount").divide(acctgTransEntry.getBigDecimal("origAmount"), new MathContext(100)).setScale(decimals,rounding);
+ BigDecimal origAmount = acctgTransEntry.getBigDecimal("origAmount");
+ if (origAmount.compareTo(ZERO) == 1) {
+ conversionRate = acctgTransEntry.getBigDecimal("amount").divide(acctgTransEntry.getBigDecimal("origAmount"), new MathContext(100)).setScale(decimals,rounding);
+ }
}
// check if a payment is applied and use the currency conversion from there
if (UtilValidate.isEmpty(conversionRate)) {