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

Adjust problematic String.format calls in jdk/internal/util/Preconditions.java outOfBoundsMessage

    XMLWordPrintable

    Details

    • Resolved In Build:
      b10
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        The method outOfBoundsMessage has a few problematic calls to String.format.
        Those calls use "%d" however the arguments are Number, so we should better use %s .

        Example :

        https://sonarcloud.io/project/issues?id=shipilev_jdk&languages=java&open=AXcqM87A8sPJZZzON5wY&resolved=false&severities=BLOCKER&types=BUG

        return String.format("Index %d out of bounds for length %d",
                             args.get(0), args.get(1));

        Sonar error :
        An 'int' is expected rather than a .

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                mbaesken Matthias Baesken
                Reporter:
                mbaesken Matthias Baesken
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: