Author: pmouawad
Date: Sat Sep 17 12:33:09 2016
New Revision: 1761205

URL: http://svn.apache.org/viewvc?rev=1761205&view=rev
Log:
Bug 60125 - Report / Dashboard : Dashboard cannot be generated if the default 
delimiter is \t
Bugzilla Id: 60125

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/report/core/CsvSampleReader.java
    
jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java
    
jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleSaveConfiguration.java
    jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java
    jmeter/trunk/xdocs/changes.xml

Modified: 
jmeter/trunk/src/core/org/apache/jmeter/report/core/CsvSampleReader.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/core/CsvSampleReader.java?rev=1761205&r1=1761204&r2=1761205&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/report/core/CsvSampleReader.java 
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/report/core/CsvSampleReader.java 
Sat Sep 17 12:33:09 2016
@@ -51,7 +51,9 @@ public class CsvSampleReader implements
     private static final String CHARSET = 
SaveService.getFileEncoding(StandardCharsets.UTF_8.displayName());
 
     private static final char DEFAULT_SEPARATOR =
-            
JMeterUtils.getPropDefault("jmeter.save.saveservice.default_delimiter", 
",").charAt(0); //$NON-NLS-1$ //$NON-NLS-2$
+            // We cannot use JMeterUtils#getPropDefault as it applies a trim 
on value
+            JMeterUtils.getDelimiter(
+                    
JMeterUtils.getJMeterProperties().getProperty(SampleSaveConfiguration.DEFAULT_DELIMITER_PROP,
 SampleSaveConfiguration.DEFAULT_DELIMITER)).charAt(0);
 
     private File file;
 

Modified: 
jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java?rev=1761205&r1=1761204&r2=1761205&view=diff
==============================================================================
--- 
jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java 
(original)
+++ 
jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java 
Sat Sep 17 12:33:09 2016
@@ -57,6 +57,7 @@ import org.apache.jmeter.report.processo
 import org.apache.jmeter.report.processor.ThresholdSelector;
 import org.apache.jmeter.report.processor.graph.AbstractGraphConsumer;
 import org.apache.jmeter.reporters.ResultCollector;
+import org.apache.jmeter.samplers.SampleSaveConfiguration;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
@@ -77,7 +78,9 @@ public class ReportGenerator {
                     "jmeter.save.saveservice.output_format", "csv"));
 
     private static final char CSV_DEFAULT_SEPARATOR =
-            
JMeterUtils.getPropDefault("jmeter.save.saveservice.default_delimiter", 
",").charAt(0); //$NON-NLS-1$ //$NON-NLS-2$
+            // We cannot use JMeterUtils#getPropDefault as it applies a trim 
on value
+            JMeterUtils.getDelimiter(
+                    
JMeterUtils.getJMeterProperties().getProperty(SampleSaveConfiguration.DEFAULT_DELIMITER_PROP,
 SampleSaveConfiguration.DEFAULT_DELIMITER)).charAt(0);
 
     private static final String INVALID_CLASS_FMT = "Class name \"%s\" is not 
valid.";
     private static final String INVALID_EXPORT_FMT = "Data exporter \"%s\" is 
