Here you can find the source of stackTraceToHTMLString(Throwable t)
public static String stackTraceToHTMLString(Throwable t)
//package com.java2s; //License from project: LGPL import java.io.PrintWriter; import java.io.StringWriter; public class Main { public static String stackTraceToHTMLString(Throwable t) { return stackTraceToHTMLString(t, " ", "<br>"); }/*from w w w . j av a2 s. com*/ public static String stackTraceToHTMLString(Throwable t, String tab, String newLine) { String text = stackTraceToString(t); if (text == null) { return null; } else { return text.replace("\n", newLine).replace("\t", tab); } } public static String stackTraceToString(Throwable t) { if (t != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); return sw.toString(); } else { return null; } } }