From 7e3d34eeccce01fabf766ef7250ac1e940ec7bad Mon Sep 17 00:00:00 2001
From: Fabio Pistolesi <fabio.pistolesi@forgerock.com>
Date: Mon, 24 Oct 2016 16:01:22 +0000
Subject: [PATCH] OPENDJ-3400 PDB WriteableTransaction should correctly manage Rollback exception
---
opendj-server-legacy/src/main/java/org/opends/server/backends/pdb/PDBStorage.java | 34 +++++++++++++++++++++-------------
1 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pdb/PDBStorage.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pdb/PDBStorage.java
index eaffd4d..8710868 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pdb/PDBStorage.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pdb/PDBStorage.java
@@ -632,9 +632,16 @@
txn.begin();
try
{
- operation.run(this);
- txn.commit(commitPolicy);
- return;
+ try
+ {
+ operation.run(this);
+ txn.commit(commitPolicy);
+ return;
+ }
+ catch (final StorageRuntimeException e)
+ {
+ throw unwrap(e);
+ }
}
catch (final RollbackException e)
{
@@ -1035,11 +1042,7 @@
}
catch (final StorageRuntimeException e)
{
- if (e.getCause() != null)
- {
- throw (Exception) e.getCause();
- }
- throw e;
+ throw unwrap(e);
}
}
@@ -1059,14 +1062,19 @@
}
catch (final StorageRuntimeException e)
{
- if (e.getCause() != null)
- {
- throw (Exception) e.getCause();
- }
- throw e;
+ throw unwrap(e);
}
}
+ private Exception unwrap(StorageRuntimeException e) throws Exception
+ {
+ if (e.getCause() != null)
+ {
+ throw (Exception) e.getCause();
+ }
+ throw e;
+ }
+
@Override
public boolean supportsBackupAndRestore()
{
--
Gitblit v1.10.0