Skip to content

Navigation Menu

Sign in
Sign up

Change exception type for large array size #8489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ArthurVCristiano wants to merge 1 commit into google:master
base: master
Choose a base branch
Loading
from ArthurVCristiano:patch-3
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions guava/src/com/google/common/base/Strings.java
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static String nullToEmpty(@Nullable String string) {
* <p>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
Expand Down Expand Up @@ -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];
Expand Down

AltStyle によって変換されたページ (->オリジナル) /