Skip to content

Commit 7ed4df2

Browse files
committed
Ensure AbstractReactiveTransactionManager compiles in Eclipse IDE
1 parent 3dc38a0 commit 7ed4df2

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

spring-tx/src/main/java/org/springframework/transaction/reactive/AbstractReactiveTransactionManager.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -439,24 +439,27 @@ private Mono<Void> processCommit(TransactionSynchronizationManager synchronizati
439439
return Mono.empty();
440440
})).then(Mono.empty().onErrorResume(ex -> {
441441
Mono<Object> propagateException = Mono.error(ex);
442+
// Store result in a local variable in order to appease the
443+
// Eclipse compiler with regard to inferred generics.
444+
Mono<Object> result = propagateException;
442445
if (ErrorPredicates.UNEXPECTED_ROLLBACK.test(ex)) {
443-
return triggerAfterCompletion(synchronizationManager, status, TransactionSynchronization.STATUS_ROLLED_BACK).then(propagateException);
446+
result = triggerAfterCompletion(synchronizationManager, status, TransactionSynchronization.STATUS_ROLLED_BACK).then(propagateException);
444447
}
445-
if (ErrorPredicates.TRANSACTION_EXCEPTION.test(ex)) {
446-
return triggerAfterCompletion(synchronizationManager, status, TransactionSynchronization.STATUS_UNKNOWN).then(propagateException);
448+
else if (ErrorPredicates.TRANSACTION_EXCEPTION.test(ex)) {
449+
result = triggerAfterCompletion(synchronizationManager, status, TransactionSynchronization.STATUS_UNKNOWN).then(propagateException);
447450
}
448-
if (ErrorPredicates.RUNTIME_OR_ERROR.test(ex)) {
451+
else if (ErrorPredicates.RUNTIME_OR_ERROR.test(ex)) {
449452
Mono<Void> mono;
450453
if (!beforeCompletionInvoked.get()) {
451454
mono = triggerBeforeCompletion(synchronizationManager, status);
452455
}
453456
else {
454457
mono = Mono.empty();
455458
}
456-
return mono.then(doRollbackOnCommitException(synchronizationManager, status, ex)).then(propagateException);
459+
result = mono.then(doRollbackOnCommitException(synchronizationManager, status, ex)).then(propagateException);
457460
}
458461

459-
return propagateException;
462+
return result;
460463
})).then(Mono.defer(() -> triggerAfterCommit(synchronizationManager, status).onErrorResume(ex ->
461464
triggerAfterCompletion(synchronizationManager, status, TransactionSynchronization.STATUS_COMMITTED).then(Mono.error(ex)))
462465
.then(triggerAfterCompletion(synchronizationManager, status, TransactionSynchronization.STATUS_COMMITTED))));

0 commit comments

Comments
 (0)