From 17ea05bce666e27b9a2808f4a186307ef92c1b2b Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Fri, 3 Jun 2016 11:59:09 -0400 Subject: [PATCH] ARTEMIS-539 fixing default address on client as well --- .../artemis/core/client/impl/ClientSessionImpl.java | 7 +++++-- .../artemis/core/server/impl/ServerSessionImpl.java | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java index ae8966c9eb..c973133114 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java @@ -1054,9 +1054,11 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi if (defaultAddress == null) { defaultAddress = address; - message.setAddress(address); + if (message != null) { + message.setAddress(address); + } } - else { + else if (message != null) { if (!address.equals(defaultAddress)) { message.setAddress(address); } @@ -1085,6 +1087,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public synchronized ClientProducerCredits getCredits(final SimpleString address, final boolean anon) { + setAddress(null, address); ClientProducerCredits credits = producerCreditManager.getCredits(address, anon, sessionContext); return credits; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java index 7c65c2130b..f5cbaf39bd 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java @@ -1268,7 +1268,9 @@ public class ServerSessionImpl implements ServerSession, FailureListener { } protected void checkDefaultAddress(SimpleString address) { + logger.tracef("checkDefaultAddress %s, defaultAddress=%s", address, defaultAddress); if (defaultAddress == null && address != null) { + logger.tracef("checkDefaultAddress setting as %s", address); defaultAddress = address; } }