Here you can find the source of getExceptionMessage(Exception e)
Parameter | Description |
---|---|
e | Exception e |
public static String getExceptionMessage(Exception e)
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; public class Main { /**//from w w w. jav a2 s. co m * Retrieve exception stack message * * @param e * Exception e * @return excpetion message */ public static String getExceptionMessage(Exception e) { final StringBuilder sb = new StringBuilder(); e.printStackTrace(new PrintStream(new OutputStream() { @Override public void write(int b) throws IOException { sb.append((char) b); } })); return sb.toString(); } }