sashapolo commented on a change in pull request #176:
URL: https://github.com/apache/ignite-3/pull/176#discussion_r655288544



##########
File path: 
modules/raft/src/main/java/org/apache/ignite/raft/jraft/util/internal/ThrowUtil.java
##########
@@ -46,17 +38,50 @@ public static void throwException(final Throwable t) {
         throw (E) t;
     }
 
-    public static <T extends Throwable> T cutCause(final T cause) {
-        Throwable rootCause = cause;
-        while (rootCause.getCause() != null) {
-            rootCause = rootCause.getCause();
-        }
+    /**
+     * Checks if passed in {@code 'Throwable'} has given class in {@code 
'cause'} hierarchy
+     * <b>including</b> that throwable itself.
+     * <p>
+     * Note that this method follows includes {@link Throwable#getSuppressed()}
+     * into check.
+     *
+     * @param t Throwable to check (if {@code null}, {@code false} is 
returned).
+     * @param msg Message text that should be in cause.
+     * @param cls Cause classes to check (if {@code null} or empty, {@code 
false} is returned).
+     * @return {@code True} if one of the causing exception is an instance of 
passed in classes,
+     *      {@code false} otherwise.
+     */
+    @SafeVarargs
+    public static boolean hasCause(@Nullable Throwable t, @Nullable String 
msg, @Nullable Class<?>... cls) {

Review comment:
       If you want to indicate that `null` is a valid value for the whole 
array, you should write `Class<?> @Nullable... cls` instead




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to