ARTEMIS-1712 Add additional null check in TX rollback handler

Check for AMQSession being null before handling various TX state checks
in order to ensure the correct errors are thrown and TX rollback is
handled properly.
This commit is contained in:
Timothy Bish 2018-02-28 10:46:31 -05:00
parent 989779476b
commit 8fc1e00d88
1 changed files with 7 additions and 1 deletions

View File

@ -1156,7 +1156,13 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
@Override
public Response processRollbackTransaction(TransactionInfo info) throws Exception {
Transaction tx = lookupTX(info.getTransactionId(), null, true);
AMQSession amqSession = (AMQSession) tx.getProtocolData();
final AMQSession amqSession;
if (tx != null) {
amqSession = (AMQSession) tx.getProtocolData();
} else {
amqSession = null;
}
if (info.getTransactionId().isXATransaction() && tx == null) {
throw newXAException("Transaction '" + info.getTransactionId() + "' has not been started.", XAException.XAER_NOTA);