Summary: | Class.newInstance is used for Dynamic instance filters causing InstantiationException | ||
---|---|---|---|
Product: | Tomcat 7 | Reporter: | Ismael Juma <mlists> |
Component: | Catalina | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 7.0.6 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All |
Description
Ismael Juma
2011-01-16 12:25:24 UTC
The simple patch that fixes it for me is: [ijuma@localhost]~/src/tomcat% svn diff Index: java/org/apache/catalina/core/ApplicationFilterConfig.java =================================================================== --- java/org/apache/catalina/core/ApplicationFilterConfig.java (revision 1059421) +++ java/org/apache/catalina/core/ApplicationFilterConfig.java (working copy) @@ -367,10 +367,10 @@ this.filter = null; } else { - - // Allocate a new filter instance - getFilter(); - + if (filterDef.getFilter() == null) { + // Allocate a new filter instance + getFilter(); + } } } I don't know if this is the best way, but it works because after returning from that method the following is executed in the constructor (which is the same that getFilter does for the case where Tomcat has the class but not the instance of Filter): if (filterDef.getFilter() != null) { this.filter = filterDef.getFilter(); getInstanceManager().newInstance(filter); initFilter(); } Thanks for the patch. It has been applied to 7.0.x and will be included in 7.0.7 onwards. Thanks! |