nextcloud-deck icon indicating copy to clipboard operation
nextcloud-deck copied to clipboard

`SyncManager#synchronize` should never call callback multiple times

Open stefan-niedermann opened this issue 2 years ago • 0 comments

Steps to reproduce the behavior:

  1. Ensure you have no accounts configured in Deck Android
  2. Enforce issue, for example simulate throwing NPE as here https://github.com/stefan-niedermann/nextcloud-deck/issues/1337
  3. Add breakpoints to the SyncManager#onResponse / SyncManager#onError callbacks in ImportAccountActivity
  4. Import account
  5. Watch both methods being called multiple times

This behavior leads to a race condition resulting in one possible cause of Account.getUserDisplayName()' on a null object reference exceptions: The account has been removed due to a error at the first sync but the app thinks everything went fine and tries to display this account (which is null)

Expected behavior

  1. Only one method should be called
  2. The called method should be called only once

stefan-niedermann avatar Oct 02 '22 08:10 stefan-niedermann