Crash while trying to order photos, to select which to upload
⚠️ Before posting ⚠️
- [x] This is a bug, not a question or an enhancement.
- [x] I've searched for similar issues and didn't find a duplicate.
- [x] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [x] I agree to follow Nextcloud's Code of Conduct.
Steps to reproduce
While on a folder, try to upload a file from the camera. Select the folder, and try to sort by the earliest first.
Expected behaviour
Photos are sorted in order, and I'm able to select photos to upload
Actual behaviour
A crash happens when sorting
Android version
16, 6.1.155-android14-11-g740e0d504e97
Device brand and model
Google Pixel 8 pro
Stock or custom OS?
Custom (explain in "additional information")
Nextcloud android app version
30340190
Nextcloud server version
Develop-32.0.2rc2-ls153
Using a reverse proxy?
Yes
Android logs
Cause of error
Exception in thread "pool-22-thread-1" java.util.ConcurrentModificationException
at java.util.ArrayList.sort(ArrayList.java:1823)
at java.util.Collections.sort(Collections.java:207)
at kotlin.collections.CollectionsKt__MutableCollectionsJVMKt.sortWith(MutableCollectionsJVM.kt:42)
at com.owncloud.android.utils.FileSortOrderByDate.sortLocalFiles(FileSortOrderByDate.kt:51)
at com.owncloud.android.ui.adapter.LocalFileListAdapter.lambda$setSortOrder$6(LocalFileListAdapter.java:392)
at com.owncloud.android.ui.adapter.LocalFileListAdapter.$r8$lambda$WTDJyclhOx9wYl9P9c9Mv0A876o(Unknown Source:0)
at com.owncloud.android.ui.adapter.LocalFileListAdapter$$ExternalSyntheticLambda3.run(D8$$SyntheticClass:0)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1154)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:652)
at java.lang.Thread.run(Thread.java:1365)
App information
- ID:
com.nextcloud.client - Version:
30340190 - Build flavor:
generic
Device information
- Brand:
google - Device:
husky - Model:
Pixel 8 Pro - Id:
BP3A.251105.015 - Product:
husky
Firmware
- SDK:
36 - Release:
16 - Incremental:
2025112100
Server error logs
Additional information
I'm using GrapheneOS on a pixel 8 pro. I wasn't being able to upload a file through the gallery, so I tried using the app. When trying to organize the files, it crashed.
Hi, I have the same issue:
Exception in thread "pool-30-thread-1" java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1111)
at java.util.ArrayList$Itr.next(ArrayList.java:1064)
at com.owncloud.android.utils.FileSortOrderBySize.sortLocalFiles(FileSortOrderBySize.kt:62)
at com.owncloud.android.ui.adapter.LocalFileListAdapter.lambda$setSortOrder$6(LocalFileListAdapter.java:392)
at com.owncloud.android.ui.adapter.LocalFileListAdapter.$r8$lambda$WTDJyclhOx9wYl9P9c9Mv0A876o(Unknown Source:0)
at com.owncloud.android.ui.adapter.LocalFileListAdapter$$ExternalSyntheticLambda3.run(D8$$SyntheticClass:0)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651)
at java.lang.Thread.run(Thread.java:1119)
App information
- ID: com.nextcloud.client
- Version: 30340190
- Build flavor: gplay
Device information
- Brand: realme
- Device: RE879AL1
- Model: RMX3370
- Id: TP1A.220905.001
- Product: RMX3370EEA
Firmware
- SDK: 33
- Release: 13
- Incremental: R.206ce3e_1-5e895b
I guess my crash is the same bug. I did not change order of the files while browsing them but the crash log is very similar to yours.
Cause of error
Exception in thread "pool-33-thread-1" java.util.ConcurrentModificationException
at java.util.ArrayList.sort(ArrayList.java:1823)
at java.util.Collections.sort(Collections.java:207)
at kotlin.collections.CollectionsKt__MutableCollectionsJVMKt.sortWith(MutableCollectionsJVM.kt:42)
at com.owncloud.android.utils.FileSortOrderByName.sortLocalFiles(FileSortOrderByName.kt:60)
at com.owncloud.android.ui.adapter.LocalFileListAdapter.lambda$setSortOrder$6(LocalFileListAdapter.java:392)
at com.owncloud.android.ui.adapter.LocalFileListAdapter.$r8$lambda$WTDJyclhOx9wYl9P9c9Mv0A876o(Unknown Source:0)
at com.owncloud.android.ui.adapter.LocalFileListAdapter$$ExternalSyntheticLambda3.run(D8$$SyntheticClass:0)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651)
at java.lang.Thread.run(Thread.java:1119)
App information
- ID:
com.nextcloud.client - Version:
30340190 - Build flavor:
generic
Device information
- Brand:
motorola - Device:
vienna - Model:
motorola edge 50 neo - Id:
V2UI35.43-12-4 - Product:
vienna_g_syses
Firmware
- SDK:
35 - Release:
15 - Incremental:
a7c798-0307d
Interestingly enough, I insisted several times, and eventually, I was able to upload the files. But I had to insist quite a bit.
Maybe this is an interesting question to both of you @leomirz7 and @Discostu36 , do you have large collections of photos? In my case, I have over 1400 photos in my gallery.
While the ConcurrentModificationException seems to direct me to a threading issue, I was wondering if this only happens in larger collections of photos.
In my case, it was not a photo at all, I was selecting a PDF. And there were not many files in the folder
This looks like the same bug as #15969 to me.
It resembles yes, should I close this one and track through that?
Same here, while uploading the photo. The sort order drop down is set to "newest first", but the actual sorting is oldest first. If I try to sort it again, the app crashes with the error below, whether I choose "newest first" or any order.
Cause of error
Exception in thread "pool-17-thread-1" java.util.ConcurrentModificationException
at java.util.ArrayList.sort(ArrayList.java:1823)
at java.util.Collections.sort(Collections.java:207)
at kotlin.collections.CollectionsKt__MutableCollectionsJVMKt.sortWith(MutableCollectionsJVM.kt:42)
at com.owncloud.android.utils.FileSortOrderByDate.sortLocalFiles(FileSortOrderByDate.kt:51)
at com.owncloud.android.ui.adapter.LocalFileListAdapter.lambda$setSortOrder$6(LocalFileListAdapter.java:392)
at com.owncloud.android.ui.adapter.LocalFileListAdapter.$r8$lambda$WTDJyclhOx9wYl9P9c9Mv0A876o(Unknown Source:0)
at com.owncloud.android.ui.adapter.LocalFileListAdapter$$ExternalSyntheticLambda3.run(D8$$SyntheticClass:0)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651)
at java.lang.Thread.run(Thread.java:1119)
App information
- ID:
com.nextcloud.client - Version:
30340190 - Build flavor:
gplay
Device information
- Brand:
TCL - Device:
Firefly - Model:
T771K - Id:
UP1A.231005.007 - Product:
T771K3_EEA
Firmware
- SDK:
34 - Release:
14 - Incremental:
YIBF