Search in sources :

Example 1 with CertificateValidationException

use of com.android.voicemail.impl.mail.CertificateValidationException in project android_packages_apps_Dialer by LineageOS.

the class ImapConnection method open.

public void open() throws IOException, MessagingException {
    if (mTransport != null && mTransport.isOpen()) {
        return;
    }
    try {
        // copy configuration into a clean transport, if necessary
        if (mTransport == null) {
            mTransport = mImapStore.cloneTransport();
        }
        mTransport.open();
        createParser();
        // The server should greet us with something like
        // * OK IMAP4rev1 Server
        // consume the response before doing anything else.
        ImapResponse response = mParser.readResponse(false);
        if (!response.isOk()) {
            mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_INVALID_INITIAL_SERVER_RESPONSE);
            throw new MessagingException(MessagingException.AUTHENTICATION_FAILED_OR_SERVER_ERROR, "Invalid server initial response");
        }
        queryCapability();
        maybeDoStartTls();
        // LOGIN
        doLogin();
    } catch (SSLException e) {
        LogUtils.d(TAG, "SSLException ", e);
        mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_SSL_EXCEPTION);
        throw new CertificateValidationException(e.getMessage(), e);
    } catch (IOException ioe) {
        LogUtils.d(TAG, "IOException", ioe);
        mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_IOE_ON_OPEN);
        throw ioe;
    } finally {
        destroyResponses();
    }
}
Also used : MessagingException(com.android.voicemail.impl.mail.MessagingException) ImapResponse(com.android.voicemail.impl.mail.store.imap.ImapResponse) CertificateValidationException(com.android.voicemail.impl.mail.CertificateValidationException) IOException(java.io.IOException) SSLException(javax.net.ssl.SSLException)

Aggregations

CertificateValidationException (com.android.voicemail.impl.mail.CertificateValidationException)1 MessagingException (com.android.voicemail.impl.mail.MessagingException)1 ImapResponse (com.android.voicemail.impl.mail.store.imap.ImapResponse)1 IOException (java.io.IOException)1 SSLException (javax.net.ssl.SSLException)1