I just noticed that the line return !isChecked(throwable) Means that if throwable is null then it will be considered unchecked. I will fix that tomorrow by doing Return throwable ! null && throwable instanceof Exception;
On Mon, 3 Jul 2023, 01:20 Gary Gregory, <garydgreg...@gmail.com> wrote: > Hi Elliotte: > > Might you be looking at some old code in the PR? > > The current code is: > > /** > * Checks if a throwable represents a checked exception > * > * @param throwable > * The throwable to check. > * @return True if the given Throwable is a checked exception. > * @since 3.13.0 > */ > public static boolean isChecked(final Throwable throwable) { > return throwable != null && !(throwable instanceof Error) && > !(throwable instanceof RuntimeException); > } > > /** > * Checks if a throwable represents an unchecked exception > * > * @param throwable > * The throwable to check. > * @return True if the given Throwable is an unchecked exception. > * @since 3.13.0 > */ > public static boolean isUnchecked(final Throwable throwable) { > return !isChecked(throwable); > } > > Gary > > On Sun, Jul 2, 2023 at 8:01 PM Elliotte Rusty Harold <elh...@ibiblio.org> > wrote: > > > > On Sun, Jul 2, 2023 at 8:53 PM Alex Herbert <alex.d.herb...@gmail.com> > wrote: > > > > > public static boolean isUnchecked(final Throwable throwable) { > > > return (throwable instanceof Error) || (throwable instanceof > > > RuntimeException); > > > } > > > > Not quite. It's also possible for someone to define a subclass of > > Throwable directly that is neither an Exception nor an Error. > > > > > > -- > > Elliotte Rusty Harold > > elh...@ibiblio.org > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > > For additional commands, e-mail: dev-h...@commons.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > >