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

IndexOutOfBoundsException in ConnectionClassManager #29

Open
lukaville opened this issue Feb 6, 2017 · 0 comments
Open

IndexOutOfBoundsException in ConnectionClassManager #29

lukaville opened this issue Feb 6, 2017 · 0 comments

Comments

@lukaville
Copy link

lukaville commented Feb 6, 2017

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)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant