[jboss-jira] [JBoss JIRA] Created: (JBPORTAL-1380) error in LocaleInterceptor
Luca Stancapiano (JIRA)
jira-events at lists.jboss.org
Fri May 4 19:26:52 EDT 2007
error in LocaleInterceptor
--------------------------
Key: JBPORTAL-1380
URL: http://jira.jboss.com/jira/browse/JBPORTAL-1380
Project: JBoss Portal
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 2.6.CR2
Environment: jboss portal from http://anonsvn.jboss.org/repos/portal/tags/JBoss_Portal_2_6_0_CR2
Reporter: Luca Stancapiano
Fix For: 2.6 Final
when I log in my portal with an administartor that is not "admin", I cannot to use CMS as I would. For example when I go into
Management Portlet / Portal Objects / default / default / page layout and I try to use CMS mode to change a page in my home, I have a NullPointerException because execute method of org.jboss.portal.cms.impl.jcr.command.ContentGetCommand cannot to return a Content about my chosen page. That because it try to take it into javax.jcr.Session through a wrong locale:
org.jboss.portal.cms.impl.jcr.command.ContentGetCommand : row 93 :
contentNode = (Node)session.getItem(this.msPath + "/" + this.mlocale.getLanguage());
indeed that language is equals to toString() method of Locale created into org.jboss.portal.core.aspects.server.LocaleInterceptor:
org.jboss.portal.core.aspects.server.LocaleInterceptor: row 68 :
locale = new Locale(lc.toString());
lc variable is taken from profile.get(User.INFO_USER_LOCALE), which is equal to toStriing() method of a java.util.Locale taken from org.jboss.portal.core.portlet.user.UserPortlet:
org.jboss.portal.core.portlet.user.UserPortlet: row 736 :
setProperty(user, User.INFO_USER_LOCALE, req.getLocale().toString());
so we put a toString() of Locale of format language_country_variant into language field of Locale class.......it is wrong because it will take many errors to compare with other locales
Instead of use new Locale(String language) constructor, we need to use Locale(String language, String country, String variant) constructor and to split lc.toString() in three part....Below it's my patch:
org.jboss.portal.core.aspects.server.LocaleInterceptor: row 68 :
String[] lcStr = lc.toString().split("_");
locale = new Locale(lcStr[0],
lcStr.length >1 ? lcStr[1] : "",
lcStr.length >2 ? lcStr[2] : "");
so we will get always Locale objects comparable in the right mode
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list