diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java index 3a7a224b0a..d2e7d88850 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java @@ -3954,7 +3954,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { .setAddress(address) .setId(id) .setRoutingType(routingType) - .setFilterString(filter.getFilterString()) + .setFilterString(filter == null ? null : filter.getFilterString()) .setDurable(isDurable()) .setUser(user) .setMaxConsumers(maxConsumers) @@ -3963,7 +3963,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { .setGroupBuckets(groupBuckets) .setGroupFirstKey(groupFirstKey) .setLastValue(false) - .setLastValue(null) + .setLastValueKey((String) null) .setNonDestructive(nonDestructive) .setPurgeOnNoConsumers(purgeOnNoConsumers) .setConsumersBeforeDispatch(consumersBeforeDispatch) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java index 53cd3c5fe0..a0656f3c7c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java @@ -567,6 +567,25 @@ public class ActiveMQServerControlTest extends ManagementTestBase { checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); } + @Test + public void testCreateAndUpdateQueueWithoutFilter() throws Exception { + SimpleString address = RandomUtil.randomSimpleString(); + SimpleString name = RandomUtil.randomSimpleString(); + + ActiveMQServerControl serverControl = createManagementControl(); + + serverControl.createQueue(new QueueConfiguration(name).setAddress(address).setRoutingType(RoutingType.ANYCAST).setAutoCreateAddress(true).setFilterString((String) null).toJSON()); + serverControl.updateQueue(new QueueConfiguration(name).setAddress(address).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1).toJSON()); + + QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, RoutingType.ANYCAST, mbeanServer); + Assert.assertEquals(address.toString(), queueControl.getAddress()); + Assert.assertEquals(name.toString(), queueControl.getName()); + Assert.assertNull(queueControl.getFilter()); + Assert.assertEquals(1, queueControl.getMaxConsumers()); + + serverControl.destroyQueue(name.toString()); + } + @Test public void testGetQueueNames() throws Exception { SimpleString address = RandomUtil.randomSimpleString();