You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2012/07/16 17:27:55 UTC

svn commit: r1362091 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/transport/stomp/StompWireFormat.java test/java/org/apache/activemq/transport/stomp/Stomp11Test.java

Author: tabish
Date: Mon Jul 16 15:27:54 2012
New Revision: 1362091

URL: http://svn.apache.org/viewvc?rev=1362091&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQ-3929

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java?rev=1362091&r1=1362090&r2=1362091&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java Mon Jul 16 15:27:54 2012
@@ -208,7 +208,10 @@ public class StompWireFormat implements 
                     ByteSequence nameSeq = stream.toByteSequence();
                     String name = new String(nameSeq.getData(), nameSeq.getOffset(), nameSeq.getLength(), "UTF-8");
                     String value = decodeHeader(headerLine);
-                    headers.put(name, value);
+
+                    if (!headers.containsKey(name)) {
+                    	headers.put(name, value);
+                    }
                 } catch (Exception e) {
                     throw new ProtocolException("Unable to parser header line [" + line + "]", true);
                 }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java?rev=1362091&r1=1362090&r2=1362091&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java Mon Jul 16 15:27:54 2012
@@ -621,6 +621,38 @@ public class Stomp11Test extends Combina
         assertEquals("JMSXGroupID", "abc", message.getStringProperty("JMSXGroupID"));
         ActiveMQTextMessage amqMessage = (ActiveMQTextMessage)message;
         assertEquals("GroupID", "abc", amqMessage.getGroupID());
+
+        frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL;
+        stompConnection.sendFrame(frame);
+    }
+
+    public void testSendMessageWithRepeatedEntries() throws Exception {
+
+        MessageConsumer consumer = session.createConsumer(queue);
+
+        String frame = "CONNECT\n" + "login:system\n" + "passcode:manager\n" +
+                "accept-version:1.1" + "\n\n" + Stomp.NULL;
+        stompConnection.sendFrame(frame);
+
+        frame = stompConnection.receiveFrame();
+        assertTrue(frame.startsWith("CONNECTED"));
+
+        frame = "SEND\n" +
+        		"value:newest" + "\n" +
+        		"value:older" + "\n" +
+        		"value:oldest" + "\n" +
+        		"destination:/queue/" + getQueueName() +
+        		"\n\n" + "Hello World" + Stomp.NULL;
+
+        stompConnection.sendFrame(frame);
+
+        TextMessage message = (TextMessage)consumer.receive(2500);
+        assertNotNull(message);
+        assertEquals("Hello World", message.getText());
+        assertEquals("newest", message.getStringProperty("value"));
+
+        frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL;
+        stompConnection.sendFrame(frame);
     }
 
     public void testSubscribeWithMessageSentWithEncodedProperties() throws Exception {