code: public static Throwable getOriginalCause(Throwable e) {
          if (e instanceof InvocationTargetException) {
              return getOriginalCause(((InvocationTargetException) e).getTargetException());
          }
          if (e.getCause() instanceof Throwable) {
              return getOriginalCause(e.getCause());
          }
          return e;
      }
docs: Retrieves original cause from a stack of exceptions bound together with {@link Throwable#getCause()} references.