android / architecture-samples

A collection of samples to discuss and showcase different architectural tools and patterns for Android apps.
Apache License 2.0
44.5k stars 11.65k forks source link

[todo-mvp-loaders]TasksRepository is not thread-safe #275

Closed kyle-ilantzis closed 6 years ago

kyle-ilantzis commented 7 years ago

Like https://github.com/googlesamples/android-architecture/issues/179 TasksLoader and TaskLoader run in a thread pool, so should synchronized the visit of shared resource (e.g., TasksRepository.mCacheTasks)

swankjesse commented 7 years ago
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10
    at java.util.LinkedHashMap.addNewEntry(LinkedHashMap.java:195)
    at java.util.HashMap.put(HashMap.java:403)
    at com.example.android.architecture.blueprints.todoapp.data.source.TasksRepository#saveTask.run(TasksRepository.java:189)
JoseAlcerreca commented 6 years ago

The loaders branch is deprecated, so closing this. (But, yeah, looks like a big bug.)