From 8dddc7370c9f2af1354d03fadc206c852d94077c Mon Sep 17 00:00:00 2001 From: Timothy Bish Date: Fri, 8 Sep 2017 12:44:07 -0400 Subject: [PATCH] ARTEMIS-1395 Clean up toString code Clean up toString code and properly log error message. --- .../artemis/core/message/impl/CoreMessage.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java index 0428a58fca..516addc3cb 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java @@ -22,7 +22,6 @@ import java.nio.ByteBuffer; import java.util.LinkedList; import java.util.Set; -import io.netty.buffer.ByteBuf; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQBuffers; import org.apache.activemq.artemis.api.core.ActiveMQException; @@ -43,6 +42,8 @@ import org.apache.activemq.artemis.utils.UUID; import org.apache.activemq.artemis.utils.collections.TypedProperties; import org.jboss.logging.Logger; +import io.netty.buffer.ByteBuf; + /** Note: you shouldn't change properties using multi-threads. Change your properties before you can send it to multiple * consumers */ public class CoreMessage extends RefCountMessage implements ICoreMessage { @@ -1066,7 +1067,6 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage { initBuffer(size); buffer.setIndex(0, 0).writeBytes(record.byteBuf(), size); decode(); - } @Override @@ -1074,8 +1074,6 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage { return this; } - - @Override public String toString() { try { @@ -1084,21 +1082,16 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage { ", timestamp=" + toDate(getTimestamp()) + ",expiration=" + toDate(getExpiration()) + ", durable=" + durable + ", address=" + getAddress() + ",properties=" + properties + "]@" + System.identityHashCode(this); } catch (Throwable e) { - e.printStackTrace(); - System.exit(-1); + logger.warn("Error creating String for message: ", e); return "ServerMessage[messageID=" + messageID + "]"; } } - private static String toDate(long timestamp) { if (timestamp == 0) { return "0"; } else { return new java.util.Date(timestamp).toString(); } - } - - }