From e2fdfddaccfd09a3241656dba9367be3f1f8af20 Mon Sep 17 00:00:00 2001 From: hieplq Date: Sat, 6 Sep 2014 18:40:11 +0700 Subject: [PATCH] IDEMPIERE-1665:matching PO-receipt error make session break --- .../src/org/compiere/apps/form/Match.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/org.adempiere.ui/src/org/compiere/apps/form/Match.java b/org.adempiere.ui/src/org/compiere/apps/form/Match.java index fb97c4594b..0147048172 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/Match.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/Match.java @@ -206,12 +206,19 @@ public class Match // Create it String innerTrxName = Trx.createTrxName("Match"); Trx innerTrx = Trx.get(innerTrxName, true); - if (createMatchRecord(invoice, M_InOutLine_ID, Line_ID, BigDecimal.valueOf(qty), innerTrxName)) - innerTrx.commit(); - else + + try{ + if (createMatchRecord(invoice, M_InOutLine_ID, Line_ID, BigDecimal.valueOf(qty), innerTrxName)) + innerTrx.commit(); + else + innerTrx.rollback(); + }catch(Exception ex){ innerTrx.rollback(); - innerTrx.close(); - innerTrx = null; + throw new AdempiereException(ex); + }finally{ + innerTrx.close(); + innerTrx = null; + } } } // requery