[ARTEMIS-2954] Fixing double preifx issue.

Avoiding double preifx with ARTEMIS-2954 fix.

Issue: ARTEMIS-2954
This commit is contained in:
Emmanuel Hugonnet 2020-10-20 16:41:06 +02:00
parent 28d9038673
commit f6353f5259
No known key found for this signature in database
GPG Key ID: 3DD1CCD4EDB2EE81
1 changed files with 16 additions and 16 deletions

View File

@ -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;
}
/**