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

Barry Kaplan (JIRA) noreply at atlassian.com
Tue Oct 17 20:48:24 EDT 2006


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