activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (AMQ-3856) MessageServlet assumes TextMessages contain Text
Date Tue, 29 May 2012 14:21:23 GMT

     [ https://issues.apache.org/jira/browse/AMQ-3856?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Timothy Bish resolved AMQ-3856.
-------------------------------

    Resolution: Fixed
      Assignee: Timothy Bish

Applied the patch and unit tests, thanks for the contribution.  
                
> MessageServlet assumes TextMessages contain Text
> ------------------------------------------------
>
>                 Key: AMQ-3856
>                 URL: https://issues.apache.org/jira/browse/AMQ-3856
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.5.1, 5.6.0
>         Environment: all
>            Reporter: Alan Hudson
>            Assignee: Timothy Bish
>             Fix For: 5.7.0
>
>         Attachments: amq-3856.patch, amq-3856_junit.patch
>
>
> 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);
>                 }
>                 writer.print(txt);
>             }
>         } else if (message instanceof ObjectMessage) {
>             ObjectMessage objectMsg = (ObjectMessage)message;
>             Object object = objectMsg.getObject();
>             writer.print(object.toString());
>         }
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message