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

STOMP subscriber does not receive TextMessage with null body sent from JMS

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.5.1
    • Fix Version/s: 5.6.0
    • Component/s: stomp
    • Labels:
      None

      Description

      If a JMS publisher sends a TextMessage with null body, any STOMP subscribers to the topic (I haven't tested queues) will not receive that message or any further messages on that topic.

        Activity

        Hide
        tabish121 Timothy Bish added a comment -

        Fix applied on trunk. Thanks for the test case.

        Show
        tabish121 Timothy Bish added a comment - Fix applied on trunk. Thanks for the test case.
        Hide
        david@inomial.com David Wheeler added a comment -

        Patch file attached (sorry - I couldn't work out how to attach a file in JIRA)

        Show
        david@inomial.com David Wheeler added a comment - Patch file attached (sorry - I couldn't work out how to attach a file in JIRA)
        Hide
        tabish121 Timothy Bish added a comment -

        You need to attach you patch as a file to this issue and tick the "grant license to apache" checkbox so we can include it. Thanks.

        Show
        tabish121 Timothy Bish added a comment - You need to attach you patch as a file to this issue and tick the "grant license to apache" checkbox so we can include it. Thanks.
        Hide
        david@inomial.com David Wheeler added a comment - - edited

        I've created the following extra test method that should reproduce the issue

        StompTest.java.patch
        Index: src/test/java/org/apache/activemq/transport/stomp/StompTest.java
        ===================================================================
        --- src/test/java/org/apache/activemq/transport/stomp/StompTest.java	(revision 1294315)
        +++ src/test/java/org/apache/activemq/transport/stomp/StompTest.java	(working copy)
        @@ -1819,6 +1819,24 @@
                 doReplyToAcrossConnections("queue");
             }
         
        +    public void testSendNullBodyTextMessage() throws Exception {
        +      String frame = "CONNECT\n" + "login: system\n" + "passcode: manager\n\n" + Stomp.NULL;
        +      stompConnection.sendFrame(frame);
        +
        +      frame = stompConnection.receiveFrame();
        +      assertTrue(frame.startsWith("CONNECTED"));
        +
        +      frame = "SUBSCRIBE\n" + "destination:/queue/" + getQueueName() + "\n" + "ack:auto\n\n" + Stomp.NULL;
        +      stompConnection.sendFrame(frame);
        +
        +      sendMessage(null);
        +      frame = stompConnection.receiveFrame();
        +      assertNotNull("Message not received", frame);
        +
        +      frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL;
        +      stompConnection.sendFrame(frame);
        +    }
        +    
             private void doReplyToAcrossConnections(String type) throws Exception {
                 LOG.info("Starting test on Temp Destinations using a temporary: " + type);
        
        Show
        david@inomial.com David Wheeler added a comment - - edited I've created the following extra test method that should reproduce the issue StompTest.java.patch Index: src/test/java/org/apache/activemq/transport/stomp/StompTest.java =================================================================== --- src/test/java/org/apache/activemq/transport/stomp/StompTest.java (revision 1294315) +++ src/test/java/org/apache/activemq/transport/stomp/StompTest.java (working copy) @@ -1819,6 +1819,24 @@ doReplyToAcrossConnections( "queue" ); } + public void testSendNullBodyTextMessage() throws Exception { + String frame = "CONNECT\n" + "login: system\n" + "passcode: manager\n\n" + Stomp.NULL; + stompConnection.sendFrame(frame); + + frame = stompConnection.receiveFrame(); + assertTrue(frame.startsWith( "CONNECTED" )); + + frame = "SUBSCRIBE\n" + "destination:/queue/" + getQueueName() + "\n" + "ack:auto\n\n" + Stomp.NULL; + stompConnection.sendFrame(frame); + + sendMessage( null ); + frame = stompConnection.receiveFrame(); + assertNotNull( "Message not received" , frame); + + frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL; + stompConnection.sendFrame(frame); + } + private void doReplyToAcrossConnections( String type) throws Exception { LOG.info( "Starting test on Temp Destinations using a temporary: " + type);

          People

          • Assignee:
            tabish121 Timothy Bish
            Reporter:
            david@inomial.com David Wheeler
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development