Java examples for java.lang:Exception
Takes stacktrace string out of exception.
// Copyright (c) 2011 The Chromium Authors. All rights reserved. //package com.java2s; import java.io.PrintWriter; import java.io.StringWriter; public class Main { /**//from w w w.j a v a 2s.co m * Takes stacktrace string out of exception. */ public static String getStacktraceString(Exception exception) { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); exception.printStackTrace(printWriter); printWriter.close(); return stringWriter.toString(); } }