Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.8.17, 1.8.20
Description
While registering a resource change listener, we encountered the following exception :
05.03.2020 23:39:00.728 *ERROR* [FelixDispatchQueue] org.apache.sling.resourceresolver FrameworkEvent ERROR (java.lang.NullPointerException)
java.lang.NullPointerException: null
at org.apache.jackrabbit.oak.commons.PathUtils.unifyInExcludes(PathUtils.java:501) [org.apache.jackrabbit.oak-commons:1.8.17]
at org.apache.jackrabbit.oak.jcr.observation.ObservationManagerImpl.addEventListener(ObservationManagerImpl.java:240) [org.apache.jackrabbit.oak-jcr:1.8.17]
at org.apache.sling.jcr.resource.internal.JcrListenerBaseConfig.register(JcrListenerBaseConfig.java:136) [org.apache.sling.jcr.resource:3.0.16.1]
On further debugging, we found that issues lies in this snippet :
if (exclude.equals(include) || isAncestor(exclude, include)) {
includesRemoved.add(include);
'exclude' can be null if the getOakPath() method returns a null. This NPE causes listeners(ResourceChangeListener in our case) to fail at registration.