[hornetq-commits] JBoss hornetq SVN: r8895 - in trunk: tests/src/org/hornetq/tests/integration/stomp and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Feb 23 08:55:56 EST 2010


Author: jmesnil
Date: 2010-02-23 08:55:56 -0500 (Tue, 23 Feb 2010)
New Revision: 8895

Modified:
   trunk/src/main/org/hornetq/core/protocol/stomp/StompFrameDecoder.java
   trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-129: Implement STOMP v1.0

* skip empty lines at the start of the frame decoding

Modified: trunk/src/main/org/hornetq/core/protocol/stomp/StompFrameDecoder.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/stomp/StompFrameDecoder.java	2010-02-22 14:50:36 UTC (rev 8894)
+++ trunk/src/main/org/hornetq/core/protocol/stomp/StompFrameDecoder.java	2010-02-23 13:55:56 UTC (rev 8895)
@@ -42,16 +42,21 @@
    {
       try
       {
-         String command = StompFrameDecoder.readLine(buffer, StompFrameDecoder.MAX_COMMAND_LENGTH, "The maximum command length was exceeded");
-         if (command == null)
-         {
-            return null;
+         String command = null;
+
+         // skip white space to next real action line
+         while (true) {
+            command = StompFrameDecoder.readLine(buffer, StompFrameDecoder.MAX_COMMAND_LENGTH, "The maximum command length was exceeded");
+             if (command == null) {
+                return null;
+             }
+             else {
+                command = command.trim();
+                 if (command.length() > 0) {
+                     break;
+                 }
+             }
          }
-         command = command.trim();
-         if (command.length() == 0)
-         {
-            return null;
-         }
          
          // Parse the headers
          HashMap<String, Object> headers = new HashMap<String, Object>(25);

Modified: trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java	2010-02-22 14:50:36 UTC (rev 8894)
+++ trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java	2010-02-23 13:55:56 UTC (rev 8895)
@@ -171,7 +171,7 @@
         Assert.assertTrue(frame.startsWith("CONNECTED"));
 
         frame =
-                "SEND\n" +
+                "\nSEND\n" +
                         "destination:" + getQueuePrefix() + getQueueName() + "\n\n" +
                         "Hello World" +
                         Stomp.NULL;



More information about the hornetq-commits mailing list