diff options
author | Robert Greig <rgreig@apache.org> | 2007-01-05 11:56:51 +0000 |
---|---|---|
committer | Robert Greig <rgreig@apache.org> | 2007-01-05 11:56:51 +0000 |
commit | 6e2de8b2e5b3a7e1558ba5328431300a87953a39 (patch) | |
tree | f9a861c9c1c9a04d6d2f2d901ddbbf4dd06cb145 /dotnet | |
parent | a7c424416087c556ac045786009473f0e6d93e40 (diff) | |
download | qpid-python-6e2de8b2e5b3a7e1558ba5328431300a87953a39.tar.gz |
Qpid-238 patch applied. Strange workaround for non-existant bug in string.Split removed.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@492998 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet')
-rw-r--r-- | dotnet/Qpid.Client/Client/Handler/ConnectionStartMethodHandler.cs | 2 | ||||
-rw-r--r-- | dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs | 44 |
2 files changed, 19 insertions, 27 deletions
diff --git a/dotnet/Qpid.Client/Client/Handler/ConnectionStartMethodHandler.cs b/dotnet/Qpid.Client/Client/Handler/ConnectionStartMethodHandler.cs index 2bba8662bb..e88ff3ddbd 100644 --- a/dotnet/Qpid.Client/Client/Handler/ConnectionStartMethodHandler.cs +++ b/dotnet/Qpid.Client/Client/Handler/ConnectionStartMethodHandler.cs @@ -70,7 +70,7 @@ namespace Qpid.Client.Handler throw new AMQException("Locales is not defined in Connection Start method"); } string allLocales = Encoding.ASCII.GetString(body.Locales); - string[] locales = allLocales.Split(new char[] { ' ' }); + string[] locales = allLocales.Split(' '); string selectedLocale; if (locales != null && locales.Length > 0) { diff --git a/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs b/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs index efbeb9edcb..fe0915d4d6 100644 --- a/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs +++ b/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs @@ -193,41 +193,33 @@ namespace Qpid.Client.Message ContentHeaderProperties.ReplyTo = encodedDestination; } + /// <summary> + /// Splits a replyto field containing an exchange name followed by a ':', followed by a routing key into the exchange name and + /// routing key seperately. The exchange name may be empty in which case the empty string is returned. If the exchange name is + /// empty the replyto field is expected to being with ':'. + /// + /// Anyhting other than a two part replyto field sperated with a ':' will result in an exception. + /// </summary> + /// + /// <param name="replyToEncoding">The encoded replyto field to split.</param> + /// <param name="routingKey">A reference to update with the extracted routing key.</param> + /// + /// <returns>The exchange name or the empty string when no exchange name is specified.</returns> private static string GetExchangeName(string replyToEncoding, out string routingKey) { - string[] split = replyToEncoding.Split(new char[':']); - if (_log.IsDebugEnabled) - { - _log.Debug(string.Format("replyToEncoding = '{0}'", replyToEncoding)); - _log.Debug(string.Format("split = {0}", split)); - _log.Debug(string.Format("split.Length = {0}", split.Length)); - } - if (split.Length == 1) - { - // Using an alternative split implementation here since it appears that string.Split - // is broken in .NET. It doesn't split when the first character is the delimiter. - // Here we check for the first character being the delimiter. This handles the case - // where ExchangeName is empty (i.e. sends will be to the default exchange). - if (replyToEncoding[0] == ':') - { - split = new string[2]; - split[0] = null; - split[1] = replyToEncoding.Substring(1); - if (_log.IsDebugEnabled) - { - _log.Debug("Alternative split method..."); - _log.Debug(string.Format("split = {0}", split)); - _log.Debug(string.Format("split.Length = {0}", split.Length)); - } - } - } + // Split the replyto field on a ':' + string[] split = replyToEncoding.Split(':'); + + // Ensure that the replyto field argument only consisted of two parts. if (split.Length != 2) { throw new QpidException("Illegal value in ReplyTo property: " + replyToEncoding); } + // Extract the exchange name and routing key from the split replyto field. string exchangeName = split[0]; routingKey = split[1]; + return exchangeName; } |