mirror of
https://github.com/google/nomulus.git
synced 2025-07-03 09:43:30 +02:00
Make sure uncommitted txn is rolled back (#665)
* Make sure uncommit txn is rolled back The try block around commit that catches RuntimeException should also catch Error, which is also unchecked.
This commit is contained in:
parent
43230eee09
commit
a871564ea2
1 changed files with 2 additions and 1 deletions
|
@ -101,7 +101,8 @@ public class JpaTransactionManagerImpl implements JpaTransactionManager {
|
||||||
T result = work.get();
|
T result = work.get();
|
||||||
txn.commit();
|
txn.commit();
|
||||||
return result;
|
return result;
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException | Error e) {
|
||||||
|
// Error is unchecked!
|
||||||
try {
|
try {
|
||||||
txn.rollback();
|
txn.rollback();
|
||||||
logger.atWarning().log("Error during transaction; transaction rolled back");
|
logger.atWarning().log("Error during transaction; transaction rolled back");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue