Uploaded image for project: 'Geronimo'
  1. Geronimo
  2. GERONIMO-2809

TransactionManagerImpl.getTransactionStatus() shouldn't throw on no tx (with patch)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0-M5
    • 2.0-M5
    • transaction manager
    • 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.

      Attachments

        1. patch.txt
          0.8 kB
          Andrus Adamchik

        Activity

          People

            djencks David Jencks
            andrus Andrus Adamchik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: