/** * Gets first exception of given class from {@code 'cause'} hierarchy if any. * * @param cls Cause class to get cause (if {@code null}, {@code null} is returned). * @return First causing exception of passed in class, {@code null} otherwise. */ @Nullable public <T extends Throwable> T getCause(@Nullable Class<T> cls) { return X.cause(this, cls); }
/** * Gets first exception of given class from {@code 'cause'} hierarchy if any. * * @param cls Cause class to get cause (if {@code null}, {@code null} is returned). * @return First causing exception of passed in class, {@code null} otherwise. */ @Nullable public <T extends Throwable> T getCause(@Nullable Class<T> cls) { return X.cause(this, cls); }
/** * Gets first exception of given class from {@code 'cause'} hierarchy if any. * * @param cls Cause class to get cause (if {@code null}, {@code null} is returned). * @return First causing exception of passed in class, {@code null} otherwise. */ @Nullable public <T extends Throwable> T getCause(@Nullable Class<T> cls) { return X.cause(this, cls); }
/** * Gets first cause if passed in {@code 'Throwable'} has given class in {@code 'cause'} hierarchy. * <p> * Note that this method follows includes {@link Throwable#getSuppressed()} * into check. * * @param t Throwable to check (if {@code null}, {@code null} is returned). * @param cls Cause class to get cause (if {@code null}, {@code null} is returned). * @return First causing exception of passed in class, {@code null} otherwise. */ @SuppressWarnings({"unchecked"}) @Nullable public static <T extends Throwable> T cause(@Nullable Throwable t, @Nullable Class<T> cls) { if (t == null || cls == null) return null; for (Throwable th = t; th != null; th = th.getCause()) { if (cls.isAssignableFrom(th.getClass())) return (T)th; for (Throwable n : th.getSuppressed()) { T found = cause(n, cls); if (found != null) return found; } if (th.getCause() == th) break; } return null; }
"(make sure same versions of all classes are available on all nodes) " + "[rmtAddr=" + sock.getRemoteSocketAddress() + ", err=" + X.cause(e, ClassNotFoundException.class).getMessage() + ']'); "(make sure same versions of all classes are available on all nodes) " + "[rmtNodeId=" + nodeId + ", err=" + X.cause(e, ClassNotFoundException.class).getMessage() + ']');
IOException ioe = X.cause(e, IOException.class);
GridGgfsOutOfSpaceException space = X.cause(e, GridGgfsOutOfSpaceException.class);
GridGgfsOutOfSpaceException space = X.cause(e, GridGgfsOutOfSpaceException.class);
"do not support peer class loading, if you deploy distributed service " + "you should have all required classes in CLASSPATH on all nodes in topology) " + "[senderId=" + nodeId + ", err=" + X.cause(e, ClassNotFoundException.class).getMessage() + ']'); else U.error(log, "Failed to process message [senderId=" + nodeId + ']', e);
GridSpiVersionCheckException verCheckErr = X.cause(e, GridSpiVersionCheckException.class);