1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-22 10:37:59 +01: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

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);
}
}
}