Author: adamw
Date: 2009-11-24 04:19:47 -0500 (Tue, 24 Nov 2009)
New Revision: 18028
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/AuditSync.java
Log:
Not swallowing exceptions in some cases when a tx is rolled back by Envers
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/AuditSync.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/AuditSync.java 2009-11-23
18:34:56 UTC (rev 18027)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/AuditSync.java 2009-11-24
09:19:47 UTC (rev 18028)
@@ -168,8 +168,15 @@
}
} catch (RuntimeException e) {
// Rolling back the transaction in case of any exceptions
- session.getTransaction().rollback();
- throw e;
+ //noinspection finally
+ try {
+ if (session.getTransaction().isActive()) {
+ session.getTransaction().rollback();
+ }
+ } finally {
+ //noinspection ThrowFromFinallyBlock
+ throw e;
+ }
}
}