nextcloud / nextcloud/talk-android
Crash when opening a Talk Room with non-emoji reactions
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 739
- Forks
- 321
- Avg merge
- 14h 59m
- Merged PRs (30d)
- 151
Description
Steps to reproduce
- Create a Chat Room
- Send a message
- Add a custom reaction in the format ":reaction:" (e.g. ":thank_you:") to that message (not possible via UI)
- Open the Chat Room in the Nextcloud Talk App
Expected behaviour
I can see the messages inside this room including reactions.
All other Nextcloud Talk Clients (Linux, Windows, Mac, iOS) work as expected.
Actual behaviour
Client Crashes with "AndroidRuntime: java.lang.NumberFormatException: For input string: "thank_you""
Device brand and model
Google Pixel 7a
Android version
16
Nextcloud Talk app version
23.0.0
Nextcloud server version
32.0.1
Talk version
22.0.2
Custom Signaling server configured
None
Custom TURN server configured
None
Custom STUN server configured
None
Android logs
--------- beginning of crash
03-12 14:26:57.239 585 6553 E AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-9
03-12 14:26:57.239 585 6553 E AndroidRuntime: Process: com.nextcloud.talk2, PID: 585
03-12 14:26:57.239 585 6553 E AndroidRuntime: java.lang.NumberFormatException: For input string: "thank_you"
03-12 14:26:57.239 585 6553 E AndroidRuntime: at java.lang.Integer.parseInt(Integer.java:781)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at java.lang.Integer.parseInt(Integer.java:897)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at com.nextcloud.talk.data.source.local.converters.LinkedHashMapConverter.stringToLinkedHashMap(LinkedHashMapConverter.kt:35)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at com.nextcloud.talk.data.database.dao.ChatMessagesDao_Impl.getChatMessageEntity$lambda$0(ChatMessagesDao_Impl.kt:1813)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at com.nextcloud.talk.data.database.dao.ChatMessagesDao_Impl.$r8$lambda$07hGBVKgd5tfEM1wFb7yfWBYYXM(Unknown Source:0)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at com.nextcloud.talk.data.database.dao.ChatMessagesDao_Impl$$ExternalSyntheticLambda8.invoke(D8$$SyntheticClass:0)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1.invokeSuspend(DBUtil.kt:173)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1.invoke(Unknown Source:8)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1.invoke(Unknown Source:4)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at androidx.room.coroutines.PassthroughConnectionPool$useConnection$2.invokeSuspend(PassthroughConnectionPool.kt:59)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at androidx.room.coroutines.PassthroughConnectionPool$useConnection$2.invoke(Unknown Source:8)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at androidx.room.coroutines.PassthroughConnectionPool$useConnection$2.invoke(Unknown Source:4)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndspatched(Undispatched.kt:66)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:43)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:165)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at androidx.room.coroutines.PassthroughConnectionPool.useConnection(PassthroughConnectionPool.kt:59)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at androidx.room.RoomConnectionManager.useConnection(RoomConnectionManager.android.kt:138)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at androidx.room.RoomDatabase.useConnection(RoomDatabase.android.kt:619)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$$inlined$compatCoroutineExecute$DBUtil__DBUtil_androidKt$1.invokeSuspend(DBUtil.android.kt:261)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1154)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:652)
03-12 14:26:57.239 585 6553 E AndroidRuntime: at java.lang.Thread.run(Thread.java:1563)
03-12 14:26:57.239 585 6553 E AndroidRuntime: Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@2e2dcb7, Dispatchers.IO]
Server log
Additional information
We migrated some Rooms from Mattermost to Nextcloud Talk, including reactions to messages. Since Mattermost does support custom emojis, while Talk doesn't yet, we had to migrate these in the following format: :emojiname:. For example :thank_you: or :1:. This works fine on the web and desktop clients:
On Android this leads to the crash described above.
This seems to be the relevant Code line: https://github.com/nextcloud/talk-android/blob/master/app/src/main/java/com/nextcloud/talk/data/source/local/converters/LinkedHashMapConverter.kt#L33
- the converter expects the reaction in the this format:
"👍:1" - the custom emoji/reaction will look like this:
":thank_you::1" - splitting these at
":"creates these lists respectively:["👍", "1"]and["", "thank_you", "","1"] - trying to convert the second string to an integer works for the first (
"1") example but crashes for the second ("thank_you").
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with app/src/main/java/com/nextcloud/talk/data/source/local/converters/LinkedHashMapConverter.kt around line 33 and trace how ChatMessagesDao reads reactions. Reproduce with a reaction such as :thank_you: and verify that opening the room no longer crashes and the reaction remains available to the client.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- database, mobile-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100