https://issues.apache.org/activemq/browse/AMQNET-281

Fix error in CreateSession URI parsing


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/4a6b1b48
Tree: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/tree/4a6b1b48
Diff: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/diff/4a6b1b48

Branch: refs/heads/1.4.x
Commit: 4a6b1b481a2e68a9d3d8a06a9a77111d122455c9
Parents: e7bba28
Author: Timothy A. Bish <[email protected]>
Authored: Thu Sep 23 20:06:46 2010 +0000
Committer: Timothy A. Bish <[email protected]>
Committed: Thu Sep 23 20:06:46 2010 +0000

----------------------------------------------------------------------
 src/main/csharp/Connection.cs | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/blob/4a6b1b48/src/main/csharp/Connection.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Connection.cs b/src/main/csharp/Connection.cs
index 75aa5ed..00840bc 100755
--- a/src/main/csharp/Connection.cs
+++ b/src/main/csharp/Connection.cs
@@ -359,9 +359,15 @@ namespace Apache.NMS.Stomp
             Session session = new Session(this, info, 
sessionAcknowledgementMode, this.dispatchAsync);
 
             // Set properties on session using parameters prefixed with 
"session."
-            StringDictionary options = 
URISupport.ParseQuery(this.brokerUri.Query);
-            options = URISupport.GetProperties(options, "session.");
-            URISupport.SetProperties(session, options);
+            if(!String.IsNullOrEmpty(brokerUri.Query) && 
!brokerUri.OriginalString.EndsWith(")"))
+            {
+                // 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 options = URISupport.ParseQuery(query);
+                options = URISupport.GetProperties(options, "session.");
+                URISupport.SetProperties(session, options);
+            }
 
             session.ConsumerTransformer = this.ConsumerTransformer;
             session.ProducerTransformer = this.ProducerTransformer;

Reply via email to