From 8d88f65b66b5dbfabb12c216223bf4a3f6878ce8 Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:02:55 +0700 Subject: [PATCH] exception handling on InvoiceWriteOff.java --- .../org/compiere/process/InvoiceWriteOff.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/InvoiceWriteOff.java b/org.adempiere.base.process/src/org/compiere/process/InvoiceWriteOff.java index d8cde01540..55d04169be 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InvoiceWriteOff.java +++ b/org.adempiere.base.process/src/org/compiere/process/InvoiceWriteOff.java @@ -304,8 +304,12 @@ public class InvoiceWriteOff extends SvrProcess return true; processPayment(); // Process It - if (m_alloc.processIt(DocAction.ACTION_Complete) && m_alloc.save()) - { + if (!m_alloc.processIt(DocAction.ACTION_Complete)) { + log.warning("Allocation Process Failed: " + m_alloc + " - " + m_alloc.getProcessMsg()); + throw new IllegalStateException("Allocation Process Failed: " + m_alloc + " - " + m_alloc.getProcessMsg()); + + } + if (m_alloc.save()) { m_alloc = null; return true; } @@ -323,8 +327,12 @@ public class InvoiceWriteOff extends SvrProcess if (m_payment == null) return true; // Process It - if (m_payment.processIt(DocAction.ACTION_Complete) && m_payment.save()) - { + if (!m_payment.processIt(DocAction.ACTION_Complete)) { + log.warning("Payment Process Failed: " + m_payment + " - " + m_payment.getProcessMsg()); + throw new IllegalStateException("Payment Process Failed: " + m_payment + " - " + m_payment.getProcessMsg()); + } + + if (m_payment.save()) { m_payment = null; return true; }