summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-02-16 11:26:45 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-02-16 11:27:14 +0100
commitf1f6edaae13c9591e391d52856c31c6cdc303f3e (patch)
tree0b74edae6d3ccd64eb2bec0d9435d17e130dabd9
parent56e0afabbadf0c4cd2a83df34fe69efc874dd6a2 (diff)
Make LogUtils.getTrace actually work
Change-Id: I59e2b93ed1142bac22ead08cc101e27cfa3e02df
-rw-r--r--scripting/java/com/sun/star/script/framework/log/LogUtils.java31
1 files changed, 6 insertions, 25 deletions
diff --git a/scripting/java/com/sun/star/script/framework/log/LogUtils.java b/scripting/java/com/sun/star/script/framework/log/LogUtils.java
index 183f94a65b48..cd42b9d1e901 100644
--- a/scripting/java/com/sun/star/script/framework/log/LogUtils.java
+++ b/scripting/java/com/sun/star/script/framework/log/LogUtils.java
@@ -18,8 +18,8 @@
package com.sun.star.script.framework.log;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
+import java.io.StringWriter;
+import java.io.PrintWriter;
public class LogUtils {
@@ -50,27 +50,8 @@ public class LogUtils {
}
public static String getTrace(Exception e) {
- ByteArrayOutputStream baos = null;
- PrintStream ps = null;
- String result = "";
-
- try {
- baos = new ByteArrayOutputStream();
- ps = new PrintStream(baos);
- e.printStackTrace(ps);
- } finally {
- try {
- if (baos != null) {
- baos.close();
- }
-
- if (ps != null) {
- ps.close();
- }
- } catch (Exception excp) {
- }
- }
-
- return result;
+ StringWriter w = new StringWriter();
+ e.printStackTrace(new PrintWriter(w));
+ return w.toString();
}
-} \ No newline at end of file
+}