Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-3706

Sling Resource Resolver - NPE with oak for vanity paths

    XMLWordPrintableJSON

Details

    Description

      The sling resource resolver fails on OAK if you add the sling:vanityPath property quasi-concurrently. Just add nodes and add the property in an automated way, without wait.
      This works on sling on jackrabbit, fails with oak.

      I get:

      23.06.2014 17:47:17.760 WARN [pool-5-thread-4] org.apache.felix.eventadmin Service [Map Entries Observation,2923] EventAdmin: Exception during event dispatch [org.osgi.service.event.Event [topic=org/apache/sling/api/resource/Resource/CHANGED] | [org.osgi.service.event.EventHandler] | Bundle(org.apache.sling.resourceresolver [217])] (java.lang.NullPointerException)
      java.lang.NullPointerException: null
      at org.apache.sling.resourceresolver.impl.mapping.MapEntries.loadVanityPath(MapEntries.java:748)
      at org.apache.sling.resourceresolver.impl.mapping.MapEntries.doAddVanity(MapEntries.java:292)
      at org.apache.sling.resourceresolver.impl.mapping.MapEntries.doAddAttributes(MapEntries.java:209)
      at org.apache.sling.resourceresolver.impl.mapping.MapEntries.handleEvent(MapEntries.java:505)
      at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:412)
      at org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:118)
      at org.apache.felix.eventadmin.impl.handler.EventAdminImpl.sendEvent(EventAdminImpl.java:114)
      at org.apache.felix.eventadmin.impl.security.EventAdminSecurityDecorator.sendEvent(EventAdminSecurityDecorator.java:96)
      at org.apache.sling.jcr.resource.internal.OakResourceListener.sendOsgiEvent(OakResourceListener.java:243)
      at org.apache.sling.jcr.resource.internal.OakResourceListener.changed(OakResourceListener.java:133)
      at org.apache.jackrabbit.oak.plugins.observation.NodeObserver$NodeEventHandler.leave(NodeObserver.java:204)
      at org.apache.jackrabbit.oak.plugins.observation.FilteredHandler.leave(FilteredHandler.java:51)
      at org.apache.jackrabbit.oak.plugins.observation.EventGenerator$Continuation.run(EventGenerator.java:154)
      at org.apache.jackrabbit.oak.plugins.observation.EventGenerator.generate(EventGenerator.java:98)
      at org.apache.jackrabbit.oak.plugins.observation.NodeObserver.contentChanged(NodeObserver.java:155)
      at org.apache.jackrabbit.oak.spi.commit.BackgroundObserver$1$1.call(BackgroundObserver.java:117)
      at org.apache.jackrabbit.oak.spi.commit.BackgroundObserver$1$1.call(BackgroundObserver.java:111)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:722)
      

      After debugging this, the problem is that resource is null in MapEntries.java:291 :

       private void doAddVanity(String path) {
              Resource resource = resolver.getResource(path);
              loadVanityPath(resource, resolveMapsMap, vanityTargets);
          }
      

      Introduced by r1605423

      Attachments

        Issue Links

          Activity

            People

              justinedelson Justin Edelson
              andrei.dulvac Andrei Dulvac
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: