Bug 53758 - Dynamic Filter Registration mapping logic inverted
Summary: Dynamic Filter Registration mapping logic inverted
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: trunk
Hardware: All All
: P2 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-21 19:59 UTC by David Graff
Modified: 2012-08-26 23:12 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Graff 2012-08-21 19:59:03 UTC
In the class org.apache.catalina.core.ApplicationFilterRegistration, the methods addMappingForServletNames and addMappingForUrlPatterns have inverted logic on how to register the filter to the context.

If the parameter isMatchAfter is passed as true, the filter is placed in the context using the addFilterMapBefore method.

if (isMatchAfter) {
    context.addFilterMapBefore(filterMap);
} else {
    context.addFilterMap(filterMap);
}

The logic should ultimate be (in both methods):

if (!isMatchAfter) {
    context.addFilterMapBefore(filterMap);
} else {
    context.addFilterMap(filterMap);
}

or

if (isMatchAfter) {
    context.addFilterMap(filterMap);
} else {
    context.addFilterMapBefore(filterMap);
}



svn rev on trunk is 1375614
Comment 1 Mark Thomas 2012-08-26 22:31:55 UTC
Thanks for the report and the analysis to pin-point the root cause.

This has been fixed in trunk and 7.0.x and will be included in 7.0.30 onwards.
Comment 2 David Graff 2012-08-26 23:12:22 UTC
Glad I could help