Bug 54459 - CSVSaveService does not handle date parsing very well
Summary: CSVSaveService does not handle date parsing very well
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-22 00:42 UTC by Sebb
Modified: 2013-01-22 02:00 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebb 2013-01-22 00:42:49 UTC
CSVSaveService defaults to using 
  DEFAULT_DATE_FORMAT_STRING = "MM/dd/yy HH:mm:ss"
if the date does not parse as milliseconds.

This is not very helpful:
- it does not correspond with the suggested default in jmeter.properties, which is now yyyy/MM/dd HH:mm:ss.SSS
- the code does not check that the format actually works.

It would be a lot better if the format were at least checked to see if it worked before proceeding to use it.

Also it ought to be possible to compare the date field with some common formats and select one that works.

Likely input formats include:
yyyy/MM/dd HH:mm:ss[.SSS]
yyyy-MM-dd HH:mm:ss[.SSS]
yyyyMMdd HH:mm:ss[.SSS]

All the above should be easy to detect unambiguously.

However, if the file uses MM/dd/yy HH:mm:ss (US format) as per the current code, it won't in general be possible to distinguish it from dd/MM/yy HH:mm:ss (as used in Europe).

In this case, the format would need to be provided as a property.
Comment 1 Sebb 2013-01-22 01:09:40 UTC
(In reply to comment #0)

> - the code does not check that the format actually works.

Not strictly true: it does check that the format parses the timestamp.
However, the created DateFormat instance is lenient, and may match only part of the timestamp string. 

For example, MM/dd/yy HH:mm:ss happily matches 2013/01/19 20:55:07 but parses it as 1 Sep 2186 19:55:07 GMT.
Comment 2 Sebb 2013-01-22 02:00:28 UTC
URL: http://svn.apache.org/viewvc?rev=1436725&view=rev
Log:
CSVSaveService does not handle date parsing very well
Bugzilla Id: 54459

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/save/CSVSaveService.java
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/listeners.xml


Did not implement the following formats:
yyyyMMdd HH:mm:ss[.SSS]
Comment 3 The ASF infrastructure team 2022-09-24 20:37:52 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3041