Here you can find the source of getExceptionMessage(Exception ex)
public static String getExceptionMessage(Exception ex)
//package com.java2s; //License from project: Open Source License import java.io.PrintWriter; import java.io.StringWriter; public class Main { public static String getExceptionMessage(Exception ex) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw);/*from ww w .ja v a2 s .c o m*/ return sw.toString(); } }