git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@730071 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2008-12-30 08:47:59 +00:00
parent 30f41b9811
commit 90fd917a67
2 changed files with 7 additions and 1 deletions

View File

@ -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);

View File

@ -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);