mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-24 01:32:17 -05:00
catch IllegalArgumentException caused by invalid custom hostname
This commit is contained in:
parent
2dce71cd96
commit
febee9863f
@ -300,11 +300,9 @@ public class XmppConnection implements Runnable {
|
|||||||
|
|
||||||
this.verifiedHostname = account.getHostname();
|
this.verifiedHostname = account.getHostname();
|
||||||
|
|
||||||
InetSocketAddress address = new InetSocketAddress(this.verifiedHostname, account.getPort());
|
|
||||||
|
|
||||||
features.encryptionEnabled = account.getPort() == 5223;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
InetSocketAddress address = new InetSocketAddress(this.verifiedHostname, account.getPort());
|
||||||
|
features.encryptionEnabled = address.getPort() == 5223;
|
||||||
if (features.encryptionEnabled) {
|
if (features.encryptionEnabled) {
|
||||||
try {
|
try {
|
||||||
final TlsFactoryVerifier tlsFactoryVerifier = getTlsFactoryVerifier();
|
final TlsFactoryVerifier tlsFactoryVerifier = getTlsFactoryVerifier();
|
||||||
@ -317,14 +315,13 @@ public class XmppConnection implements Runnable {
|
|||||||
throw new StateChangingException(Account.State.TLS_ERROR);
|
throw new StateChangingException(Account.State.TLS_ERROR);
|
||||||
}
|
}
|
||||||
} catch (KeyManagementException e) {
|
} catch (KeyManagementException e) {
|
||||||
features.encryptionEnabled = false;
|
throw new StateChangingException(Account.State.TLS_ERROR);
|
||||||
localSocket = new Socket();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
localSocket = new Socket();
|
localSocket = new Socket();
|
||||||
localSocket.connect(address, Config.SOCKET_TIMEOUT * 1000);
|
localSocket.connect(address, Config.SOCKET_TIMEOUT * 1000);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException | IllegalArgumentException e) {
|
||||||
throw new UnknownHostException();
|
throw new UnknownHostException();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user