Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-1282

Bad conversion of nonexistent data in MapMessage

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.1.1
    • 5.3.0
    • JMS client
    • None

    Description

      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.

      According to Gaurav Hariani <gaurav@blackspark.com>

      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

      Attachments

        1. MapMessageTest.java
          5 kB
          Elliotte Rusty Harold

        Activity

          People

            rajdavies Robert Davies
            eharold Elliotte Rusty Harold
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: