You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by pr...@apache.org on 2003/07/28 02:51:34 UTC
cvs commit: jakarta-commons/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt BundleTag.java
proyal 2003/07/27 17:51:34
Modified: jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt
BundleTag.java
Log:
[JELLY-62] FMT Tag Library
BundleTag will now load resources from the JellyContext classloader
Patch from Willie Vu
Revision Changes Path
1.3 +9 -9 jakarta-commons/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/BundleTag.java
Index: BundleTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/BundleTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BundleTag.java 26 Jan 2003 02:02:08 -0000 1.2
+++ BundleTag.java 28 Jul 2003 00:51:34 -0000 1.3
@@ -78,7 +78,7 @@
* @author <a href="mailto:willievu@yahoo.com">Willie Vu</a>
* @version 1.1
*
- * @task decide how to implement setResponseLocale
+ * @todo decide how to implement setResponseLocale
*/
public class BundleTag extends TagSupport {
@@ -221,7 +221,7 @@
}
if (pref != null) {
// Preferred locale is application-based
- bundle = findMatch(basename, pref);
+ bundle = findMatch(basename, pref, jc.getClassLoader());
if (bundle != null) {
locCtxt = new LocalizationContext(bundle, pref);
}
@@ -236,7 +236,7 @@
}
}
if (pref != null) {
- bundle = findMatch(basename, pref);
+ bundle = findMatch(basename, pref, jc.getClassLoader());
if (bundle != null) {
locCtxt = new LocalizationContext(bundle, pref);
}
@@ -246,8 +246,8 @@
if (locCtxt == null) {
// try using the root resource bundle with the given basename
try {
- bundle = ResourceBundle.getBundle(basename, EMPTY_LOCALE,
- Thread.currentThread().getContextClassLoader());
+ bundle = ResourceBundle.getBundle(basename, EMPTY_LOCALE,
+ jc.getClassLoader());
if (bundle != null) {
locCtxt = new LocalizationContext(bundle, null);
}
@@ -281,19 +281,19 @@
*
* @param basename the resource bundle base name
* @param pref the preferred locale
+ * @param cl classloader used to find resource bundle
*
* @return the requested resource bundle, or <tt>null</tt> if no resource
* bundle with the given base name exists or if there is no exact- or
* language-match between the preferred locale and the locale of
* the bundle returned by java.util.ResourceBundle.getBundle().
*/
- private static ResourceBundle findMatch(String basename, Locale pref) {
+ private static ResourceBundle findMatch(String basename, Locale pref, ClassLoader cl) {
ResourceBundle match = null;
try {
ResourceBundle bundle =
- ResourceBundle.getBundle(basename, pref,
- Thread.currentThread().getContextClassLoader());
+ ResourceBundle.getBundle(basename, pref, cl);
Locale avail = bundle.getLocale();
if (pref.equals(avail)) {
// Exact match
@@ -341,4 +341,4 @@
this.prefix = prefix;
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org