[ https://issues.apache.org/jira/browse/SLING-3706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14045986#comment-14045986 ]
Andrei Dulvac commented on SLING-3706: -------------------------------------- Looks like the event is processed before the resource is visible in the session. > Sling Resource Resolver - NPE with oak for vanity paths > ------------------------------------------------------- > > Key: SLING-3706 > URL: https://issues.apache.org/jira/browse/SLING-3706 > Project: Sling > Issue Type: Bug > Components: ResourceResolver > Affects Versions: Resource Resolver 1.1.2 > Reporter: Andrei Dulvac > Labels: oak > > 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: > {code} > 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) > {code} > After debugging this, the problem is that resource is null in > MapEntries.java:291 : > {code} > private void doAddVanity(String path) { > Resource resource = resolver.getResource(path); > loadVanityPath(resource, resolveMapsMap, vanityTargets); > } > {code} > Introduced by r1605423 -- This message was sent by Atlassian JIRA (v6.2#6252)