Don't try to rollback if the failure resulted in the connection being

closed.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1690 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2005-08-08 17:14:56 +00:00
parent b81f4113fc
commit f359b77ff5
@@ -142,9 +142,10 @@ public class SimpleRepository extends Repository
} catch (SQLException sqe) { } catch (SQLException sqe) {
if (attemptedOperation) { if (attemptedOperation) {
// back out our changes if something got hosed // back out our changes if something got hosed (but not if
// the hosage was a result of losing our connection)
try { try {
if (supportsTransactions) { if (supportsTransactions && !conn.isClosed()) {
conn.rollback(); conn.rollback();
} }
} catch (SQLException rbe) { } catch (SQLException rbe) {
@@ -181,7 +182,7 @@ public class SimpleRepository extends Repository
} catch (PersistenceException pe) { } catch (PersistenceException pe) {
// back out our changes if something got hosed // back out our changes if something got hosed
try { try {
if (supportsTransactions) { if (supportsTransactions && !conn.isClosed()) {
conn.rollback(); conn.rollback();
} }
} catch (SQLException rbe) { } catch (SQLException rbe) {
@@ -193,7 +194,7 @@ public class SimpleRepository extends Repository
} catch (RuntimeException rte) { } catch (RuntimeException rte) {
// back out our changes if something got hosed // back out our changes if something got hosed
try { try {
if (conn != null && supportsTransactions) { if (conn != null && supportsTransactions && !conn.isClosed()) {
conn.rollback(); conn.rollback();
} }
} catch (SQLException rbe) { } catch (SQLException rbe) {