Author: jaz
Date: Wed Mar 28 14:35:47 2007
New Revision: 523470

URL: http://svn.apache.org/viewvc?view=rev&rev=523470
Log:
added checks to make sure that the balance fields are not null; and use ZERO 
instead

Modified:
    
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java

Modified: 
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java?view=diff&rev=523470&r1=523469&r2=523470
==============================================================================
--- 
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
 (original)
+++ 
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
 Wed Mar 28 14:35:47 2007
@@ -485,6 +485,9 @@
 
         // check the actual balance (excluding authorized amounts) and create 
the transaction if it is sufficient
         BigDecimal previousBalance = finAccount.getBigDecimal("actualBalance");
+        if (previousBalance == null) {
+            previousBalance = FinAccountHelper.ZERO;
+        }
 
         BigDecimal balance;
         String refNum;
@@ -506,6 +509,11 @@
             }
         }
 
+        // make sure balance is not null
+        if (balance == null) {
+            balance = FinAccountHelper.ZERO;
+        }
+
         Map result = ServiceUtil.returnSuccess();
         result.put("previousBalance", new 
Double(previousBalance.doubleValue()));
         result.put("balance", new Double(balance.doubleValue()));
@@ -558,6 +566,9 @@
         
         // get the previous balance
         BigDecimal previousBalance = finAccount.getBigDecimal("actualBalance");
+        if (previousBalance == null) {
+            previousBalance = FinAccountHelper.ZERO;    
+        }
 
         // create the transaction
         BigDecimal balance;
@@ -570,6 +581,11 @@
         } catch (GeneralException e) {
             Debug.logError(e, module);
             return ServiceUtil.returnError(e.getMessage());
+        }
+
+        // make sure balance is not null
+        if (balance == null) {
+            balance = FinAccountHelper.ZERO;
         }
 
         Map result = ServiceUtil.returnSuccess();


Reply via email to