pusher/chatkit-android

app is crashing while fetching more messages.

Closed this issue · 4 comments

java.lang.ArrayIndexOutOfBoundsException: length=10; index=10
                                                 at java.util.ArrayList.add(ArrayList.java:468)
                                                 at com.pusher.chatkit.ChatManager.subscribeResuming$chatkit_core(ChatManager.kt:160)
                                                 at com.pusher.chatkit.cursors.CursorService.createSubscription(CursorService.kt:72)
                                                 at com.pusher.chatkit.cursors.CursorService.subscribeForRoom(CursorService.kt:64)
                                                 at com.pusher.chatkit.rooms.RoomSubscription.<init>(RoomSubscription.kt:42)
                                                 at com.pusher.chatkit.rooms.RoomService.subscribeToRoom(RoomService.kt:79)
                                                 at com.pusher.chatkit.CurrentUser.subscribeToRoom(CurrentUser.kt:139)
                                                 at com.pusher.chatkit.CurrentUser.subscribeToRoom(CurrentUser.kt:123)
                                                 at wellthy.care.pusher.ApiPusherChatActivity$bind$1.doResume(ApiPusherChatActivity.kt:263)
                                                 at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:54)
                                                 at kotlinx.coroutines.experimental.DispatchedTask$DefaultImpls.run(Dispatched.kt:161)
                                                 at kotlinx.coroutines.experimental.DispatchedContinuation.run(Dispatched.kt:25)
                                                 at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1412)
                                                 at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:285)
                                                 at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1152)
                                                 at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1990)
                                                 at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1938)
                                                 at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

As far as I know we're not using any ArrayLists in the SDK so that error looks like it's something coming from your app.

MutableList (subscriptions in this case: ChatManager:160) is actually an ArrayList when it gets compiled. That said, there is no possible way that calling the add (or plus-equals) function can cause that. The line in question has a += operator that is translated into an add method call: MutableCollections:64

The add method in ArrayList doesn't throw such exception: ArrayList#add. Is that the complete stacktrace? Also, the line the trace mentions is a comment on this version, what version of the JVM are you using?

i think i am using java 8.however pusher is not working in offline. it crash the app everytime..

Hi, closing this issue as there has not been any activity in some time. If this is still an issue please contact support@pusher.com, and they can give you more direct help 🙂