ActiveMQ
  1. ActiveMQ
  2. AMQ-3742

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

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major 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
        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 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);
        Hide
        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
        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 Wheeler added a comment -

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

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

        Fix applied on trunk. Thanks for the test case.

        Show
        Timothy Bish added a comment - Fix applied on trunk. Thanks for the test case.

          People

          • Assignee:
            Timothy Bish
            Reporter:
            David Wheeler
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development