// Copyright 2011 Google Inc. All Rights Reserved.

package org.cachebench;

import static com.google.common.base.Strings.emptyToNull;

import org.cachebench.reportgenerators.CsvStatisticReportGenerator;

import java.io.File;

/**
 * An extension of the report generator to simplify the file name.
 *
 * @author bmanes@google.com (Ben Manes)
 */
public final class CustomCsvStatisticReportGenerator extends CsvStatisticReportGenerator {

  @Override public void setOutputFile(String fileName) {
    if ("-generic-".equals(fileName)) {
      String type = System.getProperty("cacheBenchFwk.cache.type");
      String run = emptyToNull(System.getProperty("cacheBenchFwk.cache.run"));
      this.output = new File(type + (run == null ? "" : "-" + run) + ".csv");
    } else {
      super.setOutputFile(fileName);
    }
  }
}

// Copyright 2011 Google Inc. All Rights Reserved.

package org.cachebench;

import org.cachebench.reportgenerators.CsvStatisticReportGenerator;

import java.io.File;

/**
 * An extension of the report generator to simplify the file name.
 *
 * @author bmanes@google.com (Ben Manes)
 */
public final class CustomCsvStatisticReportGenerator extends CsvStatisticReportGenerator {

  @Override public void setOutputFile(String fileName) {
    if ("-generic-".equals(fileName)) {
      String type = System.getProperty("cacheBenchFwk.cache.type");
      String run = System.getProperty("cacheBenchFwk.cache.run");
      this.output = new File(type + (run == null ? "" : "-" + run) + ".csv");
    } else {
      super.setOutputFile(fileName);
    }
  }
}

--- 
+++ 
@@ -1,6 +1,8 @@
 // Copyright 2011 Google Inc. All Rights Reserved.
 
 package org.cachebench;
+
+import static com.google.common.base.Strings.emptyToNull;
 
 import org.cachebench.reportgenerators.CsvStatisticReportGenerator;
 
@@ -16,7 +18,7 @@
   @Override public void setOutputFile(String fileName) {
     if ("-generic-".equals(fileName)) {
       String type = System.getProperty("cacheBenchFwk.cache.type");
-      String run = System.getProperty("cacheBenchFwk.cache.run");
+      String run = emptyToNull(System.getProperty("cacheBenchFwk.cache.run"));
       this.output = new File(type + (run == null ? "" : "-" + run) + ".csv");
     } else {
       super.setOutputFile(fileName);
Fix to remove '-' when no run specified


git-svn-id: 907e4e34b61c8b36c3c46852ca75613c7936718f@672 52670e78-85c4-11dd-9ffd-cdf95c2cae98
