Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0-M5
-
Security Level: public (Regular issues)
-
None
-
Patch Available
Description
org.apache.geronimo.transaction.manager.TransactionManagerImpl, implementation of "TransactionSynchronizationRegistry.getTransactionStatus()" method throws an IllegalStateException when called outside of active transaction. I believe this behavior is wrong. According to JTA javadocs:
"int getTransactionStatus()
Return the status of the transaction bound to the current thread at the time this method is called. This is the result of executing TransactionManager.getStatus() in the context of the transaction bound to the current thread at the time this method is called.
Returns: the status of the transaction bound to the current thread at the time this method is called."
So no exception is specified in the spec. Also current behavior caused grief when implementing a JPA provider. Most methods on the EntityManager have this note: "throws TransactionRequiredException if invoked on a container-managed entity manager of type PersistenceContextType.TRANSACTION and there is no transaction.", but currently the provider can't even check the tx status consistently, since this unexpected exception is thrown.
See attached patch for the trivial fix.