-
Bug
-
Resolution: Low Engagement
-
Low
-
None
-
4.0.2
-
RHEL 6.6, OpenJDK Runtime Environment (build 1.8.0_45-b13), Bitbucket Server 4.0.2
Reproduced on several systems using the same code.
-
1
-
Severity 3 - Minor
-
0
-
When trying to handle a RepositoryDeletionRequestedEvent (possibly more, not verified) in Bitbucket Server, e.g.:
@EventListener public void repositoryDeletionRequestedEventListener(RepositoryDeletionRequestedEvent evt) { try { someService.doStuff(); //throws exception in some cases } catch (Exception e) { // log exception and continue } }
The documentation of RepositoryDeletedRequestedEvent (along with other CancelableEvents) clearly states: "Throwing an exception will not prevent the repository from being deleted; the exception will be logged and ignored.".
However, when an exception is thrown in the service, propagating to the eventlistener, I get "org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only" and the repository is never deleted.
I've tried enabling all debug/trace-logging I could think of and the log suggests that the transaction is set to rollback-only just after the exception is thrown. However, the exception is logged by my code as well, suggesting that the catch-statement is actually also being run.