changeset 401:0280e5a5d571

Print benchmark exceptions into OutputFormat.
author shade
date Mon, 17 Feb 2014 22:51:19 +0400
parents b45d214529fc
children 0a7337dda90b
files jmh-core/src/main/java/org/openjdk/jmh/runner/BaseRunner.java
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseRunner.java	Sun Feb 16 18:33:50 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseRunner.java	Mon Feb 17 22:51:19 2014 +0400
@@ -36,6 +36,8 @@
 import org.openjdk.jmh.util.internal.Multimap;
 import org.openjdk.jmh.util.internal.TreeMultimap;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.lang.management.GarbageCollectorMXBean;
 import java.lang.management.ManagementFactory;
 import java.lang.reflect.Method;
@@ -100,7 +102,13 @@
             } catch (BenchmarkException be) {
                 out.println("<failure>");
                 out.println("");
-                be.getCause().printStackTrace();
+                StringWriter sw = new StringWriter();
+                {
+                    PrintWriter pw = new PrintWriter(sw, true);
+                    be.getCause().printStackTrace(pw);
+                    pw.close();
+                }
+                out.println(sw.toString());
                 out.println("");
 
                 if (options.shouldFailOnError().orElse(Defaults.FAIL_ON_ERROR)) {