Bug 56441 - Misleading error message in FilterBase cause by invalid regex
Misleading error message in FilterBase cause by invalid regex
Product: Tomcat 7
Classification: Unclassified
Component: Catalina
All Linux
: P2 minor (vote)
: ---
Assigned To: Tomcat Developers Mailing List
Depends on:
  Show dependency tree
Reported: 2014-04-22 07:05 UTC by MattR
Modified: 2014-04-26 19:33 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description MattR 2014-04-22 07:05:33 UTC
An invalid regex in the allow parameter leads to raising of a misleading exception: The property "allow" is not defined for filters of type "org.apache.catalina.filters.RemoteAddrFilter".

Test config in web.xml



Apr 22, 2014 3:50:10 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter TestFilter
javax.servlet.ServletException: The property "allow" is not defined for filters of type "org.apache.catalina.filters.RemoteAddrFilter"
        at org.apache.catalina.filters.FilterBase.init(FilterBase.java:53)
        at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:269)
        at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
        at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
        at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
        at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
Comment 1 Christopher Schultz 2014-04-22 19:41:02 UTC

It seems that IntrospectionUtils.setProperty catches things like InvocationTargetException and logs them at the DEBUG level. I assert that such things should be logged at the WARN level.

Without DEBUG logging enabled, a user cannot see the underlying error.
Comment 2 Mark Thomas 2014-04-26 19:33:56 UTC
I looked into changing the current error message to better describe the problem and to mention enabling debug logs for more detail. The issue with that approach is there are a lot of 'normal' debug logs and a single error.

Logging these errors as warnings seems appropriate to me.

I have fixed this in 8.0.x for 8.0.6 onwards and in 7.0.x for 7.0.54 onwards.