Java Throwable to String getStackTrace(Throwable aThrowable)

Here you can find the source of getStackTrace(Throwable aThrowable)

Description

Gets the stack trace.

License

Open Source License

Parameter

Parameter Description
aThrowable The a throwable.

Return

The stack trace.

Declaration

public static String getStackTrace(Throwable aThrowable) 

Method Source Code


//package com.java2s;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;

public class Main {
    /**//from  w  w w .jav  a  2 s.  co  m
     * Gets the stack trace.
     * 
     * @param aThrowable
     *            The a throwable.
     * @return The stack trace.
     */
    public static String getStackTrace(Throwable aThrowable) {
        final Writer result = new StringWriter();
        final PrintWriter printWriter = new PrintWriter(result);
        aThrowable.printStackTrace(printWriter);
        return result.toString();
    }
}

Related

  1. getStackTrace(final Throwable t)
  2. getStackTrace(final Throwable t)
  3. getStackTrace(final Throwable t)
  4. getStackTrace(final Throwable t)
  5. getStackTrace(final Throwable throwable)
  6. getStackTrace(Throwable aThrowable)
  7. getStackTrace(Throwable e)
  8. getStackTrace(Throwable e)
  9. getStackTrace(Throwable e)