unable to export data.";
@@ -206,9 +209,7 @@ public class ReportGenerator {
         // Build consumers chain
         SampleContext sampleContext = new SampleContext();
         sampleContext.setWorkingDirectory(tmpDir);
-        SampleSource source = new CsvFileSampleSource(testFile, JMeterUtils
-                .getPropDefault("jmeter.save.saveservice.default_delimiter",
-                        ",").charAt(0));
+        SampleSource source = new CsvFileSampleSource(testFile, 
CSV_DEFAULT_SEPARATOR);
         source.setSampleContext(sampleContext);
 
         NormalizerSampleConsumer normalizer = new NormalizerSampleConsumer();

Modified: 
jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleSaveConfiguration.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleSaveConfiguration.java?rev=1761205&r1=1761204&r2=1761205&view=diff
==============================================================================
--- 
jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleSaveConfiguration.java 
(original)
+++ 
jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleSaveConfiguration.java 
Sat Sep 17 12:33:09 2016
@@ -121,7 +121,7 @@ public class SampleSaveConfiguration imp
      * The name of the property indicating which delimiter should be used when
      * saving in a delimited values format.
      
**************************************************************************/
-    private static final String DEFAULT_DELIMITER_PROP = 
"jmeter.save.saveservice.default_delimiter"; // $NON_NLS-1$
+    public static final String DEFAULT_DELIMITER_PROP = 
"jmeter.save.saveservice.default_delimiter"; // $NON_NLS-1$
 
     
/***************************************************************************
      * The name of the property indicating which format should be used when
@@ -298,7 +298,7 @@ public class SampleSaveConfiguration imp
 
     private static final boolean _idleTime;
 
-    private static final String DEFAULT_DELIMITER = ","; // $NON_NLS-1$
+    public static final String DEFAULT_DELIMITER = ","; // $NON_NLS-1$
 
     /**
      * Read in the properties having to do with saving from a properties file.
@@ -315,14 +315,7 @@ public class SampleSaveConfiguration imp
         _requestHeaders  = 
TRUE.equalsIgnoreCase(props.getProperty(REQUESTHEADERS_PROP, FALSE));
         _encoding        = 
TRUE.equalsIgnoreCase(props.getProperty(ENCODING_PROP, FALSE));
 
-        String dlm = props.getProperty(DEFAULT_DELIMITER_PROP, 
DEFAULT_DELIMITER);
-        if (dlm.equals("\\t")) {// Make it easier to enter a tab (can use 
\<tab> but that is awkward)
-            dlm="\t";
-        }
-
-        if (dlm.length() != 1){
-            throw new JMeterError("Delimiter '"+dlm+"' must be of length 1.");
-        }
+        String dlm = 
JMeterUtils.getDelimiter(props.getProperty(DEFAULT_DELIMITER_PROP, 
DEFAULT_DELIMITER));
         char ch = dlm.charAt(0);
 
         if (CharUtils.isAsciiAlphanumeric(ch) || ch == 
CSVSaveService.QUOTING_CHAR){

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java?rev=1761205&r1=1761204&r2=1761205&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java Sat Sep 17 
12:33:09 2016
@@ -54,6 +54,7 @@ import org.apache.jmeter.gui.GuiPackage;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.jorphan.reflect.ClassFinder;
 import org.apache.jorphan.test.UnitTestManager;
+import org.apache.jorphan.util.JMeterError;
 import org.apache.jorphan.util.JOrphanUtils;
 import org.apache.log.Logger;
 import org.apache.oro.text.MalformedCachePatternException;
@@ -864,7 +865,7 @@ public class JMeterUtils implements Unit
      *            the name of the property.
      * @param defaultVal
      *            the default value.
-     * @return The PropDefault value
+     * @return The PropDefault value applying a trim on it
      */
     public static String getPropDefault(String propName, String defaultVal) {
         String ans = defaultVal;
@@ -1409,4 +1410,21 @@ public class JMeterUtils implements Unit
         }
     }
 
+    /**
+     * Return delimiterValue handling the TAB case
+     * @param delimiterValue Delimited value 
+     * @return String delimited modified to handle correctly tab
+     * @throws JMeterError if delimiterValue has a length different from 1
+     */
+    public static String getDelimiter(String delimiterValue) {
+        if (delimiterValue.equals("\\t")) {// Make it easier to enter a tab 
(can use \<tab> but that is awkward)
+            delimiterValue="\t";
+        }
+
+        if (delimiterValue.length() != 1){
+            throw new JMeterError("Delimiter '"+delimiterValue+"' must be of 
length 1.");
+        }
+        return delimiterValue;
+    }
+
 }

Modified: jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1761205&r1=1761204&r2=1761205&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Sep 17 12:33:09 2016
@@ -229,6 +229,7 @@ Summary
     <li><bug>60107</bug>Report / Dashboard : In StatisticSummary, 
TransactionController SampleResult makes Total line wrong</li>
     <li><bug>60110</bug>Report / Dashboard : In Response Time Percentiles, 
slider is useless</li>
     <li><bug>60135</bug>Report / Dashboard : Active Threads Over Time should 
be in OverTime section</li>
+    <li><bug>60125</bug>Report / Dashboard : Dashboard cannot be generated if 
the default delimiter is <code>\t</code>. Based on a report from Tamas Szabadi 
(tamas.szabadi at rightside.co)</li>
 </ul>
 
  <!--  =================== Thanks =================== -->
@@ -246,6 +247,7 @@ Summary
 <li>Benoit Wiart (b.wiart at ubik-ingenierie.com)</li>
 <li>Maxime Chassagneux (maxime.chassagneux at gmail.com)</li>
 <li><a href="http://ubikloadpack.com";>Ubik Load Pack</a></li>
+<li>Tamas Szabadi (tamas.szabadi at rightside.co)</li>
 </ul>
 <p>We also thank bug reporters who helped us improve JMeter. <br/>
 For this release we want to give special thanks to the following reporters for 
the clear reports and tests made after our fixes:</p>


Reply via email to