From 144e0610da81c9a10bc127a379147fa8177f1e06 Mon Sep 17 00:00:00 2001 From: Arthur Velho Cristiano Date: Tue, 16 Jun 2026 20:34:40 -0300 Subject: [PATCH] Change exception type for large array size --- guava/src/com/google/common/base/Strings.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guava/src/com/google/common/base/Strings.java b/guava/src/com/google/common/base/Strings.java index b642f9028aee..d39ff534cf63 100644 --- a/guava/src/com/google/common/base/Strings.java +++ b/guava/src/com/google/common/base/Strings.java @@ -63,7 +63,7 @@ public static String nullToEmpty(@Nullable String string) { *

Consider normalizing your string references with {@link #nullToEmpty}. If you do, you can * use {@link String#isEmpty()} instead of this method, and you won't need special null-safe forms * of methods like {@link String#toUpperCase} either. Or, if you'd like to normalize "in the other - * direction" (converting empty strings to {@code null}), you can use {@link #emptyToNull}. + * direction," converting empty strings to {@code null}, you can use {@link #emptyToNull}. * * @param string a string reference to check * @return {@code true} if the string is null or is the empty string @@ -161,7 +161,7 @@ public static String repeat(String string, int count) { long longSize = (long) len * (long) count; int size = (int) longSize; if (size != longSize) { - throw new ArrayIndexOutOfBoundsException("Required array size too large: " + longSize); + throw new IllegalArgumentException("string.length() * count is too large: " + longSize); } char[] array = new char[size];