fix for: https://issues.apache.org/activemq/browse/AMQNET-281
Project: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/commit/434a5882 Tree: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/tree/434a5882 Diff: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/diff/434a5882 Branch: refs/heads/1.4.x Commit: 434a58821f8c47f74d02e99f5359e247dbfcd960 Parents: 88513eb Author: Timothy A. Bish <tab...@apache.org> Authored: Thu Sep 9 20:39:04 2010 +0000 Committer: Timothy A. Bish <tab...@apache.org> Committed: Thu Sep 9 20:39:04 2010 +0000 ---------------------------------------------------------------------- src/main/csharp/ConnectionFactory.cs | 8 ++++++-- src/test/csharp/NMSConnectionFactoryTest.cs | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/blob/434a5882/src/main/csharp/ConnectionFactory.cs ---------------------------------------------------------------------- diff --git a/src/main/csharp/ConnectionFactory.cs b/src/main/csharp/ConnectionFactory.cs index ae2e3bd..608fa21 100755 --- a/src/main/csharp/ConnectionFactory.cs +++ b/src/main/csharp/ConnectionFactory.cs @@ -160,9 +160,13 @@ namespace Apache.NMS.Stomp { brokerUri = new Uri(URISupport.StripPrefix(value.OriginalString, "stomp:")); - if(brokerUri.Query != null) + if(!String.IsNullOrEmpty(brokerUri.Query) && !brokerUri.OriginalString.EndsWith(")")) { - StringDictionary properties = URISupport.ParseQuery(brokerUri.Query); + // Since the Uri class will return the end of a Query string found in a Composite + // URI we must ensure that we trim that off before we proceed. + string query = brokerUri.Query.Substring(brokerUri.Query.LastIndexOf(")") + 1); + + StringDictionary properties = URISupport.ParseQuery(query); StringDictionary connection = URISupport.ExtractProperties(properties, "connection."); StringDictionary nms = URISupport.ExtractProperties(properties, "nms."); http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/blob/434a5882/src/test/csharp/NMSConnectionFactoryTest.cs ---------------------------------------------------------------------- diff --git a/src/test/csharp/NMSConnectionFactoryTest.cs b/src/test/csharp/NMSConnectionFactoryTest.cs index 42c3842..238b0b9 100755 --- a/src/test/csharp/NMSConnectionFactoryTest.cs +++ b/src/test/csharp/NMSConnectionFactoryTest.cs @@ -28,6 +28,8 @@ namespace Apache.NMS.Stomp.Test [Test] #if !NETCF [TestCase("stomp:tcp://${activemqhost}:61613")] + [TestCase("stomp:failover:(tcp://${activemqhost}:61616?keepAlive=false&wireFormat.maxInactivityDuration=1000)")] + [TestCase("stomp:failover:(tcp://${activemqhost}:61616?keepAlive=false&wireFormat.maxInactivityDuration=1000)?connection.asyncSend=false")] [TestCase("stomp:tcp://${activemqhost}:61613?connection.asyncsend=false")] [TestCase("stomp:tcp://${activemqhost}:61613?connection.InvalidParameter=true", ExpectedException = typeof(NMSConnectionException))] [TestCase("stomp:tcp://${activemqhost}:61613?connection.InvalidParameter=true", ExpectedException = typeof(NMSConnectionException))]