You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Karl Pauls (JIRA)" <ji...@apache.org> on 2018/10/10 22:01:00 UTC

[jira] [Updated] (SLING-8006) IndexOutOfBoundsException in ResourceProviderTracker.setObservationReporterGenerator

     [ https://issues.apache.org/jira/browse/SLING-8006?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Karl Pauls updated SLING-8006:
------------------------------
    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:


{noformat}
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) 
{noformat}

  was:
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.


> IndexOutOfBoundsException in ResourceProviderTracker.setObservationReporterGenerator
> ------------------------------------------------------------------------------------
>
>                 Key: SLING-8006
>                 URL: https://issues.apache.org/jira/browse/SLING-8006
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: Resource Resolver 1.6.6
>            Reporter: Karl Pauls
>            Assignee: Karl Pauls
>            Priority: Major
>             Fix For: Resource Resolver 1.6.8
>
>
> 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:
> {noformat}
> 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) 
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)