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

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

XMLWordPrintable

    • b10
    • generic
    • generic

        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 .

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

                Created:
                Updated:
                Resolved: