FilterPortlet bug when creating the PortletFilterChain
------------------------------------------------------

                 Key: PB-81
                 URL: https://issues.apache.org/jira/browse/PB-81
             Project: Portals Bridges
          Issue Type: Bug
          Components: portletfilter
    Affects Versions: 1.0.4
         Environment: WebSphere Portal
            Reporter: Alonso Dominguez
            Priority: Minor


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);
            }
        }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to