mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8293146: Strict DateTimeFormatter fails to report an invalid week 53
Reviewed-by: rriggs
This commit is contained in:
parent
02dce24b59
commit
32c7b6283d
2 changed files with 65 additions and 4 deletions
|
@ -78,6 +78,7 @@ import java.io.ObjectInputStream;
|
|||
import java.io.Serializable;
|
||||
import java.time.DateTimeException;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.chrono.ChronoLocalDate;
|
||||
import java.time.chrono.Chronology;
|
||||
import java.time.format.ResolverStyle;
|
||||
|
@ -1031,7 +1032,7 @@ public final class WeekFields implements Serializable {
|
|||
long weeks = Math.subtractExact(wowby, 1);
|
||||
date = date.plus(weeks, WEEKS);
|
||||
} else {
|
||||
int wowby = weekDef.weekOfWeekBasedYear.range().checkValidIntValue(
|
||||
int wowby = weekDef.weekOfWeekBasedYear.rangeRefinedBy(LocalDate.of(yowby, 7, 2)).checkValidIntValue(
|
||||
fieldValues.get(weekDef.weekOfWeekBasedYear), weekDef.weekOfWeekBasedYear); // validate
|
||||
date = ofWeekBasedYear(chrono, yowby, wowby, localDow);
|
||||
if (resolverStyle == ResolverStyle.STRICT && localizedWeekBasedYear(date) != yowby) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue