Uploaded image for project: 'Pluto'
  1. Pluto
  2. PLUTO-765

The wrong ClassLoader is used to load the portlet ResourceBundle in portlet-skin.jsp

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.0, 3.0.1
    • 3.1.0
    • portlet container
    • None

    Description

      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:

      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>
      

      This in turn invokes PortletTitleTag.doStartTag() which does the following:

      ...
      PortletConfig config = driverConfig.getPortletConfig(portletId);
      ...
      Locale defaultLocale = request.getLocale();
      ResourceBundle bundle = config.getResourceBundle(defaultLocale);
      title = bundle.getString("javax.portlet.title");
      

      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 in order to load the resource bundle resource:

      ResourceBundleFactory.java
      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      bundle = ResourceBundle.getBundle(bundleName, locale, loader);
      

      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.

      Attachments

        Activity

          People

            ngriffin7a Neil Griffin
            ngriffin7a Neil Griffin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: