Skip to content
This repository was archived by the owner on Mar 3, 2020. It is now read-only.
This repository was archived by the owner on Mar 3, 2020. It is now read-only.

IndexOutOfBoundsException in ConnectionClassManager #29

@lukaville

Description

@lukaville

ConnectionClassManager sometimes throws IndexOutOfBoundException here: https://github.com/facebook/network-connection-class/blob/master/connectionclass/src/main/java/com/facebook/network/connectionclass/ConnectionClassManager.java#L245

Access to mListenerList is not synchronized and it is accessed from at least two different threads: ParseThread handler thread and thread where register/remove listener methods called (usually main thread).

This sometimes causes crashes:

Fatal Exception: java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1
       at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
       at java.util.ArrayList.get(ArrayList.java:308)
       at com.facebook.network.connectionclass.ConnectionClassManager.notifyListeners(ConnectionClassManager.java:1205)
       at com.facebook.network.connectionclass.DeviceBandwidthSampler$SamplingHandler.addSample(DeviceBandwidthSampler.java:121)
       at com.facebook.network.connectionclass.DeviceBandwidthSampler$SamplingHandler.handleMessage(DeviceBandwidthSampler.java:100)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:136)
       at android.os.HandlerThread.run(HandlerThread.java:61)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions