[jbossts-issues] [JBoss JIRA] (JBTM-957) NullPointerException found in com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple

jaikiran pai (Commented) (JIRA) jira-events at lists.jboss.org
Tue Dec 6 12:14:41 EST 2011


    [ https://issues.jboss.org/browse/JBTM-957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648483#comment-12648483 ] 

jaikiran pai commented on JBTM-957:
-----------------------------------

Just copying the workaround, along with the issue details, that we use in AS7 currently:

{quote}
    // This is a hack (obviously!) to workaround a bug in JBoss TS which leads to a NullPointerException in
    // com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple.propagationContext() at the
    // following line (controlHandle is null)
    // Control currentControl = controlHandle.getControl();
    //
    // The bug appears to be in com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl constructor:
    // public ServerControl (ServerTransaction stx)
    // {
    //  super();
    //
    //  _realCoordinator = null;
    //  _realTerminator = null;
    //  _isWrapper = false;
    //
    // _transactionHandle = stx;
    // _theUid = stx.get_uid();
    //
    // createTransactionHandle();
    //
    // addControl();
    //
    // }
    // com.arjuna.ats.internal.jts.orbspecific.ControlImple from which the ServerControl extends
    // says this (in its protected no-arg constructor which the ServerControl calls above):
    // /**
    //  * Protected constructor for inheritance. The derived classes are
    //  * responsible for setting everything up, including adding the control to
    //  * the list of controls and assigning the Uid variable.
    //  */
    //
    // So the public ServerControl (ServerTransaction stx) is expected to call _transactionHandle.setControlHandle(this);
    // in that construct.
    //
    // This hack method does that job to workaround that bug
    private void hackJTS(final SubordinateTransaction subordinateTransaction) {
        if (subordinateTransaction instanceof TransactionImple) {
            final TransactionImple txImple = (TransactionImple) subordinateTransaction;
            final ControlWrapper controlWrapper = txImple.getControlWrapper();
            if (controlWrapper == null) {
                return;
            }
            final ControlImple controlImple = controlWrapper.getImple();
            if (controlImple == null) {
                return;
            }
            final ArjunaTransactionImple arjunaTransactionImple = controlImple.getImplHandle();
            if (arjunaTransactionImple == null) {
                return;
            }
            logger.debug("Applying a JTS hack to setControlHandle " + controlImple + " on subordinate tx " + subordinateTransaction);
            arjunaTransactionImple.setControlHandle(controlImple);
        }
    }
{quote}
                
> NullPointerException found in com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple
> --------------------------------------------------------------------------------------------------------
>
>                 Key: JBTM-957
>                 URL: https://issues.jboss.org/browse/JBTM-957
>             Project: JBoss Transaction Manager
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: JTS
>    Affects Versions: 4.15.3
>            Reporter: David Lloyd
>            Priority: Minor
>
> com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple's doBeforeCompletion() method assumes that the "controlHandle" field is initialized to a non-null value.  However, com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl does not do said initialization despite the fact that the apparent contract published in com.arjuna.ats.internal.jts.orbspecific.ControlImple specifies that "The derived classes are responsible for setting everything up, including adding the control to the list of controls...".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbossts-issues mailing list