nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.28k stars 1.77k forks source link

Exception in thread "AsyncTask" on FileSortOrderByName #11049

Closed UteHaus closed 1 year ago

UteHaus commented 1 year ago

⚠️ Before posting ⚠️

Steps to reproduce

Swap down on the folder view, to update the list. Or switch from settings to list view.

Expected behaviour

The app not break.

Actual behaviour

The app crashes when updating the list of files.

Android version

30220390

Device brand and model

pixle 4

Stock or custom OS?

Custom (explain in "additional information")

Nextcloud android app version

3.22.3

Nextcloud server version

25.0.1

Using a reverse proxy?

No

Android logs

Cause of error

Exception in thread "AsyncTask #20" java.lang.RuntimeException: An error occurred while executing doInBackground()
    at android.os.AsyncTask$4.done(AsyncTask.java:415)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
    at java.util.concurrent.FutureTask.run(FutureTask.java:271)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:920)
Caused by: Exception in thread "AsyncTask #20" java.util.ConcurrentModificationException
    at java.util.ArrayList.sort(ArrayList.java:1472)
    at java.util.Collections.sort(Collections.java:206)
    at kotlin.collections.CollectionsKt__MutableCollectionsJVMKt.sortWith(MutableCollectionsJVM.kt:42)
    at com.owncloud.android.utils.FileSortOrderByName.sortServerFiles(FileSortOrderByName.kt:58)
    at com.owncloud.android.utils.FileSortOrderByName.sortCloudFiles(FileSortOrderByName.kt:43)
    at com.owncloud.android.ui.adapter.OCFileListAdapter.setData(OCFileListAdapter.java:694)
    at com.owncloud.android.ui.fragment.OCFileListSearchAsyncTask.doInBackground(OCFileListSearchAsyncTask.kt:70)
    at com.owncloud.android.ui.fragment.OCFileListSearchAsyncTask.doInBackground(OCFileListSearchAsyncTask.kt:33)
    at android.os.AsyncTask$3.call(AsyncTask.java:394)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:920)

App information

Device information

Firmware

Server error logs

No response

Additional information

No response

debojyoti452 commented 1 year ago

@UteHaus Is this task available?

UteHaus commented 1 year ago

This bug cam when I selected a folder in the favorites or go back to the favorites. (With this exception the App closed.)

The error came sporadically.

Nexctloud App version: 3.23.1

Garfonso commented 1 year ago

I get the same behavior. It seems to load the favorites just fine and the suddenly crashes.

This is the log the app shows me:

Cause of error

Exception in thread "AsyncTask #11" java.lang.RuntimeException: An error occurred while executing doInBackground()
    at android.os.AsyncTask$4.done(AsyncTask.java:415)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:381)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:250)
    at java.util.concurrent.FutureTask.run(FutureTask.java:269)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
    at java.lang.Thread.run(Thread.java:1012)
Caused by: Exception in thread "AsyncTask #11" java.util.ConcurrentModificationException
    at java.util.ArrayList.sort(ArrayList.java:1472)
    at java.util.Collections.sort(Collections.java:206)
    at kotlin.collections.CollectionsKt__MutableCollectionsJVMKt.sortWith(MutableCollectionsJVM.kt:42)
    at com.owncloud.android.utils.FileSortOrderByName.sortServerFiles(FileSortOrderByName.kt:58)
    at com.owncloud.android.utils.FileSortOrderByName.sortCloudFiles(FileSortOrderByName.kt:43)
    at com.owncloud.android.ui.adapter.OCFileListAdapter.setData(OCFileListAdapter.java:700)
    at com.owncloud.android.ui.fragment.OCFileListSearchAsyncTask.doInBackground(OCFileListSearchAsyncTask.kt:70)
    at com.owncloud.android.ui.fragment.OCFileListSearchAsyncTask.doInBackground(OCFileListSearchAsyncTask.kt:33)
    at android.os.AsyncTask$3.call(AsyncTask.java:394)
    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
    at java.lang.Thread.run(Thread.java:1012)

App information

Device information

Firmware

joshtrichards commented 1 year ago

This appears to match most of the traces in #7782, but reliable reproduction steps are hard to come by. Let's consolidate this matter there.