Summary
Improve the specification of DateTimeFormatterBuilder.appendFraction
to more clearly state that an exception will be thrown if the value to be printed is outside of the field's value range.
Problem
Current specification is ambiguous on what constitutes an invalid value.
Solution
Clarify the specification.
Specification
Adjust the javadoc for DateTimeFormatterBuilder.appendFraction
like so:
diff --git a/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java b/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
index 50c4155c4ac..7af964f106b 100644
--- a/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
+++ b/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
@@ -688,8 +688,8 @@ public final class DateTimeFormatterBuilder {
* If the value is negative an exception will be thrown.
* If the field does not have a fixed set of valid values then an
* exception will be thrown.
- * If the field value in the date-time to be printed is invalid it
- * cannot be printed and an exception will be thrown.
+ * If the field value in the date-time to be printed is outside the
+ * range of valid values then an exception will be thrown.
*
* @param field the field to append, not null
* @param minWidth the minimum width of the field excluding the decimal point, from 0 to 9
- csr of
-
JDK-8276947 Clarify how DateTimeFormatterBuilder.appendFraction handles value ranges
-
- Resolved
-