When I read the source code of mybatis,I find ExceptionUtil strange,I don't understand why he added the while loop to the unwrapThrowable method,

public class ExceptionUtil { private ExceptionUtil() { }

public static Throwable unwrapThrowable(Throwable wrapped) { Throwable unwrapped = wrapped; while (true) { if (unwrapped instanceof InvocationTargetException) { unwrapped = ((InvocationTargetException) unwrapped).getTargetException(); } else if (unwrapped instanceof UndeclaredThrowableException) { unwrapped = ((UndeclaredThrowableException) unwrapped).getUndeclaredThrowable(); } else { return unwrapped; } } }

}

Comment From: harawata

The loop is to extract deeply wrapped exception. We use GitHub Issues only to track bugs and feature requests. Please post your question to the mailing list or Stack Overflow. Thank you!