aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/xmpp
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-08-01 12:24:22 +0200
committerChristian Schneppe <christian@pix-art.de>2017-08-01 12:24:22 +0200
commit9326c95bb6275bf6b683bd0454aa26355acc8fbf (patch)
treee2840df8eee2899faa6198a3216a402235e22f73 /src/main/java/de/pixart/messenger/xmpp
parent506ba0df107f78c498d4487a833ef1d2d2bf6587 (diff)
catch IllegalArgumentException caused by invalid custom hostname
Diffstat (limited to 'src/main/java/de/pixart/messenger/xmpp')
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/XmppConnection.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
index bd47a41d4..67cb15658 100644
--- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
@@ -328,11 +328,9 @@ public class XmppConnection implements Runnable {
this.verifiedHostname = account.getHostname();
- InetSocketAddress address = new InetSocketAddress(this.verifiedHostname, account.getPort());
-
- features.encryptionEnabled = account.getPort() == 5223;
-
try {
+ InetSocketAddress address = new InetSocketAddress(this.verifiedHostname, account.getPort());
+ features.encryptionEnabled = address.getPort() == 5223;
if (features.encryptionEnabled) {
try {
final TlsFactoryVerifier tlsFactoryVerifier = getTlsFactoryVerifier();
@@ -345,14 +343,13 @@ public class XmppConnection implements Runnable {
throw new StateChangingException(Account.State.TLS_ERROR);
}
} catch (KeyManagementException e) {
- features.encryptionEnabled = false;
- localSocket = new Socket();
+ throw new StateChangingException(Account.State.TLS_ERROR);
}
} else {
localSocket = new Socket();
localSocket.connect(address, Config.SOCKET_TIMEOUT * 1000);
}
- } catch (IOException e) {
+ } catch (IOException | IllegalArgumentException e) {
throw new UnknownHostException();
}
try {