[ 
https://issues.apache.org/jira/browse/SLING-10179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17293597#comment-17293597
 ] 

Carsten Ziegeler commented on SLING-10179:
------------------------------------------

[~npeltier] Yes, makes sense to better document and improve impl :) Thanks

> it should be clearer that calling FilterChain.doFilter twice must not be done
> -----------------------------------------------------------------------------
>
>                 Key: SLING-10179
>                 URL: https://issues.apache.org/jira/browse/SLING-10179
>             Project: Sling
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: Engine 2.7.4
>            Reporter: Nicolas Peltier
>            Priority: Minor
>
> Right now, calling FilterChain.doFilter twice will trigger an 
> ArrayIndexOutOfBoundException (timer array based on the number of registered 
> filter handles).
> Such (bad) code can trigger this:
> {Code}
> ...
>     filterChain.doFilter(...)
> ...
> if (wrongAssumption()) {
>    filterChain.doFilter(...);
> }
> ...
> {Code}
> it's not obvious for the developer from the ArrayIndexOutOfBoundException 
> what he did wrong and i think we should 
> 1. either throw a servlet exception saying "Filter should not been called 
> twice", either log a warning with the stack trace
> 2. document clearly in sling filters that filter should not be called twice, 
> referring to both case (ArrayIndexOufOfBoundException and whatever comes out 
> of 1.)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to