You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bridges-dev@portals.apache.org by "David Sean Taylor (JIRA)" <br...@portals.apache.org> on 2008/07/04 19:17:41 UTC

[jira] Commented: (PB-81) FilterPortlet bug when creating the PortletFilterChain

    [ https://issues.apache.org/jira/browse/PB-81?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610628#action_12610628 ] 

David Sean Taylor commented on PB-81:
-------------------------------------

I just wrote this little Groovy script:

String portletFilters = "filterOne, filterTwo,filterThree    ,    filterFour ,filterFive";
StringTokenizer st = new StringTokenizer(portletFilters, ", ");
while (st.hasMoreTokens())
{
     String className = st.nextToken(); 
     println("token is = [" + className + "]");
}

 which outputs:

token is = [filterOne]
token is = [filterTwo]
token is = [filterThree]
token is = [filterFour]
token is = [filterFive]

I don't see the bug you are describing 


> 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
>            Assignee: David Sean Taylor
>            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: bridges-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: bridges-dev-help@portals.apache.org