Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8253459

Formatter treats index, width and precision > Integer.MAX_VALUE incorrectly

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b26
    • Verification:
      Verified

      Description

      A DESCRIPTION OF THE PROBLEM :
      The source code of java.util.Formatter has 3 `assert(false)` statements:
      - When the argument index cannot be parsed as int
      - When the width cannot be parsed as int
      - When the precision cannot be parsed as int

      All of them can be triggered when the arguments are > Integer.MAX_VALUE. Expected would be that an exception is thrown.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected exceptions to be thrown

      ---------- BEGIN SOURCE ----------
      String.format("%2147483648s", 1) // Acts like no explicit width
      String.format("%s %2147483648$s", 1) // Acts like "Relative indexing"
      String.format("%.2147483648f", 1.0) // Acts like no explicit precision
      ---------- END SOURCE ----------

        Attachments

          Issue Links

          There are no Sub-Tasks for this issue.

            Activity

              People

              Assignee:
              igraves Ian Graves
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: