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.

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@394269 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-04-15 08:26:30 +00:00
parent 70c5073fb3
commit 5c03c7df96
2 changed files with 15 additions and 12 deletions

View File

@ -91,6 +91,7 @@ class Connect implements StompCommand {
buffer.append(Stomp.NEWLINE);
buffer.append(Stomp.NEWLINE);
buffer.append(Stomp.NULL);
buffer.append(Stomp.NEWLINE);
out.writeBytes(buffer.toString());
return true;
}

View File

@ -23,6 +23,7 @@ import java.io.IOException;
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 @@ class FrameBuilder {
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!");