Potential NullPointerException when initializing Components
-----------------------------------------------------------
Key: SLING-42
URL: https://issues.apache.org/jira/browse/SLING-42
Project: Sling
Issue Type: Bug
Components: Core
Affects Versions: 2.0.0
Reporter: Felix Meschberger
Fix For: 2.0.0
When a Component is registered with the system, the ComponentResolverFilter
gets them and if active calls the Component.init method. This may happen at a
time, that the ComponentRequestHandlerImpl is not registered yet with the
HttpService and thus the ServletContext is still null. If now the Component
init method tries to access the ServletContext of the provided
ComponentContext, a NullPointerException is thrown.
This whole registration mechanism must be modified such as to only call the
init methods when the ComponentRequestHandlerImpl is registered with the
HttpService and has itself been provided with the ServletConfig and
ServletContext of the servlet container.
This exception may be seen if the Sling sampl bundle is started before the
Sling core bundle.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.