hitashuu commented on issue #6609: URL: https://github.com/apache/jmeter/issues/6609#issuecomment-3594714956
Hi there, I would like to work on this issue. I have analyzed the problem and reproduced both behaviors: the IllegalArgumentException when dates are equal, and the exclusion of the end date in normal ranges. Root Cause Analysis: The underlying method ThreadLocalRandom.current().nextLong(origin, bound) treats the upper bound as exclusive. The Logic Error: When passing (start, end), the function picks a value in [start, end). The configured end date is never reached. The Crash: When start == end, the bounds are invalid because nextLong requires bound > origin. Proposed Solution: I propose shifting the upper bound by adding 1 day (in milliseconds) before generating the random number. This single change elegantly resolves both issues. Fixes the Logic: By making the range [start, end + 1day), the original end date becomes a valid candidate. Fixes the Crash: Even if start == end, the range becomes [start, start + 1day). This satisfies the bound > origin requirement and correctly returns the single start date. Implementation Plan: Modify RandomDate.java to add 86400000L (24 hours in ms) to the end parameter. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
