@Test public void testExceptionStripping() { final FlinkException expectedException = new FlinkException("test exception"); final Throwable strippedException = ExceptionUtils.stripException(new RuntimeException(new RuntimeException(expectedException)), RuntimeException.class); assertThat(strippedException, is(equalTo(expectedException))); }
public static Throwable stripException(Throwable throwableToStrip, Class<? extends Throwable> typeToStrip) { while (typeToStrip.isAssignableFrom(throwableToStrip.getClass()) && throwableToStrip.getCause() != null) { throwableToStrip = throwableToStrip.getCause(); } return throwableToStrip; }
ExceptionUtils { public static Throwable stripException(Throwable throwableToStrip, Class<? extends Throwable> typeToStrip) { while (typeToStrip.isAssignableFrom(throwableToStrip.getClass()) && throwableToStrip.getCause() != null) { throwableToStrip = throwableToStrip.getCause(); } return throwableToStrip; } }
ExceptionUtils { public static Throwable stripException(Throwable throwableToStrip, Class<? extends Throwable> typeToStrip) { while (typeToStrip.isAssignableFrom(throwableToStrip.getClass()) && throwableToStrip.getCause() != null) { throwableToStrip = throwableToStrip.getCause(); } return throwableToStrip; } private  ExceptionUtils(); }
ExceptionUtils { public static Throwable stripException(Throwable throwableToStrip, Class<? extends Throwable> typeToStrip) { while (typeToStrip.isAssignableFrom(throwableToStrip.getClass()) && throwableToStrip.getCause() != null) { throwableToStrip = throwableToStrip.getCause(); } return throwableToStrip; } private  ExceptionUtils(); static String stringifyException(final Throwable e); static boolean isJvmFatalError(Throwable t); static boolean isJvmFatalOrOutOfMemoryError(Throwable t); static void rethrowIfFatalError(Throwable t); static void rethrowIfFatalErrorOrOOM(Throwable t); static T firstOrSuppressed(T newException, @Nullable T previous); static void rethrow(Throwable t); static void rethrow(Throwable t, String parentMessage); static void rethrowException(Throwable t, String parentMessage); static void rethrowException(Throwable t); static void tryRethrowException(@Nullable Exception e); static void tryRethrowIOException(Throwable t); static void rethrowIOException(Throwable t); static Optional<T> findThrowable(Throwable throwable, Class<T> searchType); static Optional<Throwable> findThrowable(Throwable throwable, Predicate<Throwable> predicate); static Optional<Throwable> findThrowableWithMessage(Throwable throwable, String searchMessage); static Throwable stripExecutionException(Throwable throwable); static Throwable stripCompletionException(Throwable throwable); static Throwable stripException(Throwable throwableToStrip, Class<? extends Throwable> typeToStrip); static void tryDeserializeAndThrow(Throwable throwable, ClassLoader classLoader); static void checkInterrupted(Throwable e); static void suppressExceptions(RunnableWithException action); }
ExceptionUtils { public static Throwable stripException(Throwable throwableToStrip, Class<? extends Throwable> typeToStrip) { while (typeToStrip.isAssignableFrom(throwableToStrip.getClass()) && throwableToStrip.getCause() != null) { throwableToStrip = throwableToStrip.getCause(); } return throwableToStrip; } private  ExceptionUtils(); static String stringifyException(final Throwable e); static boolean isJvmFatalError(Throwable t); static boolean isJvmFatalOrOutOfMemoryError(Throwable t); static void rethrowIfFatalError(Throwable t); static void rethrowIfFatalErrorOrOOM(Throwable t); static T firstOrSuppressed(T newException, @Nullable T previous); static void rethrow(Throwable t); static void rethrow(Throwable t, String parentMessage); static void rethrowException(Throwable t, String parentMessage); static void rethrowException(Throwable t); static void tryRethrowException(@Nullable Exception e); static void tryRethrowIOException(Throwable t); static void rethrowIOException(Throwable t); static Optional<T> findThrowable(Throwable throwable, Class<T> searchType); static Optional<Throwable> findThrowable(Throwable throwable, Predicate<Throwable> predicate); static Optional<Throwable> findThrowableWithMessage(Throwable throwable, String searchMessage); static Throwable stripExecutionException(Throwable throwable); static Throwable stripCompletionException(Throwable throwable); static Throwable stripException(Throwable throwableToStrip, Class<? extends Throwable> typeToStrip); static void tryDeserializeAndThrow(Throwable throwable, ClassLoader classLoader); static void checkInterrupted(Throwable e); static void suppressExceptions(RunnableWithException action); static final String STRINGIFIED_NULL_EXCEPTION; }