Sling
  1. Sling
  2. SLING-2222

SlingServerRepository startup and potential NPE

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: JCR Base 2.1.2
    • Component/s: JCR
    • Labels:
      None
    • Environment:
      Eclipse Equinox

      Description

      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.

        Activity

          People

          • Assignee:
            Justin Edelson
            Reporter:
            Aleksander Bandelj
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development