Java Exception Format fmtError( Exception e )

Here you can find the source of fmtError( Exception e )

Description

fmt Error

License

Open Source License

Declaration

protected static String fmtError( Exception e ) 

Method Source Code


//package com.java2s;
import java.io.*;

public class Main {
    protected static String fmtError(Exception e) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        try {/*from   w w w . j ava 2  s.c  o  m*/
            e.printStackTrace(pw);
            pw.flush();
        } finally {
            pw.close();
        }
        sw.flush();
        return e.getMessage() + "\n" + sw.toString();
    }
}

Related

  1. formatException(final Exception e)
  2. formatException(Throwable ex)
  3. formatException(Throwable exception)
  4. formatException(Throwable th)