All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.ibatis.reflection.ExceptionUtil Maven / Gradle / Ivy

There is a newer version: 3.0-beta-10
Show newest version
package org.apache.ibatis.reflection;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.UndeclaredThrowableException;

public class ExceptionUtil {

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy