Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8261422: Adjust problematic String.format calls in jdk/internal/util/…
…Preconditions.java outOfBoundsMessage

Reviewed-by: clanger
  • Loading branch information
MBaesken committed Feb 16, 2021
1 parent cdc874d commit 219b115
Showing 1 changed file with 4 additions and 4 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -203,13 +203,13 @@ private static String outOfBoundsMessage(String checkKind, List<? extends Number
// Switch to default if fewer or more arguments than required are supplied
switch ((args.size() != argSize) ? "" : checkKind) {
case "checkIndex":
return String.format("Index %d out of bounds for length %d",
return String.format("Index %s out of bounds for length %s",
args.get(0), args.get(1));
case "checkFromToIndex":
return String.format("Range [%d, %d) out of bounds for length %d",
return String.format("Range [%s, %s) out of bounds for length %s",
args.get(0), args.get(1), args.get(2));
case "checkFromIndexSize":
return String.format("Range [%d, %<d + %d) out of bounds for length %d",
return String.format("Range [%s, %<s + %s) out of bounds for length %s",
args.get(0), args.get(1), args.get(2));
default:
return String.format("Range check failed: %s %s", checkKind, args);
Expand Down

1 comment on commit 219b115

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.