ASF Bugzilla – Attachment 1421 Details for
Bug 7423
ResourceBundle lookup algorithm is not working as spec'd.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
A more complete patch that handles the value attribute of fmt:locale being null or empty and allows the ResourceBundle lookup algorithm to work as spec'd.
LocaleSupport.java.patch (text/plain), 2.43 KB, created by
Ryan Lubke
on 2002-03-25 18:10:15 UTC
(
hide
)
Description:
A more complete patch that handles the value attribute of fmt:locale being null or empty and allows the ResourceBundle lookup algorithm to work as spec'd.
Filename:
MIME Type:
Creator:
Ryan Lubke
Created:
2002-03-25 18:10:15 UTC
Size:
2.43 KB
patch
obsolete
>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 > * <tt>java.util.Locale</tt> 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 <tt>java.util.Locale</tt> 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); > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 7423
: 1421 |
1429