code: public static Throwable getRootCause(Throwable t) {
          if (t == null) {
              return null;
          }
          while (t.getCause() != null) {
              t = t.getCause();
          }
          return t;
      }
docs: Method that can be used to find the "root cause", innermost
  of chained (wrapped) exceptions.
  
  @param t the Throwable to possibly propagate
  @return the root cause