Make LogUtils.getTrace actually work

Change-Id: I59e2b93ed1142bac22ead08cc101e27cfa3e02df
This commit is contained in:
Stephan Bergmann
2015-02-16 11:26:45 +01:00
parent 56e0afabba
commit f1f6edaae1

View File

@@ -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();
}
}
}