From 694aa1242ba3bc2eb1457c8b67c9f171b4984d51 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 23 Oct 2011 09:48:44 -0500 Subject: [PATCH] IDEMPIERE-87 AdempiereTestCase must not close the transaction when committing/rolling back http://jira.idempiere.com/browse/IDEMPIERE-87 --- .../src/test/AdempiereTestCase.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/org.adempiere.extend/src/test/AdempiereTestCase.java b/org.adempiere.extend/src/test/AdempiereTestCase.java index b0b85a3197..30acdedff6 100644 --- a/org.adempiere.extend/src/test/AdempiereTestCase.java +++ b/org.adempiere.extend/src/test/AdempiereTestCase.java @@ -171,13 +171,8 @@ public class AdempiereTestCase extends TestCase if (trxName != null) trx = Trx.get(trxName, false); if (trx != null && trx.isActive()) { - try { - trx.commit(true); - } finally { - trx.close(); - } + trx.commit(true); } - trx = null; } /** @@ -188,13 +183,20 @@ public class AdempiereTestCase extends TestCase if (trxName != null) trx = Trx.get(trxName, false); if (trx != null && trx.isActive()) { - try { - trx.rollback(); - } finally { - trx.close(); - } + trx.rollback(); + } + } + + /** + * Close active transaction + */ + protected void close() { + Trx trx = null; + if (trxName != null) + trx = Trx.get(trxName, false); + if (trx != null) { + trx.close(); } - trx = null; } @Override @@ -207,6 +209,8 @@ public class AdempiereTestCase extends TestCase trx = Trx.get(trxName, false); if (trx != null && trx.isActive()) { trx.rollback(); + } + if (trx != null) { trx.close(); } trx = null;