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

IndexOutOfBoundsException in ResourceProviderTracker.setObservationReporterGenerator

    XMLWordPrintableJSON

    Details

      Description

      When a ResourceProvider goes away while being activated, we remove it from the list of handlers for a given path. However, we don't remove the empty list of handlers in the case where it was the only available handler for a given path.

      That can lead to a problem later on where we assume that if we have a list of handlers for a path it will at least contain one handler (and just use .get(0)). This happens in the ResourceProviderTracker.setObservationReporterGenerator method and will cause IOOB Exceptions from that point onwards.

      Looks like this:

      java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
              at java.util.ArrayList.rangeCheck(ArrayList.java:657)
              at java.util.ArrayList.get(ArrayList.java:433)
              at org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker.setObservationReporterGenerator(ResourceProviderTracker.java:155) 
              at org.apache.sling.resourceresolver.impl.observation.ResourceChangeListenerWhiteboard.updateProviderTracker(ResourceChangeListenerWhiteboard.java:109) 
              at org.apache.sling.resourceresolver.impl.observation.ResourceChangeListenerWhiteboard.access$100(ResourceChangeListenerWhiteboard.java:44) 
              at org.apache.sling.resourceresolver.impl.observation.ResourceChangeListenerWhiteboard$1.addingService(ResourceChangeListenerWhiteboard.java:88) 
              at org.apache.sling.resourceresolver.impl.observation.ResourceChangeListenerWhiteboard$1.addingService(ResourceChangeListenerWhiteboard.java:64) 
      

        Attachments

          Activity

            People

            • Assignee:
              karlpauls Karl Pauls
              Reporter:
              karlpauls Karl Pauls
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: