[
https://issues.apache.org/jira/browse/SLING-10179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nicolas Peltier resolved SLING-10179.
-------------------------------------
Resolution: Fixed
> it should be made 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
> Assignee: Nicolas Peltier
> Priority: Minor
> Fix For: Engine 2.7.6
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> 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)