code: private static Throwable findRootCause(Throwable t) {
          Throwable root = t;
          Throwable cause = root.getCause();
          while (cause != null) {
              root = cause;
              cause = root.getCause();
          }
          return root;
      }
docs: Find root cause of a specified Throwable object.
  
  @param t is the Throwable object.
  
  @return the root cause object.