[ https://issues.apache.org/jira/browse/FELIX-6745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17907677#comment-17907677 ]
Carsten Ziegeler commented on FELIX-6745: ----------------------------------------- Fixed in https://github.com/apache/felix-dev/commit/d3994ac7c8bc5c6d30b3019b2402ab8b2eadc168 Added two tests for http service and http whiteboard (which uses javax.servlet and wrappers as well) The first test simply verifies that unregistering works, the second test verifies that a custom wrapper class (extending ServletWrapper) works. Before the change the tests failed for the HttpService - they worked already for the whiteboard as the whiteboard was already always wrapping. Now, all tests pass > HttpService: Cannot unregister javaxwrappers.ServletWrapper > ----------------------------------------------------------- > > Key: FELIX-6745 > URL: https://issues.apache.org/jira/browse/FELIX-6745 > Project: Felix > Issue Type: Bug > Components: HTTP Service > Affects Versions: http.base-5.1.8, http.jetty-5.1.26, http.jetty12-1.0.19 > Reporter: Andreas Lemmer > Assignee: Carsten Ziegeler > Priority: Critical > Fix For: http.jetty12-1.0.20, http.jetty-5.1.28, http.base-5.1.10 > > > When (manually) registering an > {{org.apache.felix.http.javaxwrappers.ServletWrapper}} servlet at > {{{}org.osgi.service.http.HttpService{}}}, it cannot be unregistered anymore: > {{java.lang.ClassCastException: class (WrappedServlet) cannot be cast to > class org.apache.felix.http.jakartawrappers.ServletWrapper}} > {{at > org.apache.felix.http.base.internal.service.SharedHttpServiceImpl.getServlet(SharedHttpServiceImpl.java:117)}} > {{at > org.apache.felix.http.base.internal.service.SharedHttpServiceImpl.unregister(SharedHttpServiceImpl.java:100)}} > This is because registering the ServletWrapper actually registers the wrapped > servlet (see > {{{}org.apache.felix.http.jakartawrappers.ServletWrapper#getRegisteredServlet){}}}, > but unregistering assumes that the registered servlet is an > {{org.apache.felix.http.jakartawrappers.ServletWrapper}} (see > {{{}org.apache.felix.http.base.internal.service.{}}}{{{}SharedHttpServiceImpl{}}}{{{}#getServlet{}}} > where the CCE happens). -- This message was sent by Atlassian Jira (v8.20.10#820010)