From 50392ed67dc82387742d2ef75475a82dd587f955 Mon Sep 17 00:00:00 2001 From: John Zhen Mo Date: Fri, 30 Mar 2018 13:51:18 -0700 Subject: [PATCH] -Changed failed media source exception to use cause instead of top level exception. --- app/src/main/java/org/schabi/newpipe/player/BasePlayer.java | 4 ++-- .../schabi/newpipe/player/mediasource/FailedMediaSource.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java index e2fd2e6f7..bb1851efa 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java @@ -716,9 +716,9 @@ public abstract class BasePlayer implements playQueue.error(/*isNetworkProblem=*/true); } else if (isCurrentWindowValid()) { playQueue.error(/*isTransitioningToBadStream=*/true); - } else if (error instanceof FailedMediaSource.MediaSourceResolutionException) { + } else if (cause instanceof FailedMediaSource.MediaSourceResolutionException) { playQueue.error(/*recoverableWithNoAvailableStream=*/false); - } else if (error instanceof FailedMediaSource.StreamInfoLoadException) { + } else if (cause instanceof FailedMediaSource.StreamInfoLoadException) { playQueue.error(/*recoverableIfLoadFailsWhenNetworkIsFine=*/false); } else { playQueue.error(/*noIdeaWhatHappenedAndLetUserChooseWhatToDo=*/true); diff --git a/app/src/main/java/org/schabi/newpipe/player/mediasource/FailedMediaSource.java b/app/src/main/java/org/schabi/newpipe/player/mediasource/FailedMediaSource.java index 625c5d416..878d7c711 100644 --- a/app/src/main/java/org/schabi/newpipe/player/mediasource/FailedMediaSource.java +++ b/app/src/main/java/org/schabi/newpipe/player/mediasource/FailedMediaSource.java @@ -14,7 +14,7 @@ import java.io.IOException; public class FailedMediaSource implements ManagedMediaSource { private final String TAG = "FailedMediaSource@" + Integer.toHexString(hashCode()); - public static class FailedMediaSourceException extends IOException { + public static class FailedMediaSourceException extends Exception { FailedMediaSourceException(String message) { super(message); } @@ -79,7 +79,7 @@ public class FailedMediaSource implements ManagedMediaSource { @Override public void maybeThrowSourceInfoRefreshError() throws IOException { - throw error; + throw new IOException(error); } @Override