Uploaded image for project: 'Portals Bridges (Retired)'
  1. Portals Bridges (Retired)
  2. PB-81

FilterPortlet bug when creating the PortletFilterChain

    XMLWordPrintableJSON

Details

    • Bug
    • Status: In Progress
    • Minor
    • Resolution: Unresolved
    • 1.0.4
    • None
    • portletfilter
    • None
    • WebSphere Portal

    Description

      I found that configuration of a FilterPortlet which has more than one filter can be bad read at the constructor of the class FilterPortletChain. Following is the code that I found at that class:

      String portletFilters = config.getInitParameter(PORTLET_FILTERS);
      StringTokenizer st = new StringTokenizer(portletFilters, ", ");
      while (st.hasMoreTokens())
      {
      String className = st.nextToken();
      try

      { addPortletFilter(new PortletFilterConfig(className, config)); }
      catch (PortletException e)
      { log.warn("Invalid portlet filter: " + className, e); }
      }

      As you can see, the StringTokenizer uses a two char string as a separator, so, when I configure the filters for a given portlet, I need to put a blank after the comma (I think that using just the comma as separator is enough).
      Also, I have noticed that if I configure different PortletFilter classes in different lines, The PortletFilterChain can only load the first one, when it tries to load the other ones it throws a ClassNotFoundException. The cause of this is maybe that when iterating over the tokens of the StringTokenizer there is not any call to the method "trim" from the class String.

      Below is a suggestion of code that solves this issue:
      String portletFilters = config.getInitParameter(PORTLET_FILTERS);
      StringTokenizer st = new StringTokenizer(portletFilters, ",");
      while (st.hasMoreTokens())
      {
      String className = st.nextToken().trim();
      try
      { addPortletFilter(new PortletFilterConfig(className, config)); }

      catch (PortletException e)

      { log.warn("Invalid portlet filter: " + className, e); }

      }

      Attachments

        Activity

          People

            taylor David Sean Taylor
            alonsodomin Alonso Dominguez
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: