You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by "Neil Griffin (JIRA)" <ji...@apache.org> on 2019/04/03 21:24:00 UTC

[jira] [Closed] (PLUTO-765) The wrong ClassLoader is used to load the portlet ResourceBundle in portlet-skin.jsp

     [ https://issues.apache.org/jira/browse/PLUTO-765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Neil Griffin closed PLUTO-765.
------------------------------
    Resolution: Fixed

Fixed in commit [355acbfcdc268fd832ce6558390dfcc9e162f6a8|https://github.com/apache/portals-pluto/commit/355acbfcdc268fd832ce6558390dfcc9e162f6a8].

> The wrong ClassLoader is used to load the portlet ResourceBundle in portlet-skin.jsp
> ------------------------------------------------------------------------------------
>
>                 Key: PLUTO-765
>                 URL: https://issues.apache.org/jira/browse/PLUTO-765
>             Project: Pluto
>          Issue Type: Bug
>          Components: portlet container
>    Affects Versions: 3.0.0, 3.0.1
>            Reporter: Neil Griffin
>            Assignee: Neil Griffin
>            Priority: Major
>             Fix For: 3.0.2
>
>
> As shown in the following code fragment, portlet-skin.jsp uses the <pluto:title/> JSP tag in order to render the title of each portlet on the portal page:
> {code:xml|title=portlet-skin.jsp}
> <!-- Use pluto portlet tag to render the portlet -->
> <pluto:portlet portletId="${portlet}">
>   <!-- Assemble the rendering result -->
>   <div class="portlet">
>     <table class="header" width="100%">
>         <tr>
>             <td class="header" align="left">
>                 <!-- Portlet Title -->
>                 <h2 class="title"><pluto:title/></h2>
>             </td>
>             ...
>         </tr>
> 	...
>     <table>
>     ...
> </pluto:portlet>
> {code}
> This in turn invokes {{PortletTitleTag.doStartTag()}} which does the following:
> {code:java|tile=PortletTitleTag.java}
> ...
> PortletConfig config = driverConfig.getPortletConfig(portletId);
> ...
> Locale defaultLocale = request.getLocale();
> ResourceBundle bundle = config.getResourceBundle(defaultLocale);
> title = bundle.getString("javax.portlet.title");
> {code}
> The call to {{config.getResourceBundle(defaultLocale)}} eventually calls {{DriverPortletConfigImpl.getResourceBundle(Locale)}} which in turn calls {{ResourceBundleFactory.getResourceBundle(Locale)}}.
> The {{ResourceBundleFactory.getResourceBundle(Locale)}} method uses the [TCCL|https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#getContextClassLoader()] in order to load the resource bundle resource:
> {code:java|title=ResourceBundleFactory.java}
> ClassLoader loader = Thread.currentThread().getContextClassLoader();
> bundle = ResourceBundle.getBundle(bundleName, locale, loader);
> {code}
> The problem is that the {{ClassLoader}} associated with portlet-skin is the one for the "/pluto" webapp context, not the one for the portlet. This causes the resource bundle lookup to fail, which in turn causes the resource bundle cache to contain a bundle that has no property values.
> One possible fix for this problem would be to ensure that the portlet itself obtains the resource bundle before pluto-skin.jsp tries to do it.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)