Search in sources :

Example 1 with StreamErrorException

use of org.jivesoftware.smack.XMPPException.StreamErrorException in project Smack by igniterealtime.

the class AbstractXMPPConnection method callConnectionClosedOnErrorListener.

protected void callConnectionClosedOnErrorListener(Exception e) {
    boolean logWarning = true;
    if (e instanceof StreamErrorException) {
        StreamErrorException see = (StreamErrorException) e;
        if (see.getStreamError().getCondition() == StreamError.Condition.not_authorized && wasAuthenticated) {
            logWarning = false;
            LOGGER.log(Level.FINE, "Connection closed with not-authorized stream error after it was already authenticated. The account was likely deleted/unregistered on the server");
        }
    }
    if (logWarning) {
        LOGGER.log(Level.WARNING, "Connection " + this + " closed with error", e);
    }
    for (ConnectionListener listener : connectionListeners) {
        try {
            listener.connectionClosedOnError(e);
        } catch (Exception e2) {
            // Catch and print any exception so we can recover
            // from a faulty listener
            LOGGER.log(Level.SEVERE, "Error in listener while closing connection", e2);
        }
    }
}
Also used : StreamErrorException(org.jivesoftware.smack.XMPPException.StreamErrorException) SecurityRequiredException(org.jivesoftware.smack.SmackException.SecurityRequiredException) XMPPErrorException(org.jivesoftware.smack.XMPPException.XMPPErrorException) AlreadyLoggedInException(org.jivesoftware.smack.SmackException.AlreadyLoggedInException) NotConnectedException(org.jivesoftware.smack.SmackException.NotConnectedException) StreamErrorException(org.jivesoftware.smack.XMPPException.StreamErrorException) NoResponseException(org.jivesoftware.smack.SmackException.NoResponseException) IOException(java.io.IOException) AlreadyConnectedException(org.jivesoftware.smack.SmackException.AlreadyConnectedException) SecurityRequiredByClientException(org.jivesoftware.smack.SmackException.SecurityRequiredByClientException) ResourceBindingNotOfferedException(org.jivesoftware.smack.SmackException.ResourceBindingNotOfferedException)

Aggregations

IOException (java.io.IOException)1 AlreadyConnectedException (org.jivesoftware.smack.SmackException.AlreadyConnectedException)1 AlreadyLoggedInException (org.jivesoftware.smack.SmackException.AlreadyLoggedInException)1 NoResponseException (org.jivesoftware.smack.SmackException.NoResponseException)1 NotConnectedException (org.jivesoftware.smack.SmackException.NotConnectedException)1 ResourceBindingNotOfferedException (org.jivesoftware.smack.SmackException.ResourceBindingNotOfferedException)1 SecurityRequiredByClientException (org.jivesoftware.smack.SmackException.SecurityRequiredByClientException)1 SecurityRequiredException (org.jivesoftware.smack.SmackException.SecurityRequiredException)1 StreamErrorException (org.jivesoftware.smack.XMPPException.StreamErrorException)1 XMPPErrorException (org.jivesoftware.smack.XMPPException.XMPPErrorException)1