Commit 4fbe4fc7 by Oliver Woodman

Throw correct exception.

parent 042bd2ff
...@@ -27,6 +27,7 @@ import android.net.Uri; ...@@ -27,6 +27,7 @@ import android.net.Uri;
import android.util.Log; import android.util.Log;
import java.io.IOException; import java.io.IOException;
import java.io.InterruptedIOException;
/** /**
* A {@link DataSource} that reads and writes a {@link Cache}. Requests are fulfilled from the cache * A {@link DataSource} that reads and writes a {@link Cache}. Requests are fulfilled from the cache
...@@ -182,7 +183,6 @@ public final class CacheDataSource implements DataSource { ...@@ -182,7 +183,6 @@ public final class CacheDataSource implements DataSource {
* opened to read from the upstream source and write into the cache. * opened to read from the upstream source and write into the cache.
*/ */
private void openNextSource() throws IOException { private void openNextSource() throws IOException {
try {
DataSpec dataSpec; DataSpec dataSpec;
CacheSpan span; CacheSpan span;
if (ignoreCache) { if (ignoreCache) {
...@@ -193,7 +193,11 @@ public final class CacheDataSource implements DataSource { ...@@ -193,7 +193,11 @@ public final class CacheDataSource implements DataSource {
Log.w(TAG, "Cache bypassed due to unbounded length."); Log.w(TAG, "Cache bypassed due to unbounded length.");
span = null; span = null;
} else if (blockOnCache) { } else if (blockOnCache) {
try {
span = cache.startReadWrite(key, readPosition); span = cache.startReadWrite(key, readPosition);
} catch (InterruptedException e) {
throw new InterruptedIOException();
}
} else { } else {
span = cache.startReadWriteNonBlocking(key, readPosition); span = cache.startReadWriteNonBlocking(key, readPosition);
} }
...@@ -218,10 +222,6 @@ public final class CacheDataSource implements DataSource { ...@@ -218,10 +222,6 @@ public final class CacheDataSource implements DataSource {
: upstreamDataSource; : upstreamDataSource;
} }
currentDataSource.open(dataSpec); currentDataSource.open(dataSpec);
} catch (InterruptedException e) {
// Should never happen.
throw new RuntimeException(e);
}
} }
private void closeCurrentSource() throws IOException { private void closeCurrentSource() throws IOException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment