If you are retrieving primitive types - you could check using
boolean itemExists(String name)


also from the spec api: http://java.sun.com/j2ee/1.4/docs/api/javax/jms/MapMessage.html

Attempting to read a null value as a primitive type must be treated as calling the primitive's corresponding valueOf(String) conversion method with a null value. Since char does not support a String conversion, attempting to read a null value as a char must throw a NullPointerException.
.. so you are right that it is a bug ... since Integer.valueOf(null) throws an Exception

Elliotte Harold wrote:
Consider simple reception code like this:

       MapMessage message = (MapMessage) consumer.receive(1000);
       int x = message.getInt("foo"));

I notice that x is now set to zero even though there was no "foo" value in
the map. I would have expected an exception.

The JavaDoc is unclear on this point. Is this expected behavior? Can someone
explain to me why it behaves like this? What if zero is a legal value for
the map?