Java examples for java.lang:Throwable
append Stack Trace
//package com.java2s; public class Main { private final static String NL = "\n"; private static void appendStackTrace(final StringBuilder sb, final Throwable t) { StackTraceElement[] list = t.getStackTrace(); if (list != null) { for (StackTraceElement ste : list) { sb.append("..").append(ste.toString()).append(NL); }/* ww w . j a v a 2 s .c om*/ } else { sb.append("..").append("<No stack Trace>").append(NL); } } }