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,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
|
||||
@ -203,13 +203,13 @@ public class Preconditions {
|
||||
// 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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user