You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2016/07/20 10:07:37 UTC
[3/3] jena git commit: If abort itself causes exceptions,
pass original exception up.
If abort itself causes exceptions, pass original exception up.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/0247b6e4
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/0247b6e4
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/0247b6e4
Branch: refs/heads/master
Commit: 0247b6e43d4892379ddcfb7c41e7c5f01beb235e
Parents: b722e94
Author: Andy Seaborne <an...@apache.org>
Authored: Mon Jul 18 18:52:00 2016 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Wed Jul 20 11:07:20 2016 +0100
----------------------------------------------------------------------
.../jena/graph/impl/TransactionHandlerBase.java | 43 ++++++++++++--------
1 file changed, 25 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/0247b6e4/jena-core/src/main/java/org/apache/jena/graph/impl/TransactionHandlerBase.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/graph/impl/TransactionHandlerBase.java b/jena-core/src/main/java/org/apache/jena/graph/impl/TransactionHandlerBase.java
index 6c92379..0104ec3 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/impl/TransactionHandlerBase.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/impl/TransactionHandlerBase.java
@@ -22,26 +22,33 @@ import org.apache.jena.graph.* ;
import org.apache.jena.shared.* ;
/**
-
- A base for transaction handlers - all it does is provide the canonical
- implementation of executeInTransaction.
-*/
-public abstract class TransactionHandlerBase implements TransactionHandler
- {
- public TransactionHandlerBase()
- { super(); }
+ * A base for transaction handlers - all it does is provide the
+ * canonical implementation of executeInTransaction.
+ */
+public abstract class TransactionHandlerBase implements TransactionHandler {
+ public TransactionHandlerBase() {
+ super() ;
+ }
/**
- Execute the command <code>c</code> within a transaction. If it
- completes normally, commit the transaction and return the result.
- Otherwise abort the transaction and throw a wrapped exception.
- */
+ * Execute the command <code>c</code> within a transaction. If it completes normally,
+ * commit the transaction and return the result. Otherwise abort the transaction.
+ */
@Override
- public Object executeInTransaction( Command c )
- {
- begin();
- try { Object result = c.execute(); commit(); return result; }
- catch (JenaException e) { abort(); throw e ; }
- catch (Throwable e) { abort(); throw new JenaException( e ); }
+ public Object executeInTransaction(Command c) {
+ begin() ;
+ try {
+ Object result = c.execute() ;
+ commit() ;
+ return result ;
}
+ catch (JenaException e) { abortSilent() ; throw e ; }
+ catch (Throwable e) { abortSilent() ; throw new JenaException(e) ; }
}
+
+ /* Abort but don't let problmes with the transaction system itself cause loss of exception handling */
+ private void abortSilent() {
+ try { abort() ; } catch (Throwable th) {}
+ }
+}
+