<div dir="ltr">Thanks Tim. How do code to see if the key is there or not?</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 30, 2014 at 11:58 AM, Tim Watson <span dir="ltr"><<a href="mailto:tim@rabbitmq.com" target="_blank">tim@rabbitmq.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">BasicProperties#getHeaders() returns a Map, so Map#get(key) will return `null' if the key isn't present. It's your #toString() on `null' that is likely causing the problem. You could also call Map#containsKey("FirstName") instead of checking for `null' if you prefer.<br>
<br>
Cheers,<br>
Tim<br>
<div><div class="h5"><br>
On 30 Jan 2014, at 16:30, cw storm wrote:<br>
<br>
> Please forgive me but I have a simple question. How can I check to see if there's custom header attribute exist or not before I perform the below:<br>
><br>
> String strFirstName = props.getHeaders().get("FirstName").toString()<br>
><br>
> I believe if there's no custom headers, then it'll exception.<br>
</div></div>> _______________________________________________<br>
> rabbitmq-discuss mailing list<br>
> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
> <a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</blockquote></div><br></div>