activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Hudson (JIRA)" <>
Subject [jira] [Created] (AMQ-3856) MessageServlet assumes TextMessages contain Text
Date Tue, 22 May 2012 21:56:41 GMT
Alan Hudson created AMQ-3856:

             Summary: MessageServlet assumes TextMessages contain Text
                 Key: AMQ-3856
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 5.6.0, 5.5.1
         Environment: all
            Reporter: Alan Hudson
             Fix For: 5.7.0

writeMessageResponse assumes that a text message will contain non null text.  It does a txt.startsWith
which crashes with TextMessages with no body.

It can be fixed with this code:

    protected void writeMessageResponse(PrintWriter writer, Message message) throws JMSException,
IOException {
        if (message instanceof TextMessage) {
            TextMessage textMsg = (TextMessage)message;
            String txt = textMsg.getText();
            if (txt != null) {
                if (txt.startsWith("<?")) {
                    txt = txt.substring(txt.indexOf("?>") + 2);
        } else if (message instanceof ObjectMessage) {
            ObjectMessage objectMsg = (ObjectMessage)message;
            Object object = objectMsg.getObject();

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message