diff --git a/library/src/main/java/com/google/android/exoplayer2/upstream/AssetDataSource.java b/library/src/main/java/com/google/android/exoplayer2/upstream/AssetDataSource.java index ff7ea42d4d7..1a685ca1af0 100644 --- a/library/src/main/java/com/google/android/exoplayer2/upstream/AssetDataSource.java +++ b/library/src/main/java/com/google/android/exoplayer2/upstream/AssetDataSource.java @@ -137,18 +137,18 @@ public Uri getUri() { @Override public void close() throws AssetDataSourceException { uri = null; - if (inputStream != null) { - try { + try { + if (inputStream != null) { inputStream.close(); - } catch (IOException e) { - throw new AssetDataSourceException(e); - } finally { - inputStream = null; - if (opened) { - opened = false; - if (listener != null) { - listener.onTransferEnd(this); - } + } + } catch (IOException e) { + throw new AssetDataSourceException(e); + } finally { + inputStream = null; + if (opened) { + opened = false; + if (listener != null) { + listener.onTransferEnd(this); } } } diff --git a/library/src/main/java/com/google/android/exoplayer2/upstream/ContentDataSource.java b/library/src/main/java/com/google/android/exoplayer2/upstream/ContentDataSource.java index 838a7970dc3..2a0ad014897 100644 --- a/library/src/main/java/com/google/android/exoplayer2/upstream/ContentDataSource.java +++ b/library/src/main/java/com/google/android/exoplayer2/upstream/ContentDataSource.java @@ -45,6 +45,7 @@ public ContentDataSourceException(IOException cause) { private final TransferListener listener; private Uri uri; + private AssetFileDescriptor assetFileDescriptor; private InputStream inputStream; private long bytesRemaining; private boolean opened; @@ -69,8 +70,8 @@ public ContentDataSource(Context context, TransferListener