1
0
mirror of https://github.com/google/nomulus synced 2026-01-11 08:20:27 +00: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:
Weimin Yu
2020-07-06 17:39:13 -04:00
committed by GitHub
parent c24a61f813
commit 5578464e06

View File

@@ -101,7 +101,8 @@ public class JpaTransactionManagerImpl implements JpaTransactionManager {
T result = work.get();
txn.commit();
return result;
} catch (RuntimeException e) {
} catch (RuntimeException | Error e) {
// Error is unchecked!
try {
txn.rollback();
logger.atWarning().log("Error during transaction; transaction rolled back");