You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2020/10/20 14:54:44 UTC

[activemq-artemis] branch master updated: [ARTEMIS-2954] Fixing double preifx issue. Avoiding double preifx with ARTEMIS-2954 fix.

This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new f6353f5  [ARTEMIS-2954] Fixing double preifx issue.  Avoiding double preifx with ARTEMIS-2954 fix.
     new 2ab3690  This closes #3310
f6353f5 is described below

commit f6353f52597b3d9dca47dfadbdaf5b36c8827fbb
Author: Emmanuel Hugonnet <eh...@redhat.com>
AuthorDate: Tue Oct 20 16:41:06 2020 +0200

    [ARTEMIS-2954] Fixing double preifx issue.
     Avoiding double preifx with ARTEMIS-2954 fix.
    
    Issue: ARTEMIS-2954
---
 .../artemis/ra/inflow/ActiveMQActivation.java      | 32 +++++++++++-----------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
index b83e5df..eb0f79e 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
@@ -558,9 +558,9 @@ public class ActiveMQActivation {
 
                String calculatedDestinationName = destinationName.substring(destinationName.lastIndexOf('/') + 1);
                if (isTopic) {
-                  calculatedDestinationName = getTopicPrefix() + calculatedDestinationName;
+                  calculatedDestinationName = getTopicWithPrefix(calculatedDestinationName);
                } else if (!isTopic) {
-                  calculatedDestinationName = getQueuePrefix() + calculatedDestinationName;
+                  calculatedDestinationName = getQueueWithPrefix(calculatedDestinationName);
                }
 
                ActiveMQRALogger.LOGGER.unableToRetrieveDestinationName(destinationName, destinationType.getName(), calculatedDestinationName);
@@ -585,44 +585,44 @@ public class ActiveMQActivation {
          ActiveMQRALogger.LOGGER.instantiatingDestination(spec.getDestinationType(), spec.getDestination());
 
          if (Topic.class.getName().equals(spec.getDestinationType())) {
-            destination = ActiveMQDestination.createTopic(getTopicPrefix() + spec.getDestination(), spec.getDestination());
+            destination = ActiveMQDestination.createTopic(getTopicWithPrefix(spec.getDestination()), spec.getDestination());
             isTopic = true;
          } else {
-            destination = ActiveMQDestination.createQueue(getQueuePrefix() + spec.getDestination(), spec.getDestination());
+            destination = ActiveMQDestination.createQueue(getQueueWithPrefix(spec.getDestination()), spec.getDestination());
          }
       }
    }
 
-   private String getTopicPrefix() {
+   private String getTopicWithPrefix(String topic) {
       if (spec.getTopicPrefix() == null) {
          if (spec.isEnable1xPrefixes() == null) {
-            if (ra.isEnable1xPrefixes() != null && ra.isEnable1xPrefixes()) {
+            if (ra.isEnable1xPrefixes() != null && ra.isEnable1xPrefixes() && !topic.startsWith(PacketImpl.OLD_TOPIC_PREFIX.toString())) {
                return PacketImpl.OLD_TOPIC_PREFIX.toString();
             }
-            return "";
+            return topic;
          }
-         if (spec.isEnable1xPrefixes()) {
+         if (spec.isEnable1xPrefixes() && !topic.startsWith(PacketImpl.OLD_TOPIC_PREFIX.toString())) {
             return PacketImpl.OLD_TOPIC_PREFIX.toString();
          }
-         return "";
+         return topic;
       }
-      return spec.getTopicPrefix();
+      return spec.getTopicPrefix() + topic;
    }
 
-   private String getQueuePrefix() {
+   private String getQueueWithPrefix(String queue) {
       if (spec.getQueuePrefix() == null) {
          if (spec.isEnable1xPrefixes() == null) {
-            if (ra.isEnable1xPrefixes() != null && ra.isEnable1xPrefixes()) {
+            if (ra.isEnable1xPrefixes() != null && ra.isEnable1xPrefixes() && !queue.startsWith(PacketImpl.OLD_QUEUE_PREFIX.toString())) {
                return PacketImpl.OLD_QUEUE_PREFIX.toString();
             }
-            return "";
+            return queue;
          }
-         if (spec.isEnable1xPrefixes()) {
+         if (spec.isEnable1xPrefixes() && !queue.startsWith(PacketImpl.OLD_QUEUE_PREFIX.toString())) {
             return PacketImpl.OLD_QUEUE_PREFIX.toString();
          }
-         return "";
+         return queue;
       }
-      return spec.getQueuePrefix();
+      return spec.getQueuePrefix() + queue;
    }
 
    /**