ActiveMQ
  1. ActiveMQ
  2. AMQ-1282

Bad conversion of nonexistent data in MapMessage

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.1
    • Fix Version/s: 5.3.0
    • Component/s: JMS client
    • Labels:
      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

      1. MapMessageTest.java
        5 kB
        Elliotte Rusty Harold

        Activity

        Elliotte Rusty Harold created issue -
        Elliotte Rusty Harold made changes -
        Field Original Value New Value
        Attachment MapMessageTest.java [ 15530 ]
        Rob Davies made changes -
        Fix Version/s 5.2.0 [ 11841 ]
        Gary Tully made changes -
        Fix Version/s 5.2.0 [ 11841 ]
        Fix Version/s 5.3.0 [ 11914 ]
        Rob Davies made changes -
        Assignee Rob Davies [ rajdavies ]
        Gary Tully made changes -
        Fix Version/s 5.4.0 [ 12110 ]
        Fix Version/s 5.3.0 [ 11914 ]
        Rob Davies made changes -
        Resolution Fixed [ 1 ]
        Fix Version/s 5.4.0 [ 12110 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 5.3.0 [ 11914 ]
        Jeff Turner made changes -
        Project Import Fri Nov 26 22:32:02 EST 2010 [ 1290828722158 ]

          People

          • Assignee:
            Rob Davies
            Reporter:
            Elliotte Rusty Harold
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development