public static String getMessage(final Throwable throwable) {
        if (StringUtils.isEmpty(throwable.getMessage())) {
            val message = ExceptionUtils.getThrowableList(throwable)
                .stream().map(Throwable::getMessage).filter(Objects::nonNull).findFirst();
            if (message.isPresent()) {
                return message.get();
            }
        }
        return StringUtils.defaultIfEmpty(throwable.getMessage(), throwable.getClass().getSimpleName());
    }
Get first non-null exception message, and return class name if all messages null.

@param throwable Top level throwable
@return String containing first non-null exception message, or Throwable simple class name
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/LoggingUtils.java