You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Aleksander Bandelj (JIRA)" <ji...@apache.org> on 2011/09/15 20:06:09 UTC

[jira] [Created] (SLING-2222) SlingServerRepository startup and potential NPE

SlingServerRepository startup and potential NPE
-----------------------------------------------

                 Key: SLING-2222
                 URL: https://issues.apache.org/jira/browse/SLING-2222
             Project: Sling
          Issue Type: Bug
          Components: JCR
         Environment: Eclipse Equinox
            Reporter: Aleksander Bandelj
            Priority: Minor


I'm starting Sling bundles from Equinox and there is now a NPE when starting repository (doesn't seem to happen in launchpad, probably because component and bundle activation order is different there). AbstractNamespaceMappingRepository#namespaceMapperTracker is used before initialized with #setup.	

SlingServerRepository(AbstractNamespaceMappingRepository).defineNamespacePrefixes(Session) line: 65	
SlingServerRepository(AbstractNamespaceMappingRepository).getNamespaceAwareSession(Session) line: 92	
SlingServerRepository(AbstractSlingRepository).login(Credentials, String) line: 216	
SlingServerRepository(AbstractSlingRepository).loginAdministrative(String) line: 171	
SlingServerRepository(AbstractSlingRepository).pingAndCheck() line: 499	
SlingServerRepository(AbstractSlingRepository).startRepository() line: 755	
SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581

the above will hit SlingServerRepository before #setup is called. #setup will be called second time around:

SlingServerRepository(AbstractNamespaceMappingRepository).setup(BundleContext) line: 46	
SlingServerRepository(AbstractSlingRepository).setupRepository(Repository) line: 426	
SlingServerRepository(AbstractSlingRepository).startRepository() line: 758	
SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581	

I've added NPE check for namespaceMapperTracker in defineNamespacePrefixes which works around this issue. NPE check for other namespaceHandler is already present.

I would be good to simplify repository pinging code path and avoid the NPE checks though.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2222) SlingServerRepository startup and potential NPE

Posted by "Justin Edelson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13106529#comment-13106529 ] 

Justin Edelson commented on SLING-2222:
---------------------------------------

...which would be an API change.

> SlingServerRepository startup and potential NPE
> -----------------------------------------------
>
>                 Key: SLING-2222
>                 URL: https://issues.apache.org/jira/browse/SLING-2222
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>         Environment: Eclipse Equinox
>            Reporter: Aleksander Bandelj
>            Assignee: Justin Edelson
>            Priority: Minor
>             Fix For: JCR Base 2.1.2
>
>
> I'm starting Sling bundles from Equinox and there is now a NPE when starting repository (doesn't seem to happen in launchpad, probably because component and bundle activation order is different there). AbstractNamespaceMappingRepository#namespaceMapperTracker is used before initialized with #setup.	
> SlingServerRepository(AbstractNamespaceMappingRepository).defineNamespacePrefixes(Session) line: 65	
> SlingServerRepository(AbstractNamespaceMappingRepository).getNamespaceAwareSession(Session) line: 92	
> SlingServerRepository(AbstractSlingRepository).login(Credentials, String) line: 216	
> SlingServerRepository(AbstractSlingRepository).loginAdministrative(String) line: 171	
> SlingServerRepository(AbstractSlingRepository).pingAndCheck() line: 499	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 755	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581
> the above will hit SlingServerRepository before #setup is called. #setup will be called second time around:
> SlingServerRepository(AbstractNamespaceMappingRepository).setup(BundleContext) line: 46	
> SlingServerRepository(AbstractSlingRepository).setupRepository(Repository) line: 426	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 758	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581	
> I've added NPE check for namespaceMapperTracker in defineNamespacePrefixes which works around this issue. NPE check for other namespaceHandler is already present.
> I would be good to simplify repository pinging code path and avoid the NPE checks though.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (SLING-2222) SlingServerRepository startup and potential NPE

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

Justin Edelson resolved SLING-2222.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: JCR Base 2.1.2

fixed in r1171235.

BTW, it'd be great if you could post a Wiki page about running Sling on Equinox.

> SlingServerRepository startup and potential NPE
> -----------------------------------------------
>
>                 Key: SLING-2222
>                 URL: https://issues.apache.org/jira/browse/SLING-2222
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>         Environment: Eclipse Equinox
>            Reporter: Aleksander Bandelj
>            Assignee: Justin Edelson
>            Priority: Minor
>             Fix For: JCR Base 2.1.2
>
>
> I'm starting Sling bundles from Equinox and there is now a NPE when starting repository (doesn't seem to happen in launchpad, probably because component and bundle activation order is different there). AbstractNamespaceMappingRepository#namespaceMapperTracker is used before initialized with #setup.	
> SlingServerRepository(AbstractNamespaceMappingRepository).defineNamespacePrefixes(Session) line: 65	
> SlingServerRepository(AbstractNamespaceMappingRepository).getNamespaceAwareSession(Session) line: 92	
> SlingServerRepository(AbstractSlingRepository).login(Credentials, String) line: 216	
> SlingServerRepository(AbstractSlingRepository).loginAdministrative(String) line: 171	
> SlingServerRepository(AbstractSlingRepository).pingAndCheck() line: 499	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 755	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581
> the above will hit SlingServerRepository before #setup is called. #setup will be called second time around:
> SlingServerRepository(AbstractNamespaceMappingRepository).setup(BundleContext) line: 46	
> SlingServerRepository(AbstractSlingRepository).setupRepository(Repository) line: 426	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 758	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581	
> I've added NPE check for namespaceMapperTracker in defineNamespacePrefixes which works around this issue. NPE check for other namespaceHandler is already present.
> I would be good to simplify repository pinging code path and avoid the NPE checks though.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (SLING-2222) SlingServerRepository startup and potential NPE

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

Carsten Ziegeler closed SLING-2222.
-----------------------------------

    
> SlingServerRepository startup and potential NPE
> -----------------------------------------------
>
>                 Key: SLING-2222
>                 URL: https://issues.apache.org/jira/browse/SLING-2222
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>         Environment: Eclipse Equinox
>            Reporter: Aleksander Bandelj
>            Assignee: Justin Edelson
>            Priority: Minor
>             Fix For: JCR Base 2.1.2
>
>
> I'm starting Sling bundles from Equinox and there is now a NPE when starting repository (doesn't seem to happen in launchpad, probably because component and bundle activation order is different there). AbstractNamespaceMappingRepository#namespaceMapperTracker is used before initialized with #setup.	
> SlingServerRepository(AbstractNamespaceMappingRepository).defineNamespacePrefixes(Session) line: 65	
> SlingServerRepository(AbstractNamespaceMappingRepository).getNamespaceAwareSession(Session) line: 92	
> SlingServerRepository(AbstractSlingRepository).login(Credentials, String) line: 216	
> SlingServerRepository(AbstractSlingRepository).loginAdministrative(String) line: 171	
> SlingServerRepository(AbstractSlingRepository).pingAndCheck() line: 499	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 755	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581
> the above will hit SlingServerRepository before #setup is called. #setup will be called second time around:
> SlingServerRepository(AbstractNamespaceMappingRepository).setup(BundleContext) line: 46	
> SlingServerRepository(AbstractSlingRepository).setupRepository(Repository) line: 426	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 758	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581	
> I've added NPE check for namespaceMapperTracker in defineNamespacePrefixes which works around this issue. NPE check for other namespaceHandler is already present.
> I would be good to simplify repository pinging code path and avoid the NPE checks though.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2222) SlingServerRepository startup and potential NPE

Posted by "Aleksander Bandelj (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13105995#comment-13105995 ] 

Aleksander Bandelj commented on SLING-2222:
-------------------------------------------

I agree, those NPE checks are not smelling good.I think  AbstractSlingRepository#setup should be the first thing called in AbstractSlingRepository#activate, not indirectly through #setupRepository in its superclass.

