-
Enhancement
-
Resolution: Fixed
-
P4
-
8, 9
-
b151
-
generic
-
generic
FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
DateTimeFormatter.ofPattern("YYYYww").parse("201550") fails with "java.time.format.DateTimeParseException: Text '201550' could not be parsed at index 0" and I think it shouldn't.
The same text and pattern work with SimpleDateFormat, so does DateTimeFormatter.ofPattern("YYww").parse("1550").
It fails in java.time.format.DateTimeFormatterBuilder.NumberPrinterParser.parse(DateTimeParseContext, CharSequence, int), line 2695
http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/6ea3aea950d1/src/share/classes/java/time/format/DateTimeFormatterBuilder.java#l2695
However, parsing "2015 50" with "YYYY ww" works fine.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
DateTimeFormatter.ofPattern("YYYYww").parse("201550")
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
{WeekBasedYear[WeekFields[MONDAY,4]]=2015, WeekOfWeekBasedYear[WeekFields[MONDAY,4]]=50},ISO
ACTUAL -
IllegalArgumentException: Text '201550' could not be parsed at index 0
REPRODUCIBILITY :
This bug can be reproduced always.
A DESCRIPTION OF THE PROBLEM :
DateTimeFormatter.ofPattern("YYYYww").parse("201550") fails with "java.time.format.DateTimeParseException: Text '201550' could not be parsed at index 0" and I think it shouldn't.
The same text and pattern work with SimpleDateFormat, so does DateTimeFormatter.ofPattern("YYww").parse("1550").
It fails in java.time.format.DateTimeFormatterBuilder.NumberPrinterParser.parse(DateTimeParseContext, CharSequence, int), line 2695
http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/6ea3aea950d1/src/share/classes/java/time/format/DateTimeFormatterBuilder.java#l2695
However, parsing "2015 50" with "YYYY ww" works fine.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
DateTimeFormatter.ofPattern("YYYYww").parse("201550")
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
{WeekBasedYear[WeekFields[MONDAY,4]]=2015, WeekOfWeekBasedYear[WeekFields[MONDAY,4]]=50},ISO
ACTUAL -
IllegalArgumentException: Text '201550' could not be parsed at index 0
REPRODUCIBILITY :
This bug can be reproduced always.