Home / Function/ ignoreException() — netty Function Reference

ignoreException() — netty Function Reference

Architecture documentation for the ignoreException() function in SslHandler.java from the netty codebase.

Function java Buffer Allocators calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  fadbcb7a_9bc0_4aa0_11c8_f1988daaec89["ignoreException()"]
  d8b07a7c_44f8_c4e9_efe8_49bfae7d4af1["SslHandler"]
  fadbcb7a_9bc0_4aa0_11c8_f1988daaec89 -->|defined in| d8b07a7c_44f8_c4e9_efe8_49bfae7d4af1
  04c08bc3_3cb7_7c02_dac5_71e493257fd0["exceptionCaught()"]
  04c08bc3_3cb7_7c02_dac5_71e493257fd0 -->|calls| fadbcb7a_9bc0_4aa0_11c8_f1988daaec89
  c56f7c54_6ae8_4d6d_4ae0_c12f6d646c1f["isIgnorableClassInStack()"]
  fadbcb7a_9bc0_4aa0_11c8_f1988daaec89 -->|calls| c56f7c54_6ae8_4d6d_4ae0_c12f6d646c1f
  style fadbcb7a_9bc0_4aa0_11c8_f1988daaec89 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/SslHandler.java lines 1246–1301

    private boolean ignoreException(Throwable t) {
        if (!(t instanceof SSLException) && t instanceof IOException && sslClosePromise.isDone()) {
            String message = t.getMessage();

            // first try to match connection reset / broke peer based on the regex. This is the fastest way
            // but may fail on different jdk impls or OS's
            if (message != null && IGNORABLE_ERROR_MESSAGE.matcher(message).matches()) {
                return true;
            }

            // Inspect the StackTraceElements to see if it was a connection reset / broken pipe or not
            StackTraceElement[] elements = t.getStackTrace();
            for (StackTraceElement element: elements) {
                String classname = element.getClassName();
                String methodname = element.getMethodName();

                // skip all classes that belong to the io.netty package
                if (classname.startsWith("io.netty.")) {
                    continue;
                }

                // check if the method name is read if not skip it
                if (!"read".equals(methodname)) {
                    continue;
                }

                if (isIgnorableClassInStack(classname)) {
                    return true;
                }

                try {
                    // No match by now. Try to load the class via classloader and inspect it.
                    // This is mainly done as other JDK implementations may differ in name of
                    // the impl.
                    Class<?> clazz = PlatformDependent.getClassLoader(getClass()).loadClass(classname);

                    if (SocketChannel.class.isAssignableFrom(clazz)
                            || DatagramChannel.class.isAssignableFrom(clazz)) {
                        return true;
                    }

                    // also match against SctpChannel via String matching as it may not present.
                    if ("com.sun.nio.sctp.SctpChannel".equals(clazz.getSuperclass().getName())) {
                        return true;
                    }
                } catch (Throwable cause) {
                    if (logger.isDebugEnabled()) {
                        logger.debug("Unexpected exception while loading class {} classname {}",
                                getClass(), classname, cause);
                    }
                }
            }
        }

        return false;
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does ignoreException() do?
ignoreException() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/SslHandler.java.
Where is ignoreException() defined?
ignoreException() is defined in handler/src/main/java/io/netty/handler/ssl/SslHandler.java at line 1246.
What does ignoreException() call?
ignoreException() calls 1 function(s): isIgnorableClassInStack.
What calls ignoreException()?
ignoreException() is called by 1 function(s): exceptionCaught.

Analyze Your Own Codebase

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

Try Supermodel Free