ARTEMIS-1137 handle empty routing type on restart

This commit is contained in:
Justin Bertram 2017-05-02 10:04:24 -05:00
parent e22f77d8ca
commit 578c0fabb2
2 changed files with 10 additions and 1 deletions

View File

@ -232,7 +232,7 @@ public class SimpleAddressManager implements AddressManager {
@Override @Override
public AddressInfo updateAddressInfo(SimpleString addressName, public AddressInfo updateAddressInfo(SimpleString addressName,
Collection<RoutingType> routingTypes) { Collection<RoutingType> routingTypes) {
if (routingTypes == null) { if (routingTypes == null || routingTypes.isEmpty()) {
return this.addressInfoMap.get(addressName); return this.addressInfoMap.get(addressName);
} else { } else {
return this.addressInfoMap.computeIfPresent(addressName, (name, oldAddressInfo) -> { return this.addressInfoMap.computeIfPresent(addressName, (name, oldAddressInfo) -> {

View File

@ -308,4 +308,13 @@ public class AddressingTest extends ActiveMQTestBase {
session.createConsumer(q1.getName()); session.createConsumer(q1.getName());
} }
} }
@Test
public void testEmptyRoutingTypes() throws Exception {
server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString("xy")));
server.stop();
server.start();
server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString("xy")));
server.stop();
}
} }