[rabbitmq-discuss] Java RabbitMQ API bug in response.getHeaders()?

Tony Garnock-Jones tonygarnockjones+rabbitmq at gmail.com
Thu Oct 27 17:06:48 BST 2011


On 27 October 2011 10:41, Mario Leyton <mleyton at niclabs.cl> wrote:

>  We are using rabbitmq java client and I believe the following is a bug:
>

Nope, it's deliberate. null, here, represents that no headers were sent.
This is distinct from an empty map being sent. AMQP's basic properties
structure includes "absent/present" bits for all of the fields; we chose to
use "null" to represent "missing", as in this instance it is unambiguous.
In languages like ML and Haskell we'd use 'whatever option and Maybe
whatever, respectively. In C, we use a bitmap stored separately from the
struct members concerned.

So when reading (or writing!) basic properties in Java,

   - null means "missing value" or "no value"
   - empty map, empty string etc. is a *present* value but is otherwise
   just itself
   - non-empty maps, strings, etc are present values

Regards,
  Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20111027/9726c0c2/attachment.htm>


More information about the rabbitmq-discuss mailing list