activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martyntay...@apache.org
Subject [2/2] activemq-artemis git commit: ARTEMIS-1113 STOMP + management-address fix
Date Fri, 28 Apr 2017 09:10:29 GMT
ARTEMIS-1113 STOMP + management-address fix


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/82b6a967
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/82b6a967
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/82b6a967

Branch: refs/heads/master
Commit: 82b6a9678d62da12f8e88aad43a252b4098be44a
Parents: abc2716
Author: Justin Bertram <jbertram@apache.org>
Authored: Fri Apr 14 20:24:06 2017 -0500
Committer: Martyn Taylor <mtaylor@redhat.com>
Committed: Fri Apr 28 10:10:13 2017 +0100

----------------------------------------------------------------------
 .../artemis/core/protocol/stomp/StompConnection.java    | 12 +++++++++---
 .../core/protocol/stomp/StompProtocolManager.java       |  3 +++
 .../artemis/tests/integration/stomp/StompTest.java      |  2 ++
 3 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/82b6a967/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
index a10f2e0..cabd049 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
@@ -42,6 +42,7 @@ import org.apache.activemq.artemis.core.remoting.FailureListener;
 import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
 import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
 import org.apache.activemq.artemis.core.server.ServerSession;
+import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
@@ -289,9 +290,14 @@ public final class StompConnection implements RemotingConnection {
    }
 
    public void checkRoutingSemantics(String destination, RoutingType routingType) throws
ActiveMQStompException {
-      Set<RoutingType> actualDeliveryModesOfAddress = manager.getServer().getAddressInfo(getSession().getCoreSession().removePrefix(SimpleString.toSimpleString(destination))).getRoutingTypes();
-      if (routingType != null && !actualDeliveryModesOfAddress.contains(routingType))
{
-         throw BUNDLE.illegalSemantics(routingType.toString(), actualDeliveryModesOfAddress.toString());
+      AddressInfo addressInfo = manager.getServer().getAddressInfo(getSession().getCoreSession().removePrefix(SimpleString.toSimpleString(destination)));
+
+      // may be null here if, for example, the management address is being checked
+      if (addressInfo != null) {
+         Set<RoutingType> actualDeliveryModesOfAddress = addressInfo.getRoutingTypes();
+         if (routingType != null && !actualDeliveryModesOfAddress.contains(routingType))
{
+            throw BUNDLE.illegalSemantics(routingType.toString(), actualDeliveryModesOfAddress.toString());
+         }
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/82b6a967/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java
b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java
index 39d2fe9..365f373 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java
@@ -403,6 +403,9 @@ public class StompProtocolManager extends AbstractProtocolManager<StompFrame,
St
    }
 
    public boolean destinationExists(String destination) {
+      if (server.getManagementService().getManagementAddress().toString().equals(destination))
{
+         return true;
+      }
       return server.getPostOffice().getAddressInfo(SimpleString.toSimpleString(destination))
!= null;
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/82b6a967/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
index fcc0e38..194ad9c 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
@@ -52,6 +52,7 @@ import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
 import org.apache.activemq.artemis.core.server.impl.AddressInfo;
+import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.integration.mqtt.imported.FuseMQTTClientProvider;
@@ -1422,6 +1423,7 @@ public class StompTest extends StompTestBase {
 
    @Test
    public void testGetManagementAttributeFromStomp() throws Exception {
+      server.getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false).setAutoCreateQueues(false));
       conn.connect(defUser, defPass);
 
       subscribe(conn, null);


Mime
View raw message