<i18n dev> RFR: 8225641: Calendar.roll(int field) does not work correctly for WEEK_OF_YEAR [v6]

Justin Lu jlu at openjdk.org
Fri Mar 31 16:39:19 UTC 2023


On Thu, 30 Mar 2023 23:20:52 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Justin Lu has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - dayInMinWeek should range check input and throw exception
>>  - Tweak static cal builder
>
> src/java.base/share/classes/java/util/GregorianCalendar.java line 3025:
> 
>> 3023:         if (endDay > 7 || endDay < 1 || startDay > 7 || startDay < 1) {
>> 3024:             throw new IllegalArgumentException("Start day or end day is not " +
>> 3025:                     "a valid day of the week");
> 
> Sorry, I take my previous comment back. I think we can simply rely on the return value from `getFirstDayOfWeek()` as it is well-checked, so no need to check the input here. Otherwise the thrown IAE woudl have to end up in `add()/roll()` public methods, which cannot be spec'ed with these internal arguments.

No worries, that makes sense. Removed the exception.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13031#discussion_r1154683765


More information about the i18n-dev mailing list