https://issues.apache.org/jira/browse/AMQNET-454
applied:
https://issues.apache.org/jira/secure/attachment/12622979/Apache.NMS.AMQP-copyrights-conn-str-fix-09.patch
diff --git a/src/main/csharp/Connection.cs b/src/main/csharp/Connection.cs
index 13906fa..0b32918 100644
--- a/src/main/csharp/Connection.cs
+++ b/src/main/csharp/Connection.cs
@@ -32,8 +32,8 @@
{
// Connections options indexes and constants
private const string PROTOCOL_OPTION = "protocol";
- private const string PROTOCOL_0_10 = "amqp0.10";
private const string PROTOCOL_1_0 = "amqp1.0";
+ private const string PROTOCOL_0_10 = "amqp0-10";
private const char SEP_ARGS = ',';
private const char SEP_NAME_VALUE = ':';
public const string USERNAME_OPTION = "username";
@@ -338,7 +338,7 @@
qpidConnection =
new Org.Apache.Qpid.Messaging.Connection(
brokerUri.ToString(),
- ConstructConnectionOptionsString());
+ ConstructConnectionOptionsString(connectionProperties));
}
// Open the connection
@@ -584,35 +584,12 @@
/// Convert specified connection properties string map into the
/// connection properties string to send to Qpid Messaging.
/// </summary>
- /// <returns>void</returns>
- /// <remarks>Mostly this is pass-through but special processing is applied
- /// to the protocol version to get a default amqp1.0.</remarks>
- internal string ConstructConnectionOptionsString()
+ /// <returns>qpid connection properties string</returns>
+ /// <remarks>Mostly this is pass-through. Default to amqp1.0
+ /// in the absence of any protocol option.</remarks>
+ internal string ConstructConnectionOptionsString(StringDictionary cp)
{
string result = "";
- // construct new dictionary with desired settings
- StringDictionary cp = connectionProperties;
-
- // protocol version munging
- if (cp.ContainsKey(PROTOCOL_OPTION))
- {
- // protocol option specified
- if (cp[PROTOCOL_OPTION].Equals(PROTOCOL_0_10))
- {
- // amqp 0.10 selected by setting _no_ option
- cp.Remove(PROTOCOL_OPTION);
- }
- else
- {
- // amqp version set but not to version 0.10 - pass it through
- }
- }
- else
- {
- // no protocol option - select 1.0
- cp.Add(PROTOCOL_OPTION, PROTOCOL_1_0);
- }
-
// Construct qpid connection string
bool first = true;
result = "{";
@@ -623,9 +600,21 @@
result += SEP_ARGS;
}
result += de.Key + SEP_NAME_VALUE.ToString() + de.Value;
+ first = false;
}
- result += "}";
+ // protocol version munging
+ if (!cp.ContainsKey(PROTOCOL_OPTION))
+ {
+ // no protocol option - select 1.0
+ if (!first)
+ {
+ result += SEP_ARGS;
+ }
+ result += PROTOCOL_OPTION + SEP_NAME_VALUE.ToString() + PROTOCOL_1_0;
+ }
+
+ result += "}";
return result;
}
diff --git a/vs2010-amqp-test.csproj b/vs2010-amqp-test.csproj
index cdf2fbb..de16953 100644
--- a/vs2010-amqp-test.csproj
+++ b/vs2010-amqp-test.csproj
@@ -1,4 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
diff --git a/vs2010-amqp.csproj b/vs2010-amqp.csproj
index c333985..541a60b 100644
--- a/vs2010-amqp.csproj
+++ b/vs2010-amqp.csproj
@@ -1,4 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>