summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2018-06-21 12:48:37 -0700
committerCopybara-Service <copybara-piper@google.com>2018-06-21 14:32:47 -0700
commit60754f4adf7eb2e18a5c311d73ae938406acd3b1 (patch)
tree5ea20d4d418818155628777fae1b98d7edd948a5
parentaffbe0e40d99abd974ac0fd06ab368940b465598 (diff)
Only throw expected exception when coalescing fails.
Bug: 110185399 Test: Manual PiperOrigin-RevId: 201570143 Change-Id: I5cf02a838113bde2dd218b84dda2c9cccffaa322
-rw-r--r--java/com/android/dialer/calllog/ui/NewCallLogFragment.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/java/com/android/dialer/calllog/ui/NewCallLogFragment.java b/java/com/android/dialer/calllog/ui/NewCallLogFragment.java
index ab0c22bcf..4141fe723 100644
--- a/java/com/android/dialer/calllog/ui/NewCallLogFragment.java
+++ b/java/com/android/dialer/calllog/ui/NewCallLogFragment.java
@@ -17,6 +17,7 @@ package com.android.dialer.calllog.ui;
import android.app.Activity;
import android.database.Cursor;
+import android.database.StaleDataException;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
@@ -336,12 +337,18 @@ public final class NewCallLogFragment extends Fragment implements LoaderCallback
}
},
throwable -> {
- // Coalescing can fail if the cursor passed to Coalescer is closed by the loader while
- // the work is still in progress.
- // This can happen when the loader restarts and finishes loading data before the
- // coalescing work is completed.
- // TODO(linyuh): throw an exception here if the failure above can be avoided.
- LogUtil.e("NewCallLogFragment.onLoadFinished", "coalescing failed", throwable);
+ if (throwable instanceof StaleDataException) {
+ // Coalescing can fail if the cursor passed to Coalescer is closed by the loader while
+ // the work is still in progress.
+ // This can happen when the loader restarts and finishes loading data before the
+ // coalescing work is completed.
+ // This failure doesn't need to be thrown as coalescing will be restarted on the latest
+ // data obtained by the loader.
+ // TODO(linyuh): Also throw an exception if the failure above can be avoided.
+ LogUtil.e("NewCallLogFragment.onLoadFinished", "coalescing failed", throwable);
+ } else {
+ throw new AssertionError(throwable);
+ }
});
}