[hibernate-issues] [Hibernate-JIRA] Resolved: (ANN-464) AbstractEntityManagerImpl.joinTransaction() has dead code block

Emmanuel Bernard (JIRA) noreply at atlassian.com
Wed Oct 18 10:58:25 EDT 2006


     [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-464?page=all ]
     
Emmanuel Bernard resolved ANN-464:
----------------------------------

    Resolution: Rejected

You are wrong, this is not a dead code.
session.isOpen() triggers the transaction synchronization IF there is a TM available (proper configuration) and an active transaction is available.
This seems that your code is failing on one of the two.

Note that this code works fine on JBoss AS, Glassfish (my check) and I know some people use HEM in WAS and Oracle app server

> AbstractEntityManagerImpl.joinTransaction() has dead code block
> ---------------------------------------------------------------
>
>          Key: ANN-464
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-464
>      Project: Hibernate Annotations
>         Type: Bug

>     Versions: 3.2.0.cr3
>     Reporter: Barry Kaplan

>
>
> In the method joinTransaction(boolean ignoreJoining) there is the snippet:
>     joinableCMTTransaction.markForJoined();
>     session.isOpen(); //register to the Tx
>     if ( joinableCMTTransaction.getStatus() == JoinableCMTTransaction.JoinStatus.NOT_JOINED ) {
>         ...
>     else
>     if ( joinableCMTTransaction.getStatus() == JoinableCMTTransaction.JoinStatus.MARKED_FOR_JOINED ) {
>         throw new AssertionFailure( "Transaction MARKED_FOR_JOINED after isOpen() call" );
>     }
> The method  joinableCMTTransaction.markForJoined() ensure that  joinableCMTTransaction.getStatus()  is either JoinStatus.JOINED or JoinStatus.MARKED_FOR_JOINED, ie:
> 	public void markForJoined() {
> 		if ( status != JoinStatus.JOINED ) status = JoinStatus.MARKED_FOR_JOINED;
> 	}
> Hence the if-block can never be entered. 
> I'm not sure what the implications of this are
> In my program when joinableCMTTransaction.markForJoined() is invoked status != JoinStatus.JOINED is true, hence status gets assigned JoinStatus.MARKED_FOR_JOINED and the exception is always thrown.
> I ran into this problem (not this issues problems though) when using the Geronimo transaction manager via jencks. Using JbossTM with everthing all others things unchanged I don't see the below exception.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list