Author: jleroux
Date: Sat Mar 3 20:46:47 2012
New Revision: 1296697
URL: http://svn.apache.org/viewvc?rev=1296697&view=rev
Log:
Fixes https://issues.apache.org/jira/browse/OFBIZ-4719 "Error
"org.ofbiz.webapp.event.EventHandlerException: Service invocation error (null)"
Took me a moment to decide to commit this changes. But after many researches
and tries I could not find a better solution.
So simply avoid possible NPE there if a wrong paymentId is entered in
createPaymentApplication screen.
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java?rev=1296697&r1=1296696&r2=1296697&view=diff
==============================================================================
---
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java
(original)
+++
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java
Sat Mar 3 20:46:47 2012
@@ -263,7 +263,7 @@ public class PaymentWorker {
}
/**
- * Method to return the total amount of an payment which is applied to a
payment
+ * Method to return the total amount of a payment which is applied to a
payment
* @param payment GenericValue object of the Payment
* @param actual false for currency of the payment, true for the actual
currency
* @return the applied total as BigDecimal in the currency of the payment
@@ -298,7 +298,10 @@ public class PaymentWorker {
}
public static BigDecimal getPaymentNotApplied(GenericValue payment) {
- return
payment.getBigDecimal("amount").subtract(getPaymentApplied(payment)).setScale(decimals,rounding);
+ if (payment != null) {
+ return
payment.getBigDecimal("amount").subtract(getPaymentApplied(payment)).setScale(decimals,rounding);
+ }
+ return BigDecimal.ZERO;
}
public static BigDecimal getPaymentNotApplied(GenericValue payment,
Boolean actual) {