Details
-
Type:
CSR
-
Status: Closed
-
Priority:
P4
-
Resolution: Approved
-
Fix Version/s: 13
-
Component/s: core-libs
-
Labels:None
-
Subcomponent:
-
Compatibility Kind:behavioral
-
Compatibility Risk:minimal
-
Compatibility Risk Description:Some app will start to see an exception with invalid `HOUR_OF_AMPM` input string, but that is what should be in the first place.
-
Interface Kind:Java API
-
Scope:SE
Description
Summary
Throw a DateTimeParseException
on resolving an out-of-range HOUR_OF_AMPM
value in `ResolverStyle.SMART mode.
Problem
Client code like this:
new DateTimeFormatterBuilder()
.appendValue(HOUR_OF_AMPM,2)
.appendText(AMPM_OF_DAY)
.toFormatter(US)
.parse("12PM");
does not throw a DateTimeParseException
, even though the input hour number 12
is out of range for HOUR_OF_AMPM
.
Solution
Throw a DateTimeParseException
in such cases.
Specification
This is a behavioral change, thus no specification change is expected.
Attachments
Issue Links
- csr of
-
JDK-8223773 DateTimeFormatter Fails to throw an Exception on Invalid HOUR_OF_AMPM
-
- Resolved
-