Resource-based PlatformTransactionManager implementations defensively catch Throwable in doBegin in order to reliably close resource in case of OutOfMemoryError

Issue: SPR-10755
(cherry picked from commit 2e4eb9f)
This commit is contained in:
Juergen Hoeller
2013-07-25 10:45:58 +02:00
committed by unknown
parent 8feeec4a60
commit c1dc4e2c75
7 changed files with 10 additions and 11 deletions
@@ -580,7 +580,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
txObject.getSessionHolder().setSynchronizedWithTransaction(true);
}
catch (Exception ex) {
catch (Throwable ex) {
if (txObject.isNewSession()) {
try {
if (session.getTransaction().isActive()) {
@@ -365,7 +365,7 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
closePersistenceManagerAfterFailedBegin(txObject);
throw ex;
}
catch (Exception ex) {
catch (Throwable ex) {
closePersistenceManagerAfterFailedBegin(txObject);
throw new CannotCreateTransactionException("Could not open JDO PersistenceManager for transaction", ex);
}
@@ -423,7 +423,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
closeEntityManagerAfterFailedBegin(txObject);
throw ex;
}
catch (Exception ex) {
catch (Throwable ex) {
closeEntityManagerAfterFailedBegin(txObject);
throw new CannotCreateTransactionException("Could not open JPA EntityManager for transaction", ex);
}