Bug 60125

Summary: Report / Dashboard : Dashboard cannot be generated if the default delimiter is \t
Product: JMeter Reporter: Tamas Szabadi <tamas>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal CC: p.mouawad, ra0077
Priority: P2    
Version: 3.0   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Add special handling for TAB and SPACE

Description Tamas Szabadi 2016-09-13 09:32:31 UTC
If the delimiter is set up for tab, the dashboard cannot be generated.

Steps to reproduce:

1. Use the following property for setting up the tab in the user.properties:

jmeter.save.saveservice.default_delimiter=\t

2. Try to run and generate the dashboard. 

Expected result:

Report dashboard should be generated.

Actual result:

The following error appears:

Writing log file to: d:\apache-jmeter-3.0\bin\jmeter.log
Creating summariser <summary>
An error occurred: null
errorlevel=1
Press any key to continue . . .

In the jmeter.log the following exception happens:

2016/09/13 02:27:48 INFO  - jmeter.JMeter: Creating summariser <summary> 
2016/09/13 02:27:48 FATAL - jmeter.JMeter: An error occurred:  java.lang.ExceptionInInitializerError
	at org.apache.jmeter.JMeter.runNonGui(JMeter.java:922)
	at org.apache.jmeter.JMeter.startNonGui(JMeter.java:876)
	at org.apache.jmeter.JMeter.start(JMeter.java:501)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.jmeter.NewDriver.main(NewDriver.java:259)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.lang.String.charAt(String.java:658)
	at org.apache.jmeter.report.dashboard.ReportGenerator.<clinit>(ReportGenerator.java:80)
	... 8 more
 
It seems that when in the ReportGenerator.java file the property is read like this:

private static final char CSV_DEFAULT_SEPARATOR =
            JMeterUtils.getPropDefault("jmeter.save.saveservice.default_delimiter", ",").charAt(0); //$NON-NLS-1$ //$NON-NLS-2$

And getPropDefault will trim the value before returning, so the tab will be trimmed down, and then charAt(0) will be called for an empty string.

Let me know if you need any more information.
Regards,
Tamas
Comment 1 Felix Schumacher 2016-09-15 18:21:27 UTC
Created attachment 34254 [details]
Add special handling for TAB and SPACE
Comment 2 Philippe Mouawad 2016-09-17 12:34:21 UTC
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