aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d>2004-07-01 13:20:12 +0000
committergregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d>2004-07-01 13:20:12 +0000
commit8620f68d1d5f60b97b961f8e1691bd33e3ce0c5b (patch)
tree7192ea2a8634fd74ab2567427b15561a1a9ee7f4
parent4dd1877ef3771633e096509dae7b8c99fee9ce4b (diff)
downloadmoa-id-spss-8620f68d1d5f60b97b961f8e1691bd33e3ce0c5b.tar.gz
moa-id-spss-8620f68d1d5f60b97b961f8e1691bd33e3ce0c5b.tar.bz2
moa-id-spss-8620f68d1d5f60b97b961f8e1691bd33e3ce0c5b.zip
Methode getStackTraceAsString hinzugefĆ¼gt
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@148 d688527b-c9ab-4aba-bd8d-4036d912da1d
-rw-r--r--common/src/at/gv/egovernment/moa/util/StreamUtils.java14
1 files changed, 13 insertions, 1 deletions
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 <code>Throwable</code> passed in as a string.
+ * @param t The <code>Throwable</code>.
+ * @return a String representing the stack trace of the <code>Throwable</code>.
+ */
+ public static String getStackTraceAsString(Throwable t)
+ {
+ ByteArrayOutputStream stackTraceBIS = new ByteArrayOutputStream();
+ t.printStackTrace(new PrintStream(stackTraceBIS));
+ return new String(stackTraceBIS.toByteArray());
+ }
}