当前位置: 首页>>代码示例>>Java>>正文


Java SSLException.getMessage方法代码示例

本文整理汇总了Java中javax.net.ssl.SSLException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java SSLException.getMessage方法的具体用法?Java SSLException.getMessage怎么用?Java SSLException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.net.ssl.SSLException的用法示例。


在下文中一共展示了SSLException.getMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleSslException

import javax.net.ssl.SSLException; //导入方法依赖的package包/类
private void handleSslException(SSLException e) throws CertificateValidationException, SSLException {
    if (e.getCause() instanceof CertificateException) {
        throw new CertificateValidationException(e.getMessage(), e);
    } else {
        throw e;
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:8,代码来源:ImapConnection.java

示例2: map

import javax.net.ssl.SSLException; //导入方法依赖的package包/类
/**
 * close_notify(0),
 * unexpected_message(10),
 * bad_record_mac(20),
 * decryption_failed_RESERVED(21),
 * record_overflow(22),
 * decompression_failure(30),
 * handshake_failure(40),
 * no_certificate_RESERVED(41),
 * bad_certificate(42),
 * unsupported_certificate(43),
 * certificate_revoked(44),
 * certificate_expired(45),
 * certificate_unknown(46),
 * illegal_parameter(47),
 * unknown_ca(48),
 * access_denied(49),
 * decode_error(50),
 * decrypt_error(51),
 * export_restriction_RESERVED(60),
 * protocol_version(70),
 * insufficient_security(71),
 * internal_error(80),
 * user_canceled(90),
 * no_renegotiation(100),
 * unsupported_extension(110),
 */
@Override
public BackgroundException map(final SSLException failure) {
    final StringBuilder buffer = new StringBuilder();
    for(Throwable cause : ExceptionUtils.getThrowableList(failure)) {
        if(cause instanceof SocketException) {
            // Map Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Broken pipe
            return new DefaultSocketExceptionMappingService().map((SocketException) cause);
        }
    }
    final String message = failure.getMessage();
    for(Alert alert : Alert.values()) {
        if(StringUtils.contains(message, alert.name())) {
            this.append(buffer, alert.getDescription());
            break;
        }
    }
    if(failure instanceof SSLHandshakeException) {
        if(ExceptionUtils.getRootCause(failure) instanceof CertificateException) {
            log.warn(String.format("Ignore certificate failure %s and drop connection", failure.getMessage()));
            // Server certificate not accepted
            return new ConnectionCanceledException(failure);
        }
        return new SSLNegotiateException(buffer.toString(), failure);
    }
    if(ExceptionUtils.getRootCause(failure) instanceof GeneralSecurityException) {
        this.append(buffer, ExceptionUtils.getRootCause(failure).getMessage());
        return new InteroperabilityException(buffer.toString(), failure);
    }
    this.append(buffer, message);
    return new InteroperabilityException(buffer.toString(), failure);
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:59,代码来源:SSLExceptionMappingService.java

示例3: doInitialConnection

import javax.net.ssl.SSLException; //导入方法依赖的package包/类
private ConnectionInfo doInitialConnection()
        throws MessagingException {
    // For our initial connection we are sending an empty GET request to
    // the configured URL, which should be in the following form:
    // https://mail.server.com/Exchange/alias
    //
    // Possible status codes include:
    // 401 - the server uses basic authentication
    // 30x - the server is trying to redirect us to an OWA login
    // 20x - success
    //
    // The latter two indicate form-based authentication.
    ConnectionInfo info = new ConnectionInfo();

    QMailHttpClient httpClient = getHttpClient();

    HttpGeneric request = new HttpGeneric(baseUrl);
    request.setMethod("GET");

    try {
        HttpResponse response = httpClient.executeOverride(request, httpContext);
        info.statusCode = response.getStatusLine().getStatusCode();

        if (info.statusCode == 401) {
            // 401 is the "Unauthorized" status code, meaning the server wants
            // an authentication header for basic authentication.
            info.requiredAuthType = WebDavConstants.AUTH_TYPE_BASIC;
        } else if ((info.statusCode >= 200 && info.statusCode < 300) || // Success
                (info.statusCode >= 300 && info.statusCode < 400) || // Redirect
                (info.statusCode == 440)) { // Unauthorized
            // We will handle all 3 situations the same. First we take an educated
            // guess at where the authorization DLL is located. If this is this
            // doesn't work, then we'll use the redirection URL for OWA login given
            // to us by exchange. We can use this to scrape the location of the
            // authorization URL.
            info.requiredAuthType = WebDavConstants.AUTH_TYPE_FORM_BASED;

            if (formBasedAuthPath != null && !formBasedAuthPath.equals("")) {
                // The user specified their own authentication path, use that.
                info.guessedAuthUrl = getRoot() + formBasedAuthPath;
            } else {
                // Use the default path to the authentication dll.
                info.guessedAuthUrl = getRoot() + "/exchweb/bin/auth/owaauth.dll";
            }

            // Determine where the server is trying to redirect us.
            Header location = response.getFirstHeader("Location");
            if (location != null) {
                info.redirectUrl = location.getValue();
            }
        } else {
            throw new IOException("Error with code " + info.statusCode + " during request processing: " +
                    response.getStatusLine().toString());
        }
    } catch (SSLException e) {
        throw new CertificateValidationException(e.getMessage(), e);
    } catch (IOException ioe) {
        Timber.e(ioe, "IOException during initial connection");
        throw new MessagingException("IOException", ioe);
    }

    return info;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:64,代码来源:WebDavStore.java


注:本文中的javax.net.ssl.SSLException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。