diff options
author | linyuh <linyuh@google.com> | 2018-06-21 15:00:28 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-06-21 15:00:28 -0700 |
commit | b1db00938c3e78b99e6d5343bd093524b4535228 (patch) | |
tree | 7acda4948fbef276b2896891ae5cb7ebb03e7e50 | |
parent | c070bf648fca7d6d08eab79795725fc097cacf50 (diff) | |
parent | 9893a89dbe2378736464b31c40090454e9a8c08e (diff) |
Merge "Only throw expected exception when coalescing fails."
am: 9893a89dbe
Change-Id: I04ce2701a92c3863dc705eea616bb87aec257690
-rw-r--r-- | java/com/android/dialer/calllog/ui/NewCallLogFragment.java | 19 |
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); + } }); } |