Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-10179

it should be made clearer that calling FilterChain.doFilter twice must not be done

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Engine 2.7.4
    • Engine 2.7.6
    • Engine
    • None

    Description

      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:

      ...
          filterChain.doFilter(...)
      ...
      if (wrongAssumption()) {
         filterChain.doFilter(...);
      }
      ...
      

      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.)

      Attachments

        Issue Links

          Activity

            People

              npeltier Nicolas Peltier
              npeltier Nicolas Peltier
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m