Here you can find the source of formatThrowableForHtml(Throwable t)
Parameter | Description |
---|---|
t | a parameter |
public static String formatThrowableForHtml(Throwable t)
//package com.java2s; //License from project: Apache License import java.io.PrintWriter; import java.io.StringWriter; public class Main { /**/*w ww . j av a 2s . c o m*/ * * @param t * @return */ public static String formatThrowableForHtml(Throwable t) { String ex = formatThrowable(t); return ex.replaceAll("\n\t", " "); } public static String formatThrowable(Throwable t) { if (t == null) return ""; StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); pw.flush(); sw.flush(); return sw.toString(); } }