From a9b88d7517e3bf20968b743949ace007f585a6a8 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 20 Mar 2019 20:16:21 +0100 Subject: [PATCH] Show all exceptions ErrorsWhileSendingOrReceivingException message --- .../smack/XmppConnectionStressTest.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/XmppConnectionStressTest.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/XmppConnectionStressTest.java index 8cabed30c..acb62b869 100644 --- a/smack-integration-test/src/main/java/org/igniterealtime/smack/XmppConnectionStressTest.java +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/XmppConnectionStressTest.java @@ -299,10 +299,32 @@ public class XmppConnectionStressTest { private ErrorsWhileSendingOrReceivingException(Map sendExceptions, Map receiveExceptions) { - super("Exceptions while sending and/or receiving"); + super(createMessageFrom(sendExceptions, receiveExceptions)); this.sendExceptions = sendExceptions; this.receiveExceptions = receiveExceptions; } + + private static String createMessageFrom(Map sendExceptions, + Map receiveExceptions) { + StringBuilder sb = new StringBuilder(1024); + sb.append("Exceptions while sending and/or receiving."); + + if (!sendExceptions.isEmpty()) { + sb.append(" Send exxceptions: "); + for (Map.Entry entry : sendExceptions.entrySet()) { + sb.append(entry.getKey()).append(": ").append(entry.getValue()).append(';'); + } + } + + if (!receiveExceptions.isEmpty()) { + sb.append(" Receive exceptions: "); + for (Map.Entry entry : receiveExceptions.entrySet()) { + sb.append(entry.getKey()).append(": ").append(entry.getValue()); + } + } + + return sb.toString(); + } } } }