diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSource.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSource.java index e5df8d55c3..12107e6111 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSource.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSource.java @@ -283,7 +283,7 @@ public final class CacheDataSource implements DataSource { } openNextSource(false); return bytesRemaining; - } catch (IOException e) { + } catch (Throwable e) { handleBeforeThrow(e); throw e; } @@ -325,6 +325,9 @@ public final class CacheDataSource implements DataSource { } handleBeforeThrow(e); throw e; + } catch (Throwable e) { + handleBeforeThrow(e); + throw e; } } @@ -349,7 +352,7 @@ public final class CacheDataSource implements DataSource { notifyBytesRead(); try { closeCurrentSource(); - } catch (IOException e) { + } catch (Throwable e) { handleBeforeThrow(e); throw e; } @@ -516,7 +519,7 @@ public final class CacheDataSource implements DataSource { } } - private void handleBeforeThrow(IOException exception) { + private void handleBeforeThrow(Throwable exception) { if (isReadingFromCache() || exception instanceof CacheException) { seenCacheError = true; } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheUtil.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheUtil.java index 47470c5de7..6277ec686f 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheUtil.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheUtil.java @@ -359,7 +359,7 @@ public final class CacheUtil { } } - /*package*/ static boolean isCausedByPositionOutOfRange(IOException e) { + /* package */ static boolean isCausedByPositionOutOfRange(IOException e) { Throwable cause = e; while (cause != null) { if (cause instanceof DataSourceException) {