code: public static Locale parseLocaleAttributeValue(Object stringOrLocale) {
          if (stringOrLocale instanceof Locale) {
              return (Locale) stringOrLocale;
          } else if (stringOrLocale instanceof String) {
              String string = (String) stringOrLocale;
              if (string.length() == 0) {
                  return null;
              } else {
                  return parseLocale(string.trim());
              }
          } else {
              return null;
          }
      }
docs: Handles Locales that can be passed to tags as instances of String or Locale.
  If the parameter is an instance of Locale, it is simply returned.
  If the parameter is a String and is not empty, then it is parsed to a Locale
  using {@link LocaleUtil#parseLocale(String)}.
  Otherwise null will be returned.
  
  @param stringOrLocale locale represented as an instance of Locale or as a String
  @return the locale represented by the parameter, or null if the parameter is undefined