Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f19a3674
authored
Jul 30, 2021
by
aquilescanta
Committed by
Christos Tsilopoulos
Aug 02, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Assign ERROR_CODE_IO_FILE_NOT_FOUND for AssetDataSource
PiperOrigin-RevId: 387777480
parent
1bad403e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
library/core/src/main/java/com/google/android/exoplayer2/upstream/AssetDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/AssetDataSource.java
View file @
f19a3674
...
...
@@ -25,6 +25,7 @@ import androidx.annotation.Nullable;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.PlaybackException
;
import
com.google.android.exoplayer2.util.Assertions
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.InputStream
;
...
...
@@ -46,7 +47,8 @@ public final class AssetDataSource extends BaseDataSource {
* @param cause The error cause.
* @param errorCode See {@link PlaybackException.ErrorCode}.
*/
public
AssetDataSourceException
(
Throwable
cause
,
@PlaybackException
.
ErrorCode
int
errorCode
)
{
public
AssetDataSourceException
(
@Nullable
Throwable
cause
,
@PlaybackException
.
ErrorCode
int
errorCode
)
{
super
(
cause
,
errorCode
);
}
}
...
...
@@ -80,7 +82,8 @@ public final class AssetDataSource extends BaseDataSource {
if
(
skipped
<
dataSpec
.
position
)
{
// assetManager.open() returns an AssetInputStream, whose skip() implementation only skips
// fewer bytes than requested if the skip is beyond the end of the asset's data.
throw
new
DataSourceException
(
PlaybackException
.
ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE
);
throw
new
AssetDataSourceException
(
/* cause=*/
null
,
PlaybackException
.
ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE
);
}
if
(
dataSpec
.
length
!=
C
.
LENGTH_UNSET
)
{
bytesRemaining
=
dataSpec
.
length
;
...
...
@@ -93,8 +96,14 @@ public final class AssetDataSource extends BaseDataSource {
bytesRemaining
=
C
.
LENGTH_UNSET
;
}
}
}
catch
(
AssetDataSourceException
e
)
{
throw
e
;
}
catch
(
IOException
e
)
{
throw
new
AssetDataSourceException
(
e
,
PlaybackException
.
ERROR_CODE_IO_UNSPECIFIED
);
throw
new
AssetDataSourceException
(
e
,
e
instanceof
FileNotFoundException
?
PlaybackException
.
ERROR_CODE_IO_FILE_NOT_FOUND
:
PlaybackException
.
ERROR_CODE_IO_UNSPECIFIED
);
}
opened
=
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment