Uploaded image for project: 'Jetspeed 2 (Retired)'
  1. Jetspeed 2 (Retired)
  2. JS2-280

The default value of xml:lang attribute in portlet.xml should be English and more(see the description)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.0-M4
    • 2.0-dev/cvs
    • Other
    • None
    • WinXP SP2, JDK 1.4.2_07

    Description

      I have found four related problems.
      1. In method "createPortletApplication" of class: org.apache.jetspeed.util.descriptor.PortletApplicationDescriptor, the attribute of elements "display-name" and "description" should be xml:lang, not just lang, for example:

      digester.addSetProperties("portlet-app/portlet/display-name", "lang", "language");

      2. According to PLT.21.8.1, The default value for the xml:lang attribute is English (?en?). Portlet-container implementations using localized values of these elements should treat the English (?en?) values as the default fallback value for all other locales. So it is wrong to use "Locale.getDefault()" in class org.apache.jetspeed.util.JetspeedLocale. In my environment(SIMPLIFIED_CHINESE), it always cause many problems. So I think we should change as following:
      /**

      • According to PLT.21.8.1, the default locale should be English.
        */
        public static Locale getDefaultLocale() { return Locale.ENGLISH; }

      3. Enhance PortletSelector to make it more robust.
      In method getRows(RenderRequest request, String sql, int windowSize, String filter) of PortletSelector portlet. If the HttpServletRequest's locale (Client browser's locale) is not supported by portlet's display-name or description, it will cause a NullPointException when try to sort the portlets. so I suggest that if client browser's locale can be support, we try to return the default locale display-name or description. So I change it as following:

      ......
      // Try to get the display-name of request locale. If can't, return the default English locale display-name.
      String displayNameText = portlet.getDisplayNameText(locale);
      if(displayNameText == null || displayNameText.length() == 0)
      displayNameText = portlet.getDisplayNameText(Locale.ENGLISH);

      // Try to get the descriptionText of request locale. If can't, return the default English locale display-name.
      String descriptionText = portlet.getDescriptionText(locale);
      if(descriptionText == null || descriptionText.length() == 0)
      descriptionText = portlet.getDescriptionText(Locale.ENGLISH);

      list.add(new PortletInfo(appName + "::" + portlet.getName(), displayNameText, descriptionText));
      }
      BrowserIterator iterator = new PortletIterator(
      list, resultSetTitleList, resultSetTypeList,
      windowSize);
      setBrowserIterator(request, iterator);
      iterator.sort("Portlet");
      }
      ......

      4. I found many bundled portlets' portlet.xml aren't so standard in J2. They use lang instead of xml:lang ererywhere.

      Attachments

        1. patch.txt
          5 kB
          Jian Liao
        2. patch.zip
          6 kB
          Jian Liao

        Activity

          People

            shinsuke Shinsuke Sugaya
            norwaywoods Jian Liao
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: