Skip to content

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

@ochaloup

Description

@ochaloup

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions