mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-19 02:24:40 +02:00
8261422: Adjust problematic String.format calls in jdk/internal/util/Preconditions.java outOfBoundsMessage
Reviewed-by: clanger
This commit is contained in:
parent
cdc874d4c9
commit
219b115e21
1 changed files 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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -203,13 +203,13 @@ public class Preconditions {
|
||||||
// Switch to default if fewer or more arguments than required are supplied
|
// Switch to default if fewer or more arguments than required are supplied
|
||||||
switch ((args.size() != argSize) ? "" : checkKind) {
|
switch ((args.size() != argSize) ? "" : checkKind) {
|
||||||
case "checkIndex":
|
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));
|
args.get(0), args.get(1));
|
||||||
case "checkFromToIndex":
|
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));
|
args.get(0), args.get(1), args.get(2));
|
||||||
case "checkFromIndexSize":
|
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));
|
args.get(0), args.get(1), args.get(2));
|
||||||
default:
|
default:
|
||||||
return String.format("Range check failed: %s %s", checkKind, args);
|
return String.format("Range check failed: %s %s", checkKind, args);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue