This is an automated email from the ASF dual-hosted git repository. garydgregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit 4e4a042cab48cc4425199cc2cc80cbce7b9aeb45 Author: Gary Gregory <[email protected]> AuthorDate: Sat Jul 25 08:13:31 2026 -0400 Merge if statements with the same return value. --- src/main/java/org/apache/commons/lang3/LocaleUtils.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/LocaleUtils.java b/src/main/java/org/apache/commons/lang3/LocaleUtils.java index f2cff666a..2d8eb0c8a 100644 --- a/src/main/java/org/apache/commons/lang3/LocaleUtils.java +++ b/src/main/java/org/apache/commons/lang3/LocaleUtils.java @@ -432,10 +432,7 @@ public static Locale toLocale(final String str) { if (len == 3) { return new Locale(StringUtils.EMPTY, str.substring(1, 3)); } - if (len < 5) { - throw new IllegalArgumentException("Invalid locale format: " + str); - } - if (str.charAt(3) != ch0) { + if (len < 5 || str.charAt(3) != ch0) { throw new IllegalArgumentException("Invalid locale format: " + str); } return new Locale(StringUtils.EMPTY, str.substring(1, 3), str.substring(4));
