activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r730071 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/command/ActiveMQTextMessage.java test/java/org/apache/activemq/command/ActiveMQTextMessageTest.java
Date Tue, 30 Dec 2008 08:48:00 GMT
Author: dejanb
Date: Tue Dec 30 00:47:59 2008
New Revision: 730071

URL: http://svn.apache.org/viewvc?rev=730071&view=rev
Log:
fix for https://issues.apache.org/activemq/browse/AMQ-2046

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTextMessage.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQTextMessageTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTextMessage.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTextMessage.java?rev=730071&r1=730070&r2=730071&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTextMessage.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTextMessage.java
Tue Dec 30 00:47:59 2008
@@ -151,7 +151,7 @@
     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);

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQTextMessageTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQTextMessageTest.java?rev=730071&r1=730070&r2=730071&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQTextMessageTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQTextMessageTest.java
Tue Dec 30 00:47:59 2008
@@ -143,6 +143,12 @@
         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);



Mime
View raw message