Repository navigation
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)
Activity
chrjohn commentedon Feb 23, 2026
Hi @alexwibowo , isn't this #574 ? Did you try with master branch?
alexwibowo commentedon Feb 23, 2026
Interesting. I'll give that a try. Coincidentally I've just created a PR:
#1147
But let me try to run my test again master (pretty sure I updated my branch with master)
alexwibowo commentedon Feb 23, 2026
I had a look at #574, but I think the change there is within the code block for 'non stopping session' ? My session is not a 'non stopping session', so I think there is still issue ?
chrjohn commentedon Feb 23, 2026
The change cannot be in the "non stop session" block because such a session is not scheduled.
Edit: are you sure you tested master? There are currently only SNAPSHOT builds of master, i.e. version 3.0.0.
chrjohn commentedon Feb 23, 2026
Did you find anything regarding this in the JDK release notes? I would expect notes on such a change. I found a related issue but that was for JDK 9.
alexwibowo commentedon Feb 24, 2026
Apology for the confusion, Chris. What I meant was, in PR #574, the change was within the 'isWeekdaySession'. i.e. this code block:
In my case, my session is not a weekday session. So the execution will go to the 'else' block. So I still run into issue, even with the latest master.
To answer your question regarding change in JDK release note - I had to do a bit of research on what caused this. But basically, I believe the issue stems out from the use of 'Calendar#set(DAY_OF_WEEK)'. i.e. the following call within 'DefaultSessionSchedule'.:
Our 'start time' is SUNDAY. Now here is the interesting part. I looked at what could cause the issue - and if we look at the implementation, there is a bit of code that relies on the 'getFirstDayOfWeek'. Essentially, it boils down to this class:
If you have a look at this class, there is a constant that follows the 'CLDR' standard. Java 11 (our old JVM) uses CLDR 33. Java 25 (our new JVM) uses CLDR 46.
Running this code in Java 11 vs Java 25 will give different result for my locale (en_AU):
For Java 11, you will get Sunday, and for Java 25, you will get Monday.
This is because in CLDR 40, they have made the change the start day of week for AU from Sunday to Monday. See: https://cldr.unicode.org/downloads/cldr-40
"The default first day of the week is now Monday for Australia, and the default day period preferences for times have changed for CN (to “HH”) and TW (to “hb”, i.e. 12-hour with day periods instead of AM/PM)."
So what does this mean? When I ran my code in Australia time, Monday morning (23 Feb 2026, 10 AM), the code above will try to obtain the start interval, by setting the 'day of week' to Sunday.
From there on , the calculation for the interval is wrong.
Apology for the lengthy response - but I hope that's clear now. Did you get a chance to look at my PR? I have included a unit test, whereby I change the locale to en_AU. If you run that test in Java 11 (without the code change), that test will fail.
chrjohn commentedon Feb 25, 2026
@alexwibowo thanks for the detailed explanation. Please check my comments on your PR.
[-]Potential issue after upgrading to Java 21+[/-][+]Issue regarding `Calendar.getFirstDayOfWeek()` after upgrading to Java 21+[/+]