code: public static String getFirstMessage(Throwable t) {
          if (t == null) {
              return null;
          }
  
          String ret = t.getMessage();
          Throwable cause = t;
          while (cause.getCause() != null) {
              cause = cause.getCause();
              if (cause.getMessage() != null) {
                  ret = cause.getMessage();
              }
          }
          return ret;
      }
docs: Returns the first message available in a stack trace.
  <p>
  This method can be used to obtain the first occurrence of
  {@link Exception#getMessage() the exception message} through a series of
  {@link Exception#getCause() causes}.
  </p>
  
  @param t the {@link Throwable throwable}
  @return {@link String}; may be null