code: public static String getStackTrace(Throwable ex) {
          StringWriter buf = new StringWriter();
          ex.printStackTrace(new PrintWriter(buf));
  
          return buf.toString();
      }
docs: <p>getStackTrace.</p>
  
  @param ex a {@link java.lang.Throwable} object.
  @return a {@link java.lang.String} object.