code: static StackTraceElement[] getStackTrace(final Thread t)
     {
        if (System.getSecurityManager() == null)
           return t.getStackTrace();
  
        return AccessController.doPrivileged(new PrivilegedAction<StackTraceElement[]>() 
        {
           public StackTraceElement[] run()
           {
              return t.getStackTrace();
           }
        });
     }
docs: Get stack trace
  @param t The thread
  @return The trace