Index: LocaleSupport.java =================================================================== RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/LocaleSupport.java,v retrieving revision 1.14 diff -u -r1.14 LocaleSupport.java --- LocaleSupport.java 23 Mar 2002 01:33:50 -0000 1.14 +++ LocaleSupport.java 25 Mar 2002 18:01:00 -0000 @@ -125,7 +125,7 @@ // Tag logic public int doEndTag() throws JspException { - Locale locale = parseLocale(value, variant); + Locale locale = parseLocale(value, variant, true); pageContext.setAttribute(LOCALE + "." + scope, locale, Util.getScope(scope)); setResponseLocale(pageContext, locale); @@ -146,7 +146,7 @@ * See parseLocale(String, String) for details. */ public static Locale parseLocale(String locale) { - return parseLocale(locale, null); + return parseLocale(locale, null, false); } /** @@ -154,11 +154,12 @@ * country components, and returns the corresponding * java.util.Locale object. * - * If the given locale string is null or empty, the runtime's default - * locale is returned. + * If the given locale string is null or empty, and useDefault is + * true, the runtime's default locale is returned. * * @param locale the locale string to parse * @param variant the variant + * @param useDefault use the runtime's default if necessary * * @return java.util.Locale object corresponding to the given * locale string, or the runtime's default locale if the locale string is @@ -167,7 +168,7 @@ * @throws IllegalArgumentException if the given locale does not have a * language component or has an empty country component */ - public static Locale parseLocale(String locale, String variant) { + public static Locale parseLocale(String locale, String variant, boolean useDefault) { Locale ret = null; String language = locale; @@ -175,7 +176,11 @@ int index = -1; if ((locale == null) || locale.equals("")) { - return Locale.getDefault(); + if (useDefault) { + return Locale.getDefault(); + } else { + return null; + } } if (((index = locale.indexOf(HYPHEN)) > -1) @@ -333,7 +338,7 @@ String loc = pageContext.getServletContext().getInitParameter(name); if (loc != null) { - ret = parseLocale(loc, null); + ret = parseLocale(loc, null, false); } }