> SlingServerRepository startup and potential NPE
> -----------------------------------------------
>
>                 Key: SLING-2222
>                 URL: https://issues.apache.org/jira/browse/SLING-2222
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>         Environment: Eclipse Equinox
>            Reporter: Aleksander Bandelj
>            Assignee: Justin Edelson
>            Priority: Minor
>             Fix For: JCR Base 2.1.2
>
>
> I'm starting Sling bundles from Equinox and there is now a NPE when starting repository (doesn't seem to happen in launchpad, probably because component and bundle activation order is different there). AbstractNamespaceMappingRepository#namespaceMapperTracker is used before initialized with #setup.	
> SlingServerRepository(AbstractNamespaceMappingRepository).defineNamespacePrefixes(Session) line: 65	
> SlingServerRepository(AbstractNamespaceMappingRepository).getNamespaceAwareSession(Session) line: 92	
> SlingServerRepository(AbstractSlingRepository).login(Credentials, String) line: 216	
> SlingServerRepository(AbstractSlingRepository).loginAdministrative(String) line: 171	
> SlingServerRepository(AbstractSlingRepository).pingAndCheck() line: 499	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 755	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581
> the above will hit SlingServerRepository before #setup is called. #setup will be called second time around:
> SlingServerRepository(AbstractNamespaceMappingRepository).setup(BundleContext) line: 46	
> SlingServerRepository(AbstractSlingRepository).setupRepository(Repository) line: 426	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 758	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581	
> I've added NPE check for namespaceMapperTracker in defineNamespacePrefixes which works around this issue. NPE check for other namespaceHandler is already present.
> I would be good to simplify repository pinging code path and avoid the NPE checks though.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2222) SlingServerRepository startup and potential NPE

Posted by "Justin Edelson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13106187#comment-13106187 ] 

Justin Edelson commented on SLING-2222:
---------------------------------------

I didn't see a good way to do that without an API change which didn't seem warranted. AFAIK, there's a single code path (when the login is attempted from inside the ping check) which can cause this. Plus, even with the API change, the value could still be null. That said, feel free to reopen.

> SlingServerRepository startup and potential NPE
> -----------------------------------------------
>
>                 Key: SLING-2222
>                 URL: https://issues.apache.org/jira/browse/SLING-2222
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>         Environment: Eclipse Equinox
>            Reporter: Aleksander Bandelj
>            Assignee: Justin Edelson
>            Priority: Minor
>             Fix For: JCR Base 2.1.2
>
>
> I'm starting Sling bundles from Equinox and there is now a NPE when starting repository (doesn't seem to happen in launchpad, probably because component and bundle activation order is different there). AbstractNamespaceMappingRepository#namespaceMapperTracker is used before initialized with #setup.	
> SlingServerRepository(AbstractNamespaceMappingRepository).defineNamespacePrefixes(Session) line: 65	
> SlingServerRepository(AbstractNamespaceMappingRepository).getNamespaceAwareSession(Session) line: 92	
> SlingServerRepository(AbstractSlingRepository).login(Credentials, String) line: 216	
> SlingServerRepository(AbstractSlingRepository).loginAdministrative(String) line: 171	
> SlingServerRepository(AbstractSlingRepository).pingAndCheck() line: 499	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 755	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581
> the above will hit SlingServerRepository before #setup is called. #setup will be called second time around:
> SlingServerRepository(AbstractNamespaceMappingRepository).setup(BundleContext) line: 46	
> SlingServerRepository(AbstractSlingRepository).setupRepository(Repository) line: 426	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 758	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581	
> I've added NPE check for namespaceMapperTracker in defineNamespacePrefixes which works around this issue. NPE check for other namespaceHandler is already present.
> I would be good to simplify repository pinging code path and avoid the NPE checks though.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2222) SlingServerRepository startup and potential NPE

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

Felix Meschberger commented on SLING-2222:
------------------------------------------

You can rename the two -- setup and teardown -- methods in the AbstractNamespaceMappingRepository and call them from the AbstractSlingRepository activator ?

> SlingServerRepository startup and potential NPE
> -----------------------------------------------
>
>                 Key: SLING-2222
>                 URL: https://issues.apache.org/jira/browse/SLING-2222
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>         Environment: Eclipse Equinox
>            Reporter: Aleksander Bandelj
>            Assignee: Justin Edelson
>            Priority: Minor
>             Fix For: JCR Base 2.1.2
>
>
> I'm starting Sling bundles from Equinox and there is now a NPE when starting repository (doesn't seem to happen in launchpad, probably because component and bundle activation order is different there). AbstractNamespaceMappingRepository#namespaceMapperTracker is used before initialized with #setup.	
> SlingServerRepository(AbstractNamespaceMappingRepository).defineNamespacePrefixes(Session) line: 65	
> SlingServerRepository(AbstractNamespaceMappingRepository).getNamespaceAwareSession(Session) line: 92	
> SlingServerRepository(AbstractSlingRepository).login(Credentials, String) line: 216	
> SlingServerRepository(AbstractSlingRepository).loginAdministrative(String) line: 171	
> SlingServerRepository(AbstractSlingRepository).pingAndCheck() line: 499	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 755	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581
> the above will hit SlingServerRepository before #setup is called. #setup will be called second time around:
> SlingServerRepository(AbstractNamespaceMappingRepository).setup(BundleContext) line: 46	
> SlingServerRepository(AbstractSlingRepository).setupRepository(Repository) line: 426	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 758	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581	
> I've added NPE check for namespaceMapperTracker in defineNamespacePrefixes which works around this issue. NPE check for other namespaceHandler is already present.
> I would be good to simplify repository pinging code path and avoid the NPE checks though.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (SLING-2222) SlingServerRepository startup and potential NPE

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

