Here you can find the source of getExceptionMsg(Exception ex)
public static String getExceptionMsg(Exception ex)
//package com.java2s; //License from project: Apache License import java.io.PrintWriter; import java.io.StringWriter; public class Main { /**//from w w w .j a va 2 s .co m * Get Exception msg. * */ public static String getExceptionMsg(Exception ex) { StringBuilder sb = new StringBuilder(); if (ex != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw); sb.append(sw.toString()); } return sb.toString(); } }