enable testResume4 - related to GERONIMO-4448
git-svn-id: https://svn.apache.org/repos/asf/geronimo/components/txmanager/trunk@725423 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java b/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java
index 0bb54a5..8e14010 100644
--- a/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java
+++ b/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java
@@ -176,10 +176,10 @@
}
public void resume(Transaction tx) throws IllegalStateException, InvalidTransactionException, SystemException {
- if (getTransaction() != null) {
+ if (getTransaction() != null && tx != getTransaction()) {
throw new IllegalStateException("Thread already associated with another transaction");
}
- if (tx != null) {
+ if (tx != null && tx != getTransaction()) {
if (!(tx instanceof TransactionImpl)) {
throw new InvalidTransactionException("Cannot resume foreign transaction: " + tx);
}
diff --git a/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TransactionManagerImplTest.java b/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TransactionManagerImplTest.java
index e46adbe..b2e15e8 100644
--- a/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TransactionManagerImplTest.java
+++ b/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TransactionManagerImplTest.java
@@ -395,7 +395,7 @@
}
// resume works on any valid tx
- /*public void testResume4() throws Exception {
+ public void testResume4() throws Exception {
Transaction tx;
assertEquals(Status.STATUS_NO_TRANSACTION, tm.getStatus());
tm.begin();
@@ -409,7 +409,7 @@
assertNotNull(tx);
assertEquals(Status.STATUS_ACTIVE, tx.getStatus());
} catch (InvalidTransactionException e) {
- // null is considered valid so we don't expect InvalidTransactionException here
+ // tx is considered valid so we don't expect InvalidTransactionException here
e.printStackTrace();
fail();
}
@@ -417,5 +417,5 @@
tm.commit();
assertEquals(Status.STATUS_NO_TRANSACTION, tm.getStatus());
assertNull(tm.getTransaction());
- }*/
+ }
}