判断指定异常是否来自或者包含指定异常

@param throwable 异常
@param exceptionClass 定义的引起异常的类
@param checkCause 判断cause
@return true 来自或者包含
@since 4.4.1
9333
public static boolean isFromOrSuppressedThrowable(Throwable throwable, Class<? extends Throwable> exceptionClass, boolean checkCause) {
		return convertFromOrSuppressedThrowable(throwable, exceptionClass, checkCause) != null;
	}
698671
@Override
    public void exceptionCaught(NextFilter nextFilter, IoSession session,
            Throwable cause) throws Exception {
        ProxyIoSession proxyIoSession = (ProxyIoSession) session
                .getAttribute(ProxyIoSession.PROXY_SESSION);
        proxyIoSession.setAuthenticationFailed(true);
        super.exceptionCaught(nextFilter, session, cause);
    }
572262
public static Throwable getUltimateCause(final Throwable throwable) {
    if (throwable.getCause() == null) {
      return throwable;
    } else {
      return getUltimateCause(throwable.getCause());
    }
  }
244082
public static <T> void exceptionListener(CompletableFuture<T> completableFuture, Consumer<Throwable> exceptionListener) {
        completableFuture.whenComplete((r, ex) -> {
            if (ex != null) {
                Callbacks.invokeSafely(exceptionListener, ex, null);
            }
        });
    }
1369284
@Override
  public void onException(Throwable failureCause) {
    Preconditions.checkNotNull(failureCause, "failureCause");
    Status status = Status.UNAVAILABLE.withCause(failureCause);
    startGoAway(0, ErrorCode.INTERNAL_ERROR, status);
  }
270549
public org.glassfish.jersey.server.monitoring.RequestEvent.ExceptionCause getExceptionCause() {
        return event.getExceptionCause();
    }
551914
private boolean isMonitorAccessibleFromClassLoader(ClassLoader loader) {
        if (loader == null) {
            return false;
        }
        boolean isMonitorAccessible = true;
        InputStream monitorInputStream = null;
        try {
            monitorInputStream = loader.getResourceAsStream(COVERAGE_MONITOR_RESOURCE);
            if (monitorInputStream == null) {
                isMonitorAccessible = false;
            }
        } catch (Exception ex1) {
            isMonitorAccessible = false;
            try {
                if (monitorInputStream != null) {
                    monitorInputStream.close();
                }
            } catch (IOException ex2) {
                // do nothing
            }
        }
        return isMonitorAccessible;
    }
35832
@Override
    public void visitClass(ClassDescriptor classDescriptor) throws CheckedAnalysisException {
        IAnalysisCache analysisCache = Global.getAnalysisCache();

        JavaClass jclass = analysisCache.getClassAnalysis(JavaClass.class, classDescriptor);
        classContext = analysisCache.getClassAnalysis(ClassContext.class, classDescriptor);

        for (Method m : classContext.getMethodsInCallOrder()) {
            if (m.getCode() == null) {
                continue;
            }
            method = m;

            MethodDescriptor methodDescriptor = BCELUtil.getMethodDescriptor(jclass, method);

            // Try to get MethodGen. If we can't get one,
            // then this method should be skipped.
            MethodGen methodGen = analysisCache.getMethodAnalysis(MethodGen.class, methodDescriptor);
            if (methodGen == null) {
                continue;
            }

            CFG cfg = analysisCache.getMethodAnalysis(CFG.class, methodDescriptor);
            visitMethodCFG(methodDescriptor, cfg);
        }
    }
1268012
public static boolean isCausedBy(final Throwable t, final Class<? extends Throwable>... causeTypes) {
		for (Class<? extends Throwable> type : causeTypes) {
			if (ExceptionUtils.indexOfType(t, type) >= 0) {
				return true;
			}
		}
		return false;
	}
1341333
private RuntimeException launderException(final Throwable throwable) {
        if (throwable instanceof RuntimeException) {
            return (RuntimeException) throwable;
        } else if (throwable instanceof Error) {
            throw (Error) throwable;
        } else {
            throw new IllegalStateException("Unchecked exception", throwable);
        }
    }
1286615
@Override
    public boolean canRetry(Throwable exception) {
        if (exception == null) {
            return false;
        }

        Class<? extends Throwable> exceptionClass = exception.getClass();
        if (hasIncludes && !includes.contains(exceptionClass)) {
            return false;
        } else if (hasExcludes && excludes.contains(exceptionClass)) {
            return false;
        } else {
            return this.attemptNumber.incrementAndGet() < (maxAttempts + 1) && ((maxDelay == null) || overallDelay.get() < maxDelay.toMillis());
        }
    }
852439
@SuppressWarnings("unchecked")
    public <E extends Throwable> ExceptionHandler<? super E>
    removeExceptionHandler(Class<E> type) {
        exceptionHandlerCache.clear();
        return (ExceptionHandler<? super E>) exceptionHandlers.remove(type);
    }
1351802
public static <T extends Throwable> T convertFromOrSuppressedThrowable(Throwable throwable, Class<T> exceptionClass) {
		return convertFromOrSuppressedThrowable(throwable, exceptionClass, true);
	}
1213886
public static RuntimeException initCause(RuntimeException ex,
                                             Throwable cause)
    {
        if (Throwable_initCause != null) {
            Object[] args = { cause };
            try {
                Throwable_initCause.invoke(ex, args);
            } catch (Exception e) {
                // Ignore any exceptions
            }
        }
        return ex;
    }
869160
@SuppressWarnings("rawtypes")
	public static Class loadClass(Class loadClass, String name,
								  boolean checkParents) throws ClassNotFoundException {
		ClassNotFoundException ex = null;
		Class<?> c = null;
		ClassLoader loader = Thread.currentThread().getContextClassLoader();
		while (c == null && loader != null) {
			try {
				c = loader.loadClass(name);
			} catch (ClassNotFoundException e) {
				if (ex == null) {
					ex = e;
				}
			}
			loader = (c == null && checkParents) ? loader.getParent() : null;
		}

		loader = loadClass == null ? null : loadClass.getClassLoader();
		while (c == null && loader != null) {
			try {
				c = loader.loadClass(name);
			} catch (ClassNotFoundException e) {
				if (ex == null) {
					ex = e;
				}
			}
			loader = (c == null && checkParents) ? loader.getParent() : null;
		}

		if (c == null) {
			try {
				c = Class.forName(name);
			} catch (ClassNotFoundException e) {
				if (ex == null) {
					ex = e;
				}
			}
		}

		if (c != null) {
			return c;
		}
		throw ex;
	}
1110417
public static Throwable findExceptionCause( Throwable e )
  {
    Throwable error = e;
    Throwable cause = e;
    while( (error.getCause() != null) && (error.getCause() != error) )
    {
      cause = error.getCause();
      error = cause;
    }
    return cause;
  }
1151962
public static void throwIfUnchecked(Throwable t) {
    Preconditions.checkNotNull(t);
    if (t instanceof RuntimeException) {
      throw (RuntimeException) t;
    }
    if (t instanceof Error) {
      throw (Error) t;
    }
  }