Android examples for java.lang:Throwable
get Sign Error Message By Stack Trace
import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.math.BigDecimal; import java.math.BigInteger; import java.net.MalformedURLException; import java.net.URL; import java.text.ParseException; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.StringTokenizer; public class Main{ public static void getSignErrorMessageByStackTrace(PrintWriter pw, Throwable err) {/* ww w.j av a2s .com*/ Throwable ourCause = err.getCause(); if (ourCause != null) { String errMsg = ourCause.getMessage(); if (!textUnit.StringIsEmpty(errMsg)) { pw.print(errMsg); pw.print("\n"); return; } getErrorMessageByStackTrace(pw, ourCause); } } public static void getErrorMessageByStackTrace(PrintWriter pw, Throwable err) { err.printStackTrace(pw); } }