Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-8948

ObservationManager.addEventListener() throws NPE with invalid paths in filter

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.17, 1.8.20
    • Fix Version/s: 1.26.0
    • Component/s: jcr
    • Labels:

      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.

        Attachments

        1. OAK-8948.patch
          1 kB
          Marcel Reutegger
        2. OAK-8948-1.patch
          5 kB
          Marcel Reutegger
        3. Screen Shot 2020-03-13 at 2.25.07 PM.png
          103 kB
          rafiya sirin
        4. stacktrace.txt
          7 kB
          rafiya sirin

          Activity

            People

            • Assignee:
              mreutegg Marcel Reutegger
              Reporter:
              sirin rafiya sirin
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: