nextcloud / nextcloud/android

Comparator or concurrent data struct modification issue: Comparison method violates its general contract!

Open
#13,628 1 comment 0 reactions 0 assignees View on GitHub
0. Needs triage bug performance: ISE/IAE :confused: stable-3.29
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

### ⚠️ Before posting ⚠️

- [X] This is a **bug**, not a question or an enhancement.
- [X] I've [searched for similar issues](https://github.com/nextcloud/android/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](https://nextcloud.com/contribute/code-of-conduct/).

### Steps to reproduce

Unsure, happened during uploading new fotos.

While uploading, I created a new subfolder in the target folder in order to upload additional images - maybe this was not handled correctly?

### Expected behaviour

App should not have crashed.

### Actual behaviour

Crash:

### Cause of error
```java
Exception in thread "pool-19-thread-1" java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeLo(TimSort.java:781)
at java.util.TimSort.mergeAt(TimSort.java:518)
at java.util.TimSort.mergeCollapse(TimSort.java:448)
at java.util.TimSort.sort(TimSort.java:245)
at java.util.Arrays.sort(Arrays.java:1344)
at java.util.ArrayList.sort(ArrayList.java:1738)
at java.util.Collections.sort(Collections.java:210)
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$swapDirectory$3(LocalFileListAdapter.java:355)
at com.owncloud.android.ui.adapter.LocalFileListAdapter.$r8$lambda$S58vNYrcsJDfBipd7SOxn7-wncE(Unknown Source:0)
at com.owncloud.android.ui.adapter.LocalFileListAdapter$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)

```

### App information
* ID: `com.nextcloud.client`
* Version: `30290290`
* Build flavor: `gplay`

### Device information
* Brand: `Fairphone`
* Device: `FP5`
* Model: `FP5`
* Id: `UKQ1.230924.001`
* Product: `FP5`

### Firmware
* SDK: `34`
* Release: `14`
* Incremental: `UT27`

### Android version

14

### Device brand and model

FP5

### Stock or custom OS?

Stock

### Nextcloud android app version

3.29.2

### Nextcloud server version

29.0.7

### Using a reverse proxy?

Yes

### Android logs

_No response_

### Server error logs

_No response_

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.