getLocale and friends, and ignore it if it doesn't.
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@483769
13f79535-47bb-0310-9956-
ffa450edef68
variant = "";
}
}
+ if (!isAlpha(language) || !isAlpha(country) || !isAlpha(variant)) {
+ continue;
+ }
// Add a new Locale to the list of Locales for this quality level
Locale locale = new Locale(language, country, variant);
}
+
+ protected static final boolean isAlpha(String value) {
+ for (int i = 0; i < value.length(); i++) {
+ char c = value.charAt(i);
+ if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '1' && c <= '9'))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
}