try {
String[] localeStrings = locales.split("\\s*,\\s*");
for (int i = 0; i < localeStrings.length; i++) {
Locale locale = new Locale(localeStrings[i]);
if (locale.isEmptyLocale()) {
throw new ConfigException("Locales cannot be empty and must be in the format " + Locale.LANGUAGE_AND_COUNTRY_CODE_FORMAT);
}
}
} catch (IllegalArgumentException ex) {
throw new ConfigException("Error in the config file " + getUnderlyingFile().getPath(), ex);
}
}