activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject [1/2] git commit: https://issues.apache.org/jira/browse/AMQ-5395
Date Tue, 14 Oct 2014 15:48:05 GMT
Repository: activemq
Updated Branches:
  refs/heads/trunk 0cf7c0bc4 -> 27833d025


https://issues.apache.org/jira/browse/AMQ-5395

Check for the presence of a prefix before asking for a substring

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

Branch: refs/heads/trunk
Commit: 78446ad1759706df7662018571e68bc471a6ac28
Parents: 0cf7c0b
Author: Timothy Bish <tabish121@gmail.com>
Authored: Tue Oct 14 11:46:49 2014 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Tue Oct 14 11:46:49 2014 -0400

----------------------------------------------------------------------
 .../activemq/transport/amqp/ActiveMQJMSVendor.java       | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/78446ad1/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/ActiveMQJMSVendor.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/ActiveMQJMSVendor.java
b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/ActiveMQJMSVendor.java
index 59c29e3..b576c6b 100644
--- a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/ActiveMQJMSVendor.java
+++ b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/ActiveMQJMSVendor.java
@@ -47,6 +47,8 @@ public class ActiveMQJMSVendor extends JMSVendor {
 
     final public static ActiveMQJMSVendor INSTANCE = new ActiveMQJMSVendor();
 
+    private static final String PREFIX_MARKER = "://";
+
     private ActiveMQJMSVendor() {
     }
 
@@ -87,7 +89,13 @@ public class ActiveMQJMSVendor extends JMSVendor {
 
     @Override
     public <T extends Destination> T createDestination(String name, Class<T>
kind) {
-        String destinationName = name.substring(name.lastIndexOf("://") + 3);
+        String destinationName = name;
+        int prefixEnd = name.lastIndexOf(PREFIX_MARKER);
+
+        if (prefixEnd >= 0) {
+            destinationName = name.substring(prefixEnd + PREFIX_MARKER.length());
+        }
+
         if (kind == Queue.class) {
             return kind.cast(new ActiveMQQueue(destinationName));
         }
@@ -100,6 +108,7 @@ public class ActiveMQJMSVendor extends JMSVendor {
         if (kind == TemporaryTopic.class) {
             return kind.cast(new ActiveMQTempTopic(destinationName));
         }
+
         return kind.cast(ActiveMQDestination.createDestination(name, ActiveMQDestination.QUEUE_TYPE));
     }
 


Mime
View raw message