From 8620f68d1d5f60b97b961f8e1691bd33e3ce0c5b Mon Sep 17 00:00:00 2001 From: gregor Date: Thu, 1 Jul 2004 13:20:12 +0000 Subject: =?UTF-8?q?Methode=20getStackTraceAsString=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@148 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/StreamUtils.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/src/at/gv/egovernment/moa/util/StreamUtils.java b/common/src/at/gv/egovernment/moa/util/StreamUtils.java index 88db24504..a22f1c2a8 100644 --- a/common/src/at/gv/egovernment/moa/util/StreamUtils.java +++ b/common/src/at/gv/egovernment/moa/util/StreamUtils.java @@ -3,6 +3,7 @@ package at.gv.egovernment.moa.util; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.PrintStream; /** * Utility methods for streams. @@ -112,5 +113,16 @@ public class StreamUtils { in.close(); return out.toString(encoding); } - + + /** + * Gets the stack trace of the Throwable passed in as a string. + * @param t The Throwable. + * @return a String representing the stack trace of the Throwable. + */ + public static String getStackTraceAsString(Throwable t) + { + ByteArrayOutputStream stackTraceBIS = new ByteArrayOutputStream(); + t.printStackTrace(new PrintStream(stackTraceBIS)); + return new String(stackTraceBIS.toByteArray()); + } } -- cgit v1.2.3