ARTEMIS-1395 Clean up toString code

Clean up toString code and properly log error message.
This commit is contained in:
Timothy Bish 2017-09-08 12:44:07 -04:00
parent 9c31055aba
commit 8dddc7370c
1 changed files with 3 additions and 10 deletions

View File

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