Justin Edelson reassigned SLING-2222:
-------------------------------------

    Assignee: Justin Edelson

> SlingServerRepository startup and potential NPE
> -----------------------------------------------
>
>                 Key: SLING-2222
>                 URL: https://issues.apache.org/jira/browse/SLING-2222
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>         Environment: Eclipse Equinox
>            Reporter: Aleksander Bandelj
>            Assignee: Justin Edelson
>            Priority: Minor
>
> I'm starting Sling bundles from Equinox and there is now a NPE when starting repository (doesn't seem to happen in launchpad, probably because component and bundle activation order is different there). AbstractNamespaceMappingRepository#namespaceMapperTracker is used before initialized with #setup.	
> SlingServerRepository(AbstractNamespaceMappingRepository).defineNamespacePrefixes(Session) line: 65	
> SlingServerRepository(AbstractNamespaceMappingRepository).getNamespaceAwareSession(Session) line: 92	
> SlingServerRepository(AbstractSlingRepository).login(Credentials, String) line: 216	
> SlingServerRepository(AbstractSlingRepository).loginAdministrative(String) line: 171	
> SlingServerRepository(AbstractSlingRepository).pingAndCheck() line: 499	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 755	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581
> the above will hit SlingServerRepository before #setup is called. #setup will be called second time around:
> SlingServerRepository(AbstractNamespaceMappingRepository).setup(BundleContext) line: 46	
> SlingServerRepository(AbstractSlingRepository).setupRepository(Repository) line: 426	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 758	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581	
> I've added NPE check for namespaceMapperTracker in defineNamespacePrefixes which works around this issue. NPE check for other namespaceHandler is already present.
> I would be good to simplify repository pinging code path and avoid the NPE checks though.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2222) SlingServerRepository startup and potential NPE

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

Felix Meschberger commented on SLING-2222:
------------------------------------------

Hmm, I think the AbstarctSlingRepository should actually setup and tear down  the AbstractNamespaceMappingRepository from within the activate and deactivate methods and not when the repository is actually set up.

> SlingServerRepository startup and potential NPE
> -----------------------------------------------
>
>                 Key: SLING-2222
>                 URL: https://issues.apache.org/jira/browse/SLING-2222
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>         Environment: Eclipse Equinox
>            Reporter: Aleksander Bandelj
>            Assignee: Justin Edelson
>            Priority: Minor
>             Fix For: JCR Base 2.1.2
>
>
> I'm starting Sling bundles from Equinox and there is now a NPE when starting repository (doesn't seem to happen in launchpad, probably because component and bundle activation order is different there). AbstractNamespaceMappingRepository#namespaceMapperTracker is used before initialized with #setup.	
> SlingServerRepository(AbstractNamespaceMappingRepository).defineNamespacePrefixes(Session) line: 65	
> SlingServerRepository(AbstractNamespaceMappingRepository).getNamespaceAwareSession(Session) line: 92	
> SlingServerRepository(AbstractSlingRepository).login(Credentials, String) line: 216	
> SlingServerRepository(AbstractSlingRepository).loginAdministrative(String) line: 171	
> SlingServerRepository(AbstractSlingRepository).pingAndCheck() line: 499	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 755	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581
> the above will hit SlingServerRepository before #setup is called. #setup will be called second time around:
> SlingServerRepository(AbstractNamespaceMappingRepository).setup(BundleContext) line: 46	
> SlingServerRepository(AbstractSlingRepository).setupRepository(Repository) line: 426	
> SlingServerRepository(AbstractSlingRepository).startRepository() line: 758	
> SlingServerRepository(AbstractSlingRepository).activate(ComponentContext) line: 581	
> I've added NPE check for namespaceMapperTracker in defineNamespacePrefixes which works around this issue. NPE check for other namespaceHandler is already present.
> I would be good to simplify repository pinging code path and avoid the NPE checks though.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira