mirror of https://github.com/apache/activemq.git
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@730071 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
30f41b9811
commit
90fd917a67
|
@ -151,7 +151,7 @@ public class ActiveMQTextMessage extends ActiveMQMessage implements TextMessage
|
|||
public String toString() {
|
||||
try {
|
||||
String text = getText();
|
||||
if (text.length() > 63) {
|
||||
if (text != null && text.length() > 63) {
|
||||
text = text.substring(0, 45) + "..." + text.substring(text.length() - 12);
|
||||
HashMap<String, Object> overrideFields = new HashMap<String, Object>();
|
||||
overrideFields.put("text", text);
|
||||
|
|
|
@ -143,6 +143,12 @@ public class ActiveMQTextMessageTest extends TestCase {
|
|||
assertTrue(longMessage.getText().equals(longText));
|
||||
}
|
||||
|
||||
public void testNullText() throws Exception {
|
||||
ActiveMQTextMessage nullMessage = new ActiveMQTextMessage();
|
||||
setContent(nullMessage, null);
|
||||
assertTrue(nullMessage.toString().contains("text = null"));
|
||||
}
|
||||
|
||||
protected void setContent(Message message, String text) throws Exception {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
DataOutputStream dataOut = new DataOutputStream(baos);
|
||||
|
|
Loading…
Reference in New Issue