Fix off-by-one error in parseLocaleString

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

Issue: SPR-10364
master
Phillip Webb 11 years ago
parent e80b7d1e22
commit e7f89f87c1
  1. 2
      spring-core/src/main/java/org/springframework/util/StringUtils.java

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

Loading…
Cancel
Save