Chetan Mehrotra created SLING-4847:
--------------------------------------

             Summary: NullPointerException in MapEntries handleEvent
                 Key: SLING-4847
                 URL: https://issues.apache.org/jira/browse/SLING-4847
             Project: Sling
          Issue Type: Bug
          Components: ResourceResolver
    Affects Versions: Resource Resolver 1.1.14
            Reporter: Chetan Mehrotra
            Priority: Minor


On a running system at times following exceptions are seen

{noformat}
30.06.2015 09:00:34.108 *WARN* [pool-5-thread-115] org.apache.felix.eventadmin 
Service [Map Entries Observation,1094] EventAdmin: Exception during event 
dispatch [org.osgi.service.event.Event 
[topic=org/apache/sling/api/resource/Resource/ADDED] | 
[org.osgi.service.event.EventHandler] | 
Bundle(org.apache.sling.resourceresolver [211])] 
(java.lang.NullPointerException)
java.lang.NullPointerException: null
        at 
org.apache.sling.resourceresolver.impl.mapping.MapEntries.doNodeAdded(MapEntries.java:300)
        at 
org.apache.sling.resourceresolver.impl.mapping.MapEntries.handleEvent(MapEntries.java:769)
        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.added(OakResourceListener.java:109)
        at 
org.apache.jackrabbit.oak.plugins.observation.NodeObserver$NodeEventHandler.leave(NodeObserver.java:209)
        at 
org.apache.jackrabbit.oak.plugins.observation.FilteredHandler.leave(FilteredHandler.java:51)
        at 
org.apache.jackrabbit.oak.plugins.observation.EventGenerator$Continuation.run(EventGenerator.java:182)
        at 
org.apache.jackrabbit.oak.plugins.observation.EventGenerator.generate(EventGenerator.java:124)
        at 
org.apache.jackrabbit.oak.plugins.observation.NodeObserver.contentChanged(NodeObserver.java:163)
        at 
org.apache.jackrabbit.oak.spi.commit.BackgroundObserver$1$1.call(BackgroundObserver.java:124)
        at 
org.apache.jackrabbit.oak.spi.commit.BackgroundObserver$1$1.call(BackgroundObserver.java:118)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        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:745)
{noformat}

Looking at 
[code|https://github.com/apache/sling/blob/a3f25af5da1edb9f2719f04b560370c5cb6464c3/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java#L299]
 the resource might be null by the time event is processed. So code should 
guard against that



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to