You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2006/04/15 10:26:38 UTC

svn commit: r394269 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp: Connect.java FrameBuilder.java

Author: chirino
Date: Sat Apr 15 01:26:30 2006
New Revision: 394269

URL: http://svn.apache.org/viewcvs?rev=394269&view=rev
Log:
frame builder was not adding all the properties (they were not all String values).
Connect should also use the\0\n convention that the frame builder uses.

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Connect.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameBuilder.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Connect.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Connect.java?rev=394269&r1=394268&r2=394269&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Connect.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Connect.java Sat Apr 15 01:26:30 2006
@@ -91,6 +91,7 @@
                         buffer.append(Stomp.NEWLINE);
                         buffer.append(Stomp.NEWLINE);
                         buffer.append(Stomp.NULL);
+                        buffer.append(Stomp.NEWLINE);
                         out.writeBytes(buffer.toString());
                         return true;
                     }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameBuilder.java?rev=394269&r1=394268&r2=394269&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameBuilder.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameBuilder.java Sat Apr 15 01:26:30 2006
@@ -23,6 +23,7 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Map.Entry;
 
 class FrameBuilder {
     private String command;
@@ -95,22 +96,23 @@
     byte[] toFrame() {
         ByteArrayOutputStream bout = new ByteArrayOutputStream();
         try {
-            bout.write(command.getBytes());
-            bout.write(Stomp.NEWLINE.getBytes());
-            for (Iterator iterator = headers.keySet().iterator(); iterator.hasNext();) {
-                String key = (String) iterator.next();
-                String property = headers.getProperty(key);
+            bout.write(command.getBytes("UTF-8"));
+            bout.write(Stomp.NEWLINE.getBytes("UTF-8"));
+            for (Iterator iterator = headers.entrySet().iterator(); iterator.hasNext();) {
+                Map.Entry entry = (Entry) iterator.next();
+                String key = (String) entry.getKey();
+                String property = entry.getValue().toString();
                 if (property != null) {
-                    bout.write(key.getBytes());
-                    bout.write(Stomp.Headers.SEPERATOR.getBytes());
-                    bout.write(property.getBytes());
-                    bout.write(Stomp.NEWLINE.getBytes());
+                    bout.write(key.getBytes("UTF-8"));
+                    bout.write(Stomp.Headers.SEPERATOR.getBytes("UTF-8"));
+                    bout.write(property.getBytes("UTF-8"));
+                    bout.write(Stomp.NEWLINE.getBytes("UTF-8"));
                 }
             }
-            bout.write(Stomp.NEWLINE.getBytes());
+            bout.write(Stomp.NEWLINE.getBytes("UTF-8"));
             bout.write(body);
-            bout.write(Stomp.NULL.getBytes());
-            bout.write(Stomp.NEWLINE.getBytes());
+            bout.write(Stomp.NULL.getBytes("UTF-8"));
+            bout.write(Stomp.NEWLINE.getBytes("UTF-8"));
         }
         catch (IOException e) {
             throw new RuntimeException("World is caving in, we just got io error writing to" + "a byte array output stream we instantiated!");