mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-08 22:21:08 +01:00
Remove trailing comma in ConnectionException message
Also add SmackExceptionTest
This commit is contained in:
parent
f7517ab6cc
commit
b6285679cd
2 changed files with 52 additions and 3 deletions
|
|
@ -175,13 +175,14 @@ public class SmackException extends Exception {
|
|||
}
|
||||
|
||||
public static ConnectionException from(List<HostAddress> failedAddresses) {
|
||||
final String DELIMITER = ", ";
|
||||
StringBuilder sb = new StringBuilder("The following addresses failed: ");
|
||||
for (HostAddress hostAddress : failedAddresses) {
|
||||
sb.append(hostAddress.getErrorMessage());
|
||||
sb.append(", ");
|
||||
sb.append(DELIMITER);
|
||||
}
|
||||
// Remove the last whitespace
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
// Remove the last delimiter
|
||||
sb.setLength(sb.length() - DELIMITER.length());
|
||||
return new ConnectionException(sb.toString(), failedAddresses);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue