Bugs item #974752, was opened at 2004-06-17 13:58
Message generated for change (Comment added) made by marklittle
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=974752&group_id=22866

Category: JBossTX
Group: v3.2
Status: Open
Resolution: None
Priority: 7
Submitted By: Mark Little (marklittle)
Assigned to: Nobody/Anonymous (nobody)
Summary: afterCompletion potential NullPointerException

Initial Comment:
The afterCompletion method of the Synchronization 
implementation TxRemover (in TxConnectionManager) 
uses currentTx from the TxConnectionEventListener to 
determine the current transaction:

// Are we still in the original transaction?
            if (currentTx.equals(tx) == false)
            {

However, currentTx is set to null in delist() when the 
XAResource is delisted from the transaction. This 
happens prior to transaction termination, which is when 
the synchronization gets to run. So obviously it's going 
to find that currentTx is null at this point and die with a 
NullPointerException.

Mark.


----------------------------------------------------------------------

>Comment By: Mark Little (marklittle)
Date: 2004-06-17 14:13

Message:
Logged In: YES 
user_id=754951

It looks to me that the problem is that the test for 
isTrackByTx is in the wrong place.

When the Synchronization is created:

try
            {
               currentTx.registerSynchronization(new TxRemover
(currentTx, isTrackByTx()));
            }
            catch (RollbackException re)
            {
               throw new SystemException("Could not register 
synchronization with tx: " + re);
            }

So the instance knows the value of isTrackByTx at this stage.

Now, in delist, the currentTx is set to null based on this value:

if (isTrackByTx() == false)
            {
               currentTx = null;

But then the afterCompletion implementation does:

// Are we still in the original transaction?
            if (currentTx.equals(tx) == false)
            {
               // If we are interleaving transactions we have 
nothing to do
               if (wasTrackByTx == false)
                  return;
               else
               {

The else clause for if the two transactions aren't the same 
will do nothing as well if wasTrackByTx is false. So, I suggest 
that a possible fix would be to move the wasTrackByTx test 
to the start of the method:

public void afterCompletion(int status)
{
    if (!wasTrackByTx)
        return;
    ...
}

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=974752&group_id=22866


-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to