-
Notifications
You must be signed in to change notification settings - Fork 661
Description
Hi.
Our production system is currently running on Java 11. We are looking at upgrading to Java 25. But we noticed an interesting issue today, in relation to session start up.
FYI, our session configuration is:
start time: Sunday, Australia/Victoria, 13:00
end time: Saturday, America/New York, 17:00
Our server is running in en_AU locale (I'm not 100% if this matters, but I suspect this has something to do with the issue). I also noticed that with Java 25, start of week for en_AU is Monday, where as with Java 11, start of week for en_AU is Sunday.
So going back to the problem, at 10:00 AM Australia Victoria time today, when I run my test, our session wouldn't start. Upon debugging, I found that with Java 25, the session interval was set to:
Sunday 22 February 2:00 UTC --> Saturday 21 February 22:00 UTC.
Where as with Java 11, the session interval would be:
Sunday 22 February 2:00 UTC --> Saturday 28 February 22:00 UTC
I suspect the underlying issue here is due to the behaviour of setting DAY_OF_WEEK as well as the 'start of week'. When current day is Monday, setting the date to Sunday would cause:
- With Java 17 and below: going backward (because it is still in the same week)
- With Java 21 and above: going forward (because week start with Monday).
I have created the following GitHub repo to demonstrate the issue: https://github.com/alexwibowo/quickfixjTest
There are two branches:
- main branch is using Java 8
- feature/JDK-25 is using Java 25.
In particular, this bit of code is where I think the problem is :
| intervalEnd.add(Calendar.WEEK_OF_YEAR, -1); |
(I'm not sure why intervalEnd is subtracted by 1 here)
In my repo above, I tried to fix it by adding another week:
https://github.com/alexwibowo/quickfixjTest/blob/128875e442668bd99014d0c93fb5cb7befa2630f/lib/src/test/java/org/example/LibraryTest.java#L116
if (intervalEnd.getTimeInMillis() < intervalStart.getTimeInMillis()) {
intervalEnd.add(Calendar.WEEK_OF_YEAR, 1);
}
although my test passes, it failed in the quickfixj test suite (SessionScheduleTest)