Bug 64070 - _timeshift function does not work with offset formatters
Summary: _timeshift function does not work with offset formatters
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 5.2
Hardware: All All
: P2 normal (vote)
Target Milestone: JMETER_5.3.0
Assignee: JMeter issues mailing list
URL:
Keywords: FixedInTrunk
Depends on:
Blocks:
 
Reported: 2020-01-10 15:46 UTC by Markus Wolf
Modified: 2020-01-12 18:09 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Wolf 2020-01-10 15:46:02 UTC
The _timeshift function does not work with a formatter of the form
"yyyy-MM-DD'T'HH:mm:ssXXX". This is due to the fact that internally a LocalDateTime is used instead of a ZonedDateTime.
An exception java.time.temporal.UnsupportedTemporalTypeException with text Unsupported field: OffsetSeconds
is thrown.

Can be easily tested with the function helper

${__timeShift(yyyy-MM-DD'T'dd:HH:mm:ss.SSSZ,,P2D,,)}

I think this could be very easily fixed and make a great tool even greater.
As a workaround I created a bean shell script working with ZonedDateTime.
Comment 1 Felix Schumacher 2020-01-10 17:18:08 UTC
Thanks for the report and the nice words about JMeter.

Could you test the next nightly, if the changes fix your problems?
If they do, you can close this bug.

commit 40db97b6dc1ca2460bf78d28d5368c83a4345869
AuthorDate: Fri Jan 10 18:12:47 2020 +0100

    _timeshift function does not work with offset formatters
    
    Bugzilla Id: 64070
---
 .../org/apache/jmeter/functions/TimeShift.java     | 40 ++++++++++++----------
 .../jmeter/functions/TestTimeShiftFunction.java    | 17 +++++++++
 xdocs/changes.xml                                  |  2 ++
 3 files changed, 41 insertions(+), 18 deletions(-)
Comment 2 Markus Wolf 2020-01-12 18:09:18 UTC
Tested the nightly build from 10.01.2020. It works now, thanks for the quick fix.
Comment 3 The ASF infrastructure team 2022-09-24 20:38:18 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/5224