Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8253459 Formatter treats index, width and precision > Integer.MAX_VALUE incorrectly
  3. JDK-8256498

Release Note: Argument Index of Zero or Unrepresentable by int Throws IllegalFormatException.

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Delivered
    • Icon: P4 P4
    • 16
    • 16
    • core-libs
    • generic
    • generic
    • Verified

      Format string specifiers now throw exceptions when given values outside of valid ranges of values.

      The Formatter class in java.util defines format specifiers such as argument indexes, argument widths, and argument precisions. Numeric values that are invalid (zero for argument index) or too large (beyond the size of an int) could create unexpected results with undefined behavior. This update gives explicit value ranges for these format specifiers. Widths and indexes will be valid from [1, Integer.MAX_VALUE] and precision fields will be valid from [0, Integer.MAX_VALUE]. Values outside of these ranges will result in IllegalFormatException or one of its subclasses being thrown. Note that argument indexes of zero prior to this change did not throw an exception and produced behavior that was undefined, but had the appearance of correctness despite causing side effects that were not obvious.

            igraves Ian Graves
            igraves Ian Graves
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: