TransactionManagerImpl.getTransactionStatus() shouldn't throw on no tx (with
patch)
-----------------------------------------------------------------------------------
Key: GERONIMO-2809
URL: https://issues.apache.org/jira/browse/GERONIMO-2809
Project: Geronimo
Issue Type: Bug
Security Level: public (Regular issues)
Components: transaction manager
Affects Versions: 2.0
Reporter: Andrus Adamchik
Fix For: 2.0
Attachments: patch.txt
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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.