tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Violeta Georgieva <>
Subject Question about bug 54284
Date Thu, 03 Jan 2013 14:30:03 GMT

I have a question about bug 54284 (Util.objectNameValueNeedsQuote throws
NPE for anonymous Filters)

ServletContext.addFilter javadoc specifies:

FilterRegistration.Dynamic addFilter(java.lang.String filterName, Filter

Registers the given filter instance with this ServletContext under the
given filterName.
The registered filter may be further configured via the returned
FilterRegistration object.

If this ServletContext already contains a preliminary FilterRegistration
for a filter with the given filterName, it will be completed (by assigning
the class name of the given filter instance to it) and returned.


filterName - the name of the filter
filter - the filter instance to register


a FilterRegistration object that may be used to further configure the given
filter, or null if this ServletContext already contains a complete
FilterRegistration for a filter with the given filterName or if the same
filter instance has already been registered with this or another
ServletContext in the same container


java.lang.IllegalStateException - if this ServletContext has already been
java.lang.UnsupportedOperationException - if this ServletContext was passed
to the
method of a ServletContextListener that was neither declared in web.xml or
web-fragment.xml, nor annotated with WebListener

Servlet 3.0

I think that when the filter name is NULL the proper behaviour is to return
>From other point of view the method's javadoc specifies only
IllegalStateException and UnsupportedOperationException.
If the method starts returning IllegalArgumentException it will be
backwards incompatible change and also not compliant with the specification.

What do you think?
Are there any clarifications in the Servlet 3.1 specification?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message