Fix off-by-one error in parseLocaleString

Fix off-by-one error in StringUtils.parseLocaleString()

Issue: SPR-10364
This commit is contained in:
Phillip Webb
2013-10-25 18:25:43 -07:00
parent e80b7d1e22
commit e7f89f87c1

View File

@@ -688,7 +688,7 @@ public abstract class StringUtils {
validateLocalePart(language);
validateLocalePart(country);
String variant = "";
if (parts.length >= 2) {
if (parts.length > 2) {
// There is definitely a variant, and it is everything after the country
// code sans the separator between the country code and the variant.
int endIndexOfCountryCode = localeString.lastIndexOf(country) + country.length();