changeset 461:adb938a4aaca

ResultFormats should not generate empty result file if not activated.
author shade
date Mon, 03 Mar 2014 21:21:26 +0400
parents 75e8e2c3b31f
children 52319f9ba066
files jmh-core/src/main/java/org/openjdk/jmh/output/results/ResultFormatFactory.java
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/results/ResultFormatFactory.java	Mon Mar 03 19:50:42 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/results/ResultFormatFactory.java	Mon Mar 03 21:21:26 2014 +0400
@@ -44,6 +44,9 @@
      * @return result format
      */
     public static ResultFormat getInstance(final ResultFormatType type, final String file) {
+        if (type == ResultFormatType.NONE) {
+            return new NoneResultFormat();
+        }
         return new ResultFormat() {
             @Override
             public void writeOut(Map<BenchmarkRecord, RunResult> results) {
@@ -71,7 +74,7 @@
     public static ResultFormat getInstance(ResultFormatType type, PrintWriter writer) {
         switch (type) {
             case NONE:
-                return new NoneResultFormat();
+                throw new IllegalStateException(ResultFormatType.NONE + " should be handled already");
             case CSV:
                 /*
                  * CSV formatter follows the provisions of http://tools.ietf.org/html/rfc4180