You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2007/10/05 10:55:50 UTC

[jira] Created: (SLING-42) Potential NullPointerException when initializing Components

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.


[jira] Assigned: (SLING-42) Potential NullPointerException when initializing Components

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-42?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned SLING-42:
--------------------------------------

    Assignee: Felix Meschberger

> 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
>            Assignee: 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.


[jira] Closed: (SLING-42) Potential NullPointerException when initializing Components

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-42?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger closed SLING-42.
----------------------------------

    Resolution: Fixed

Fixed by reorganizing the order in which the ComponentRequestHandlerImpl is activated. Now servlet is first registered with the HttpService and only after that is are the registered Component Filters initialized.

Fixed in Rev. 582254.

> 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
>            Assignee: 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.