diff --git a/activemq-web/src/main/java/org/apache/activemq/web/MessageQuery.java b/activemq-web/src/main/java/org/apache/activemq/web/MessageQuery.java index 1d0ec066a8..ee06001c92 100644 --- a/activemq-web/src/main/java/org/apache/activemq/web/MessageQuery.java +++ b/activemq-web/src/main/java/org/apache/activemq/web/MessageQuery.java @@ -19,12 +19,13 @@ package org.apache.activemq.web; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; - +import javax.jms.BytesMessage; import javax.jms.JMSException; import javax.jms.MapMessage; import javax.jms.Message; import javax.jms.ObjectMessage; import javax.jms.QueueBrowser; +import javax.jms.StreamMessage; import javax.jms.TextMessage; /** @@ -88,21 +89,27 @@ public class MessageQuery extends QueueBrowseQuery { if (message instanceof MapMessage) { return createMapBody((MapMessage) message); } - return null; - } - - public Map getPropertiesMap() throws JMSException { - Map answer = new HashMap(); - Message aMessage = getMessage(); - Enumeration iter = aMessage.getPropertyNames(); - while (iter.hasMoreElements()) { - String name = (String) iter.nextElement(); - Object value = aMessage.getObjectProperty(name); - if (value != null) { - answer.put(name, value); + if (message instanceof BytesMessage) { + BytesMessage msg = (BytesMessage) message; + int len = (int) msg.getBodyLength(); + if (len > -1) { + byte[] data = new byte[len]; + msg.readBytes(data); + return new String(data); + } else { + return ""; } } - return answer; + if (message instanceof StreamMessage) { + return "StreamMessage is not viewable"; + } + + // unknown message type + if (message != null) { + return "Unknown message type [" + message.getClass().getName() + "] " + message; + } + + return null; } protected Map createMapBody(MapMessage mapMessage) throws JMSException {