Home / Function/ translateToError() — netty Function Reference

translateToError() — netty Function Reference

Architecture documentation for the translateToError() function in ReferenceCountedOpenSslContext.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  df831a92_239f_6192_640e_8a708e1ffa88["translateToError()"]
  bd6cb3cd_28ba_9556_fe33_80dfb47504fa["AbstractCertificateVerifier"]
  df831a92_239f_6192_640e_8a708e1ffa88 -->|defined in| bd6cb3cd_28ba_9556_fe33_80dfb47504fa
  88eaa78d_7923_5b08_eaca_7292b4cd8e6a["verify()"]
  88eaa78d_7923_5b08_eaca_7292b4cd8e6a -->|calls| df831a92_239f_6192_640e_8a708e1ffa88
  style df831a92_239f_6192_640e_8a708e1ffa88 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java lines 880–906

        private static int translateToError(Throwable cause) {
            if (cause instanceof CertificateRevokedException) {
                return CertificateVerifier.X509_V_ERR_CERT_REVOKED;
            }

            // The X509TrustManagerImpl uses a Validator which wraps a CertPathValidatorException into
            // an CertificateException. So we need to handle the wrapped CertPathValidatorException to be
            // able to send the correct alert.
            Throwable wrapped = cause.getCause();
            while (wrapped != null) {
                if (wrapped instanceof CertPathValidatorException) {
                    CertPathValidatorException ex = (CertPathValidatorException) wrapped;
                    CertPathValidatorException.Reason reason = ex.getReason();
                    if (reason == CertPathValidatorException.BasicReason.EXPIRED) {
                        return CertificateVerifier.X509_V_ERR_CERT_HAS_EXPIRED;
                    }
                    if (reason == CertPathValidatorException.BasicReason.NOT_YET_VALID) {
                        return CertificateVerifier.X509_V_ERR_CERT_NOT_YET_VALID;
                    }
                    if (reason == CertPathValidatorException.BasicReason.REVOKED) {
                        return CertificateVerifier.X509_V_ERR_CERT_REVOKED;
                    }
                }
                wrapped = wrapped.getCause();
            }
            return CertificateVerifier.X509_V_ERR_UNSPECIFIED;
        }

Domain

Subdomains

Called By

Frequently Asked Questions

What does translateToError() do?
translateToError() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java.
Where is translateToError() defined?
translateToError() is defined in handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java at line 880.
What calls translateToError()?
translateToError() is called by 1 function(s): verify.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free