Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDI interceptors should marked the transaction for rollback for unchecked exceptions not only for RuntimeExceptions #191

Open
ochaloup opened this issue Apr 22, 2021 · 0 comments · May be fixed by #192

Comments

@ochaloup
Copy link

The JTA specification it's not clear about behaviour of CDI interceptor in case of unchecked exceptions. That part of the spec talks explicitly about RuntimeException to cause the transaction to be marked for rollback. But the spec should use term unchecked exception instead.

The spec says now

By default checked exceptions do not result in the transactional interceptor marking the transaction for rollback and instances of RuntimeException and its subclasses do.

The part about Synchronization is correct as it says

An unchecked exception thrown by a registered Synchronization object causes the transaction to be aborted.

The text about CDI interceptor should be aligned to use term unchecked exception instead of RuntimeException.

A note from the Java Language Specification, version 11, chapter 11.1.1:

The unchecked exception classes are the run-time exception classes and the error classes.

The checked exception classes are all exception classes other than the unchecked exception classes. That is, the checked exception classes are Throwable and all its subclasses other than RuntimeException and its subclasses and Error and its subclasses.

ochaloup added a commit to ochaloup/jta-api that referenced this issue Apr 22, 2021
ochaloup added a commit to ochaloup/jta-api that referenced this issue Apr 22, 2021
ochaloup added a commit to ochaloup/jta-api that referenced this issue Apr 22, 2021
…ption for rollback for CDI interceptor

Signed-off-by: Ondra Chaloupka <[email protected]>
ochaloup added a commit to ochaloup/jta-api that referenced this issue Sep 17, 2021
…ption for rollback for CDI interceptor

Signed-off-by: Ondra Chaloupka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant