[rabbitmq-discuss] [Patch] .NET client: ignored params in QueueBind

Vadim Chekan kot.begemot at gmail.com
Wed Dec 29 19:30:48 GMT 2010


When you bind a queue to "fanout" exchange, routing key can be skipped
(not provided) according to the spec. In C# client it is implemented
by providing empty value:
model.QueueBind(queue, Program.COST_QUEUE, ->""<-, false, null);
But intuitively we tend to pass "null" for parameters that are not
used. In current implementation it causes a null exception on attempt
to convert null string into array.

So either parameters must be checked for non-null constraint, or (my
preference) null should be interpreted as empty parameter.

Vadim.

==========================================================
diff -r 982a0b810bcb
projects/client/RabbitMQ.Client/src/client/impl/WireFormatting.cs
--- a/projects/client/RabbitMQ.Client/src/client/impl/WireFormatting.cs
Thu Oct 28 14:49:55 2010 +0100
+++ b/projects/client/RabbitMQ.Client/src/client/impl/WireFormatting.cs
Wed Dec 29 11:29:24 2010 -0800
@@ -236,7 +236,13 @@
         }

         public static void WriteShortstr(NetworkBinaryWriter writer,
string val)
-        {
+        {
+            if (string.IsNullOrEmpty(val))
+            {
+                writer.Write((byte)0);
+                return;
+            }
+
             byte[] bytes = Encoding.UTF8.GetBytes(val);
             int len = bytes.Length;
             if (len > 255)
==========================================================

-- 
>From RFC 2631: In ASN.1, EXPLICIT tagging is implicit unless IMPLICIT
is explicitly specified


More information about the rabbitmq-discuss mailing list