From d7f245f1ca4095765f95a23e49bc7c39c8c26b48 Mon Sep 17 00:00:00 2001 From: Tom Ross Date: Thu, 10 Dec 2015 11:13:55 +0000 Subject: [PATCH] NullPointerException when trying to list prepared transactions as JSON - part 2 --- .../impl/ActiveMQServerControlImpl.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java index 9ee0bb23d5..7488163ebe 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java @@ -872,7 +872,14 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active JSONArray txDetailListJson = new JSONArray(); for (Map.Entry entry : xidsSortedByCreationTime) { Xid xid = entry.getKey(); - TransactionDetail detail = new CoreTransactionDetail(xid, resourceManager.getTransaction(xid), entry.getValue()); + + Transaction tx = resourceManager.getTransaction(xid); + + if (tx == null) { + continue; + } + + TransactionDetail detail = new CoreTransactionDetail(xid, tx, entry.getValue()); txDetailListJson.put(detail.toJSON()); } @@ -908,7 +915,14 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active for (Map.Entry entry : xidsSortedByCreationTime) { Xid xid = entry.getKey(); - TransactionDetail detail = new CoreTransactionDetail(xid, resourceManager.getTransaction(xid), entry.getValue()); + + Transaction tx = resourceManager.getTransaction(xid); + + if (tx == null) { + continue; + } + + TransactionDetail detail = new CoreTransactionDetail(xid, tx, entry.getValue()); JSONObject txJson = detail.toJSON();