afs commented on code in PR #2760:
URL: https://github.com/apache/jena/pull/2760#discussion_r1792117033
##########
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java:
##########
@@ -329,23 +329,31 @@ public void begin(TxnType txnType) {
finishActionTxn();
if ( dataService != null )
dataService.finishTxn();
- if ( transactional != null && transactional.isInTransaction() ) {
- switch(transactional.transactionMode() ) {
- case READ -> {}
- case WRITE -> {
- // Write transactions must have explicitly called commit
or abort.
- FmtLog.warn(log, "[%d] Transaction still active - no
commit or abort seen (forced abort)", this.id);
- try {
- transactional.abort();
- } catch (RuntimeException ex) {
- FmtLog.warn(log, "[%d] Exception in forced abort
(trying to continue)", this.id, ex);
- }
+ if ( transactional != null && transactional.isInTransaction() )
+ forceAbort();
+ leaveActionTxn();
+ }
+
+ /** Force an abort - i.e. abort with protection against anything going
wrong. */
+ private void forceAbort() {
+ ReadWrite rwMode = transactional.transactionMode();
+ if ( rwMode == null )
+ // Damaged system.
+ return;
+ switch(rwMode) {
+ case READ -> {}
+ case WRITE -> {
+ // Write transactions must have explicitly called commit or
abort.
+ FmtLog.warn(log, "[%d] Transaction still active - no commit or
abort seen (forced abort)", this.id);
+ try {
+ transactional.abort();
+ } catch (RuntimeException ex) {
+ FmtLog.warn(log, "[%d] Exception in forced abort (trying
to continue)", this.id, ex);
Review Comment:
Not the one from #2755 - the except is `Cannot invoke
"org.apache.jena.query.ReadWrite.ordinal()`
which is a null value of `transactional.transactionMode()`
in`finishActionTxn()`.
```
switch(transactional.transactionMode() )
```
and that says very little.
The `transactional.abort` exception may have some information (unlikely but
possible) and would be hidden by the `switch` NPE.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]