1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-06-27 05:54:53 +02:00

Fix error handling in BOSHConnection

getCause() never throws. Not sure why the code was written that
way. Thanks to CSH for reporting.
This commit is contained in:
Florian Schmaus 2014-03-18 11:19:37 +01:00
parent 44a5408bc0
commit 9c8d7af3bf

View file

@ -590,12 +590,16 @@ public class BOSHConnection extends XMPPConnection {
} }
else { else {
if (connEvent.isError()) { if (connEvent.isError()) {
try { // TODO Check why jbosh's getCause returns Throwable here. This is very
connEvent.getCause(); // unusual and should be avoided if possible
} Throwable cause = connEvent.getCause();
catch (Exception e) { Exception e;
notifyConnectionError(e); if (cause instanceof Exception) {
e = (Exception) cause;
} else {
e = new Exception(cause);
} }
notifyConnectionError(e);
} }
connected = false; connected = false;
} }