taylor 2004/10/05 18:50:49
Modified: components/registry/src/java/org/apache/jetspeed/om/impl
LanguageImpl.java LanguageSetImpl.java
Log:
the language code is a mess
im not really sure how to address this easily, since its tied to the Pluto model
The problem I had to deal with is caused by the language set creation is tied to
the <portlet-info>
If no portlet-info exists, then no languages are added to the language set
This is wrong, as the spec states you can have either portlet-info OR resources
bundles
In the case where there was no portlet-info, yet there was a resource bundle, a NPE
would occur trying to access a non-existent resource bundle
This patch attempts to rectify the situation on the fly
I think a better approach would be to create the language set based on the supported
locales
Revision Changes Path
1.8 +13 -1
jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl/LanguageImpl.java
Index: LanguageImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl/LanguageImpl.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- LanguageImpl.java 22 Sep 2004 14:04:31 -0000 1.7
+++ LanguageImpl.java 6 Oct 2004 01:50:49 -0000 1.8
@@ -93,6 +93,18 @@
setKeywords(this.resourceBundle.getString("javax.portlet.keywords"));
}
+ public LanguageImpl(
+ Locale locale,
+ ResourceBundle bundle)
+ {
+ this.resourceBundle =
+ new ResourceBundleImpl(
+ bundle,
+ new DefaultsResourceBundle("", "", ""));
+ this.locale = locale;
+
+ }
+
/**
* @see org.apache.pluto.om.common.Language#getLocale()
*/
1.8 +15 -7
jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl/LanguageSetImpl.java
Index: LanguageSetImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl/LanguageSetImpl.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- LanguageSetImpl.java 11 Sep 2004 23:40:18 -0000 1.7
+++ LanguageSetImpl.java 6 Oct 2004 01:50:49 -0000 1.8
@@ -133,6 +133,11 @@
StringUtils.join(fallBack.getKeywords(), ","));
}
+ if (fallBack == null)
+ {
+ fallBack = new LanguageImpl(locale, loadResourceBundle(locale));
+ innerCollection.add(fallBack);
+ }
return fallBack;
}
@@ -216,13 +221,16 @@
ResourceBundle resourceBundle = null;
try
{
- if (classLoader != null)
- {
- resourceBundle=ResourceBundle.getBundle(resources, locale,
classLoader);
- }
- else
+ if (resources != null)
{
- resourceBundle=ResourceBundle.getBundle(resources, locale,
Thread.currentThread().getContextClassLoader());
+ if (classLoader != null)
+ {
+ resourceBundle=ResourceBundle.getBundle(resources, locale,
classLoader);
+ }
+ else
+ {
+ resourceBundle=ResourceBundle.getBundle(resources, locale,
Thread.currentThread().getContextClassLoader());
+ }
}
}
catch (MissingResourceException x)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]