From 3e0ad2268b35501413eeabc0b6ae11d4bf90e810 Mon Sep 17 00:00:00 2001 From: Martyn Taylor Date: Fri, 16 Dec 2016 14:52:24 +0000 Subject: [PATCH] NO-JIRA Fix Issue with Auto Create Address --- .../core/server/impl/ActiveMQServerImpl.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java index bfe57e34c8..fb7d604544 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java @@ -2531,10 +2531,16 @@ public class ActiveMQServerImpl implements ActiveMQServer { AddressInfo info = postOffice.getAddressInfo(addressName); if (autoCreateAddress) { - if (info == null || !info.getRoutingTypes().contains(routingType)) { - final AddressInfo defaultAddressInfo = new AddressInfo(addressName); - defaultAddressInfo.addRoutingType(routingType == null ? ActiveMQDefaultConfiguration.getDefaultRoutingType() : routingType); - createOrUpdateAddressInfo(defaultAddressInfo.setAutoCreated(true)); + RoutingType rt = (routingType == null ? ActiveMQDefaultConfiguration.getDefaultRoutingType() : routingType); + if (info == null) { + final AddressInfo addressInfo = new AddressInfo(addressName, rt); + createAddressInfo(addressInfo); + } + else if (!info.getRoutingTypes().contains(routingType)) { + Set routingTypes = new HashSet<>(); + routingTypes.addAll(info.getRoutingTypes()); + routingTypes.add(routingType); + updateAddressInfo(info.getName().toString(), routingTypes); } } else if (info == null) { throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(addressName);