[ https://issues.apache.org/jira/browse/FELIX-5199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15168648#comment-15168648 ]
David Bosschaert commented on FELIX-5199: ----------------------------------------- Thanks for the feedback, [~cziegeler]. I didn't think of checking for the other objects as {{PerBundleHttpServiceImpl}} only seems to require the Bundle and the ServletContext to be non-null. As this is a service factory which is called by the framework the Bundle can never be null... I agree that a started/stopped flag would cover the overall case. Let me rework the patch for that... > Race condition in HttpServiceFactory.getService() causing exception > ------------------------------------------------------------------- > > Key: FELIX-5199 > URL: https://issues.apache.org/jira/browse/FELIX-5199 > Project: Felix > Issue Type: Bug > Components: HTTP Service > Affects Versions: http.base-3.0.6 > Reporter: David Bosschaert > Assignee: David Bosschaert > Attachments: felix-5199.patch > > > The HttpServiceFactory.getService() is as follows: > {code} > public HttpService getService(final Bundle bundle, final > ServiceRegistration<HttpService> reg) > { > final ServletContext servletContext = this.context; > if ( servletContext != null ) { > return new PerBundleHttpServiceImpl(bundle, > this.sharedHttpService, > this.context, > this.contextAttributeListenerManager, > this.sharedContextAttributes, > this.requestListenerManager, > this.requestAttributeListenerManager); > } > return null; > }{code} > However it is possible that this.context is set to {{null}} after the check > for {{null}} is done but before the constructor is called causing a null > servlet context to be passed to {{PerBundleHttpServiceImpl}} -- This message was sent by Atlassian JIRA (v6.3.4#6332)