Return-Path: X-Original-To: apmail-activemq-dev-archive@www.apache.org Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 820859E66 for ; Mon, 28 May 2012 16:51:23 +0000 (UTC) Received: (qmail 66033 invoked by uid 500); 28 May 2012 16:51:23 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 65988 invoked by uid 500); 28 May 2012 16:51:23 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 65976 invoked by uid 99); 28 May 2012 16:51:23 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 May 2012 16:51:23 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 2424E140B94 for ; Mon, 28 May 2012 16:51:23 +0000 (UTC) Date: Mon, 28 May 2012 16:51:23 +0000 (UTC) From: "Alan Hudson (JIRA)" To: dev@activemq.apache.org Message-ID: <1043141761.8917.1338223883151.JavaMail.jiratomcat@issues-vm> In-Reply-To: <576596887.9669.1337723801738.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Commented] (AMQ-3856) MessageServlet assumes TextMessages contain Text MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AMQ-3856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13284474#comment-13284474 ] Alan Hudson commented on AMQ-3856: ---------------------------------- Patches are easy I'll get those together. Best I can tell the activemq-web module does not contain any junit tests? or at least the src/test directory doesn't exist as in other modules. Fairly new to coding in ActiveMQ so perhaps they are located some place else? It's possible the right place for these tests is in activemq-web-demo/src/test? I see some reading tests but no POST requests. If that's the right place then I'll work up some POST examples. > 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 > 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); > } > 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