From 8fc1e00d88fed9419e566d1fb69b46175585e9f1 Mon Sep 17 00:00:00 2001 From: Timothy Bish Date: Wed, 28 Feb 2018 10:46:31 -0500 Subject: [PATCH] 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. --- .../core/protocol/openwire/OpenWireConnection.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java index 02e3b5868d..99733ec305 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java @@ -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);