提交 d2eff4ea 编写于 作者: R Rossen Stoyanchev

Improve GenericMessage.toString()

Restore pringing the payload first and headers second as it has been in
SI but also handle specifically the case where the body is a byte array
to minimize unnecessary "noise" that causes otherwise for STOMP msgs.
上级 61d13547
...@@ -82,9 +82,15 @@ public class GenericMessage<T> implements Message<T>, Serializable { ...@@ -82,9 +82,15 @@ public class GenericMessage<T> implements Message<T>, Serializable {
} }
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Headers=" + this.headers + "]"); StringBuilder sb = new StringBuilder();
if (byte[].class.equals(this.payload.getClass())) {
sb.append("[Payload byte[").append(((byte[]) this.payload).length).append("]]");
}
else {
sb.append("[Payload ").append(this.payload.getClass().getSimpleName()); sb.append("[Payload ").append(this.payload.getClass().getSimpleName());
sb.append(" content=").append(this.payload).append("]"); sb.append(" content=").append(this.payload).append("]");
}
sb.append("[Headers=" + this.headers + "]");
return sb.toString(); return sb.toString();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册