Here you can find the source of formatMessage(Exception e)
public static String formatMessage(Exception e)
//package com.java2s; //The contents of this file are subject to the "Simplified BSD License" (the "License"); public class Main { public static String formatMessage(Exception e) { String msg = e.getMessage(); Throwable cause = e.getCause(); if (cause != null) msg = msg + "\nCause: " + cause.getMessage(); return msg; }// w ww . jav a2 s.c om }