Qpid
  1. Qpid
  2. QPID-223

Sending the same message multiple times results in a MessageNotWriteable exception

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Java Client
    • Labels:

      Description

      Sending the same message multiple times results in a MessageNotWriteable exception

      This is due to the fact that this test resends the same TextMessage many times but the reset method on AbstractJMSMessage was performing a flip() on the buffer rather a rewind() between each message send. This was caused by the logic that decides whether to perform a flip or rewind being driven by the _isReadable flag when really the choice should be made depending on whether or not the buffer has 'just been written to' as opposed to 'just read'. A new flag to distinguish these two conditions, _changedData, has been introduced into AbstractJMSMessage and all methods in its derived child classes set this flag whenever they have just written to the buffer, so that the next reset and subsequent resets work correctly.

      The _changedData flag is initially set to true if an AbstractJMSMessage is created with no data, so that reset works correctly on null messages. When AbstractJMSMessage is created with data, the buffer passed to it has already been flipped, so _changedData is set to false.

      A patch to fix this is included.

      1. QPID-22X.txt
        7 kB
        Rupert Smith

        Activity

          People

          • Assignee:
            Martin Ritchie
            Reporter:
            Rupert Smith
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development