ActiveMQ
  1. ActiveMQ
  2. AMQ-2585

ActiveMQTextMessage.getSize() does not consider size of properties

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.3.0
    • Fix Version/s: 5.4.0
    • Component/s: JMS client
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      Checking the size of a text message only considers the body of a message, not the properties. I think this relates to a typo in the method:

          public int getSize() {
              if (size == 0 && content == null && text != null) {
                  size = getMinimumMessageSize();
                  if (marshalledProperties != null) {
                      size += marshalledProperties.getLength();
                  }
                  size = text.length() * 2;
              }
              return super.getSize();
          }
      

      This should perhaps be size += text.length() * 2?

        Activity

        Hide
        Magnus Persson added a comment -

        Test attached

        Show
        Magnus Persson added a comment - Test attached
        Hide
        Gary Tully added a comment -

        thanks for the test case. I made some mods as the override of min message size is only relevant to the broker. The size is calculated on demand for consumers.
        committed in r904585

        Show
        Gary Tully added a comment - thanks for the test case. I made some mods as the override of min message size is only relevant to the broker. The size is calculated on demand for consumers. committed in r904585
        Hide
        Gary Tully added a comment -

        one more thing, just for completeness, the properties were not marshaled by default with the vm transport so they did not appear in the size calculation. adding marshall=true to the vm url ensured they were part of the calculation.

        Show
        Gary Tully added a comment - one more thing, just for completeness, the properties were not marshaled by default with the vm transport so they did not appear in the size calculation. adding marshall=true to the vm url ensured they were part of the calculation.

          People

          • Assignee:
            Gary Tully
            Reporter:
            Magnus Persson
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development