public static String getXAExceptionCodeString(int code) {

        // Note, two cases are commented out below.  This is because in the implementation of
        // XAException, they have defined two constants to be the same int (or so it would
        // seem).

        // This is because XA_RBBASE and XA_RBEND define the lower and upper bounds of the
        // XA_RB error codes.  These two are correctly commented out below.

        switch (code) {
            case XAException.XA_RBTRANSIENT:
                return "XA_RBTRANSIENT (" + code + ')'; 
            case XAException.XA_RBROLLBACK:
                return "XA_RBROLLBACK (" + code + ')'; 
            case XAException.XA_HEURCOM:
                return "XA_HEURCOM (" + code + ')'; 
            case XAException.XA_HEURHAZ:
                return "XA_HEURHAZ (" + code + ')'; 
            case XAException.XA_HEURMIX:
                return "XA_HEURMIX (" + code + ')'; 
            case XAException.XA_HEURRB:
                return "XA_HEURRB (" + code + ')'; 
            case XAException.XA_NOMIGRATE:
                return "XA_NOMIGRATE (" + code + ')'; 
                //case XAException.XA_RBBASE:
                //    return "XA_RBBASE (" + code + ')'; 
            case XAException.XA_RBCOMMFAIL:
                return "XA_RBCOMMFAIL (" + code + ')'; 
            case XAException.XA_RBDEADLOCK:
                return "XA_RBDEADLOCK (" + code + ')'; 
                //case XAException.XA_RBEND:
                //    return "XA_RBEND (" + code + ')'; 
            case XAException.XA_RBINTEGRITY:
                return "XA_RBINTEGRITY (" + code + ')'; 
            case XAException.XA_RBOTHER:
                return "XA_RBOTHER (" + code + ')'; 
            case XAException.XA_RBPROTO:
                return "XA_RBPROTO (" + code + ')'; 
            case XAException.XA_RBTIMEOUT:
                return "XA_RBTIMEOUT (" + code + ')'; 
            case XAException.XA_RDONLY:
                return "XA_RDONLY (" + code + ')'; 
            case XAException.XA_RETRY:
                return "XA_RETRY (" + code + ')'; 
            case XAException.XAER_ASYNC:
                return "XAER_ASYNC (" + code + ')'; 
            case XAException.XAER_DUPID:
                return "XAER_DUPID (" + code + ')'; 
            case XAException.XAER_INVAL:
                return "XAER_INVAL (" + code + ')'; 
            case XAException.XAER_NOTA:
                return "XAER_NOTA (" + code + ')'; 
            case XAException.XAER_OUTSIDE:
                return "XAER_OUTSIDE (" + code + ')'; 
            case XAException.XAER_PROTO:
                return "XAER_PROTO (" + code + ')'; 
            case XAException.XAER_RMERR:
                return "XAER_RMERR (" + code + ')'; 
            case XAException.XAER_RMFAIL:
                return "XAER_RMFAIL (" + code + ')'; 

        }
        return "UNKNOWN XA EXCEPTION CODE (" + code + ')'; 
    }
public static String getXAExceptionCodeString ( int code ) { switch ( code ) { case XAException . XA_RBTRANSIENT : return "XA_RBTRANSIENT (" + code + ')' ; case XAException . XA_RBROLLBACK : return "XA_RBROLLBACK (" + code + ')' ; case XAException . XA_HEURCOM : return "XA_HEURCOM (" + code + ')' ; case XAException . XA_HEURHAZ : return "XA_HEURHAZ (" + code + ')' ; case XAException . XA_HEURMIX : return "XA_HEURMIX (" + code + ')' ; case XAException . XA_HEURRB : return "XA_HEURRB (" + code + ')' ; case XAException . XA_NOMIGRATE : return "XA_NOMIGRATE (" + code + ')' ; case XAException . XA_RBCOMMFAIL : return "XA_RBCOMMFAIL (" + code + ')' ; case XAException . XA_RBDEADLOCK : return "XA_RBDEADLOCK (" + code + ')' ; case XAException . XA_RBINTEGRITY : return "XA_RBINTEGRITY (" + code + ')' ; case XAException . XA_RBOTHER : return "XA_RBOTHER (" + code + ')' ; case XAException . XA_RBPROTO : return "XA_RBPROTO (" + code + ')' ; case XAException . XA_RBTIMEOUT : return "XA_RBTIMEOUT (" + code + ')' ; case XAException . XA_RDONLY : return "XA_RDONLY (" + code + ')' ; case XAException . XA_RETRY : return "XA_RETRY (" + code + ')' ; case XAException . XAER_ASYNC : return "XAER_ASYNC (" + code + ')' ; case XAException . XAER_DUPID : return "XAER_DUPID (" + code + ')' ; case XAException . XAER_INVAL : return "XAER_INVAL (" + code + ')' ; case XAException . XAER_NOTA : return "XAER_NOTA (" + code + ')' ; case XAException . XAER_OUTSIDE : return "XAER_OUTSIDE (" + code + ')' ; case XAException . XAER_PROTO : return "XAER_PROTO (" + code + ')' ; case XAException . XAER_RMERR : return "XAER_RMERR (" + code + ')' ; case XAException . XAER_RMFAIL : return "XAER_RMFAIL (" + code + ')' ; } return "UNKNOWN XA EXCEPTION CODE (" + code + ')' ; }
Used by trace facilities to print out XAException code as a string

@param code a valid javax.transaction.xa.XAException error code constant.

@return the name of the constant, or a string indicating the constant is unknown.