Show all exceptions ErrorsWhileSendingOrReceivingException message

This commit is contained in:
Florian Schmaus 2019-03-20 20:16:21 +01:00
parent 1dd68336eb
commit a9b88d7517
1 changed files with 23 additions and 1 deletions

View File

@ -299,10 +299,32 @@ public class XmppConnectionStressTest {
private ErrorsWhileSendingOrReceivingException(Map<XMPPConnection, Exception> sendExceptions,
Map<XMPPConnection, Exception> receiveExceptions) {
super("Exceptions while sending and/or receiving");
super(createMessageFrom(sendExceptions, receiveExceptions));
this.sendExceptions = sendExceptions;
this.receiveExceptions = receiveExceptions;
}
private static String createMessageFrom(Map<XMPPConnection, Exception> sendExceptions,
Map<XMPPConnection, Exception> receiveExceptions) {
StringBuilder sb = new StringBuilder(1024);
sb.append("Exceptions while sending and/or receiving.");
if (!sendExceptions.isEmpty()) {
sb.append(" Send exxceptions: ");
for (Map.Entry<XMPPConnection, Exception> entry : sendExceptions.entrySet()) {
sb.append(entry.getKey()).append(": ").append(entry.getValue()).append(';');
}
}
if (!receiveExceptions.isEmpty()) {
sb.append(" Receive exceptions: ");
for (Map.Entry<XMPPConnection, Exception> entry : receiveExceptions.entrySet()) {
sb.append(entry.getKey()).append(": ").append(entry.getValue());
}
}
return sb.toString();
}
}
}
}