1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-04-09 08:32:07 +02:00

Add more information to NotConnectedException

This commit is contained in:
Florian Schmaus 2015-06-09 13:43:05 +02:00
parent a854e04d28
commit a85ba5311e
2 changed files with 12 additions and 2 deletions
smack-core/src/main/java/org/jivesoftware/smack
smack-tcp/src/main/java/org/jivesoftware/smack/tcp

View file

@ -166,6 +166,11 @@ public class SmackException extends Exception {
public NotConnectedException() {
super("Client is not, or no longer, connected");
}
public NotConnectedException(XMPPConnection connection, String details) {
super("The connection " + connection.toString() + " is no longer connected. "
+ details);
}
}
public static class IllegalStateChangeException extends SmackException {

View file

@ -1210,9 +1210,14 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
}
protected void throwNotConnectedExceptionIfDoneAndResumptionNotPossible() throws NotConnectedException {
if (done() && !isSmResumptionPossible()) {
final boolean done = done();
if (done) {
final boolean smResumptionPossbile = isSmResumptionPossible();
// Don't throw a NotConnectedException is there is an resumable stream available
throw new NotConnectedException();
if (!smResumptionPossbile) {
throw new NotConnectedException(XMPPTCPConnection.this, "done=" + done
+ " smResumptionPossible=" + smResumptionPossbile);
}
}
}