You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2007/01/05 12:56:52 UTC

svn commit: r492998 - in /incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client: Handler/ConnectionStartMethodHandler.cs Message/AbstractQmsMessage.cs

Author: rgreig
Date: Fri Jan  5 03:56:51 2007
New Revision: 492998

URL: http://svn.apache.org/viewvc?view=rev&rev=492998
Log:
Qpid-238 patch applied. Strange workaround for non-existant bug in string.Split removed.

Modified:
    incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Handler/ConnectionStartMethodHandler.cs
    incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs

Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Handler/ConnectionStartMethodHandler.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Handler/ConnectionStartMethodHandler.cs?view=diff&rev=492998&r1=492997&r2=492998
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Handler/ConnectionStartMethodHandler.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Handler/ConnectionStartMethodHandler.cs Fri Jan  5 03:56:51 2007
@@ -70,7 +70,7 @@
                     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)
                 {

Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs?view=diff&rev=492998&r1=492997&r2=492998
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs Fri Jan  5 03:56:51 2007
@@ -193,41 +193,33 @@
             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;
         }