qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1441383 - /qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java
Date Fri, 01 Feb 2013 10:48:34 GMT
Author: gsim
Date: Fri Feb  1 10:48:33 2013
New Revision: 1441383

URL: http://svn.apache.org/viewvc?rev=1441383&view=rev
Log:
PROTON-205: Set target and source correctly when establishing links

Modified:
    qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java?rev=1441383&r1=1441382&r2=1441383&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java
(original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java
Fri Feb  1 10:48:33 2013
@@ -144,7 +144,7 @@ public class MessengerImpl implements Me
                 throw new MessengerException("unable to send to address: " + m.getAddress());
             }
             int port = address.getPort() < 0 ? defaultPort(address.getScheme()) : address.getPort();
-            Sender sender = getLink(address.getHost(), port, new SenderFinder(address.getPath()));
+            Sender sender = getLink(address.getHost(), port, new SenderFinder(cleanPath(address.getPath())));
 
             adjustReplyTo(m);
 
@@ -232,7 +232,7 @@ public class MessengerImpl implements Me
             }
             else
             {
-                getLink(address.getHost(), port, new ReceiverFinder(address.getPath()));
+                getLink(address.getHost(), port, new ReceiverFinder(cleanPath(address.getPath())));
             }
         }
         catch (URISyntaxException e)
@@ -688,7 +688,11 @@ public class MessengerImpl implements Me
 
         public Sender create(Session session)
         {
-            return session.sender(_path);
+            Sender sender = session.sender(_path);
+            Target target = new Target();
+            target.setAddress(_path);
+            sender.setTarget(target);
+            return sender;
         }
     }
 
@@ -715,7 +719,11 @@ public class MessengerImpl implements Me
 
         public Receiver create(Session session)
         {
-            return session.receiver(_path);
+            Receiver receiver = session.receiver(_path);
+            Source source = new Source();
+            source.setAddress(_path);
+            receiver.setSource(source);
+            return receiver;
         }
     }
 
@@ -876,6 +884,19 @@ public class MessengerImpl implements Me
         }
     }
 
+    private static String cleanPath(String path)
+    {
+        //remove leading '/'
+        if (path != null && path.length() > 0 && path.charAt(0) == '/')
+        {
+            return path.substring(1);
+        }
+        else
+        {
+            return path;
+        }
+    }
+
     private static boolean matchTarget(Target target, String path)
     {
         if (target == null) return path.isEmpty();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message