Java Dump Throwable dump(final Throwable throwable)

Here you can find the source of dump(final Throwable throwable)

Description

dump

License

Open Source License

Parameter

Parameter Description
throwable a parameter

Return

StackTrace of given throwable as a String

Declaration

public static final String dump(final Throwable throwable) 

Method Source Code


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

public class Main {
    /**/*from ww w . jav a  2  s . c  o  m*/
     * @param throwable
     * @return StackTrace of given throwable as a String
     */
    public static final String dump(final Throwable throwable) {
        if (throwable == null) {
            return "null";
        }
        final StringWriter sw = new StringWriter(512);
        throwable.printStackTrace(new PrintWriter(sw, true));
        return sw.toString();
    }
}

Related

  1. dumpThrowable(final String additionalDescr, final Throwable t)
  2. dumpThrowable(Throwable e)
  3. dumpThrowable(Throwable thr)