Bug 60822

Summary: ResultCollector does not ensure unique file name entries in files HashMap
Product: JMeter - Now in Github Reporter: Sebb <sebb>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.1   
Attachments: Test showing problem
output XML file showing mixed output
Test showing problem for CSV
output CSV file showing truncated output

Description Sebb 2017-03-05 19:52:10 UTC
ResultCollector tries to ensure that multiple references to the same file in a Test Plan only generate a single Writer.

However, it does not canonicalise the file names, so the same physical file may be written by two Writers.

For example, test.jtl and ./test.jtl will result in separate entries in the files HashMap. This could be fixed by using File.getCanonicalPath()

Also test.jtl and Test.jtl currently generate separate entries even on case-insensitive file systems. 

There does not seem to be a way to detect file system case-sensitivity in Java.

Path.toRealPath() produces unique names for case-insenstive systems but only works for existing files, so would require the file to be exist first. That might be acceptable here, because the purpose of the ResultCollector is to write the file. File.toCanonicalPath() does not take account of case sensitivity.

It looks as though File.getCanonicalPath() returns the file name with its actual case if the file exists.

Note that case-sensitivity is a property of the file system, not the OS, so the same host could potentially have multiple file systems with different case-sensitivity
Comment 1 Sebb 2017-03-06 15:13:52 UTC
Created attachment 34801 [details]
Test showing problem
Comment 2 Sebb 2017-03-06 15:15:11 UTC
Created attachment 34802 [details]
output XML file showing mixed output
Comment 3 Sebb 2017-03-06 15:23:41 UTC
Created attachment 34803 [details]
Test showing problem for CSV
Comment 4 Sebb 2017-03-06 15:24:19 UTC
Created attachment 34804 [details]
output CSV file showing truncated output
Comment 5 Sebb 2017-03-08 15:44:27 UTC
Note: as it happens the first call to initializeFileOutput() creates the file if it does not exist, so File.getCanonicalPath() is sufficient to ensure uniqueness.

Also added some debug logging to show when file is created/initialised.

URL: http://svn.apache.org/viewvc?rev=1785990&view=rev
Log:
ResultCollector does not ensure unique file name entries in files HashMap
Bugzilla Id: 60822

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultCollector.java
    jmeter/trunk/xdocs/changes.xml
Comment 6 The ASF infrastructure team 2022-09-24 20:38:08 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4320