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
70ccbc6e
authored
Oct 23, 2018
by
tonihei
Committed by
Patrik Åkerfeldt
Oct 24, 2018
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix review comments
See
https://github.com/google/ExoPlayer/pull/5004
parent
8c5703e9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
10 deletions
extensions/cronet/src/main/java/com/google/android/exoplayer2/ext/cronet/CronetDataSource.java
extensions/okhttp/src/main/java/com/google/android/exoplayer2/ext/okhttp/OkHttpDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/HttpDataSource.java
library/core/src/test/java/com/google/android/exoplayer2/upstream/DefaultLoadErrorHandlingPolicyTest.java
extensions/cronet/src/main/java/com/google/android/exoplayer2/ext/cronet/CronetDataSource.java
View file @
70ccbc6e
...
...
@@ -326,8 +326,12 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
// Check for a valid response code.
int
responseCode
=
responseInfo
.
getHttpStatusCode
();
if
(
responseCode
<
200
||
responseCode
>
299
)
{
InvalidResponseCodeException
exception
=
new
InvalidResponseCodeException
(
responseCode
,
responseInfo
.
getHttpStatusText
(),
responseInfo
.
getAllHeaders
(),
currentDataSpec
);
InvalidResponseCodeException
exception
=
new
InvalidResponseCodeException
(
responseCode
,
responseInfo
.
getHttpStatusText
(),
responseInfo
.
getAllHeaders
(),
currentDataSpec
);
if
(
responseCode
==
416
)
{
exception
.
initCause
(
new
DataSourceException
(
DataSourceException
.
POSITION_OUT_OF_RANGE
));
}
...
...
@@ -611,8 +615,11 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
// The industry standard is to disregard POST redirects when the status code is 307 or 308.
if
(
responseCode
==
307
||
responseCode
==
308
)
{
exception
=
new
InvalidResponseCodeException
(
responseCode
,
info
.
getHttpStatusText
(),
info
.
getAllHeaders
(),
currentDataSpec
);
new
InvalidResponseCodeException
(
responseCode
,
info
.
getHttpStatusText
(),
info
.
getAllHeaders
(),
currentDataSpec
);
operation
.
open
();
return
;
}
...
...
extensions/okhttp/src/main/java/com/google/android/exoplayer2/ext/okhttp/OkHttpDataSource.java
View file @
70ccbc6e
...
...
@@ -172,8 +172,8 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
if
(!
response
.
isSuccessful
())
{
Map
<
String
,
List
<
String
>>
headers
=
response
.
headers
().
toMultimap
();
closeConnectionQuietly
();
InvalidResponseCodeException
exception
=
new
InvalidResponseCodeException
(
responseCode
,
response
.
message
(),
headers
,
dataSpec
);
InvalidResponseCodeException
exception
=
new
InvalidResponseCodeException
(
responseCode
,
response
.
message
(),
headers
,
dataSpec
);
if
(
responseCode
==
416
)
{
exception
.
initCause
(
new
DataSourceException
(
DataSourceException
.
POSITION_OUT_OF_RANGE
));
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/HttpDataSource.java
View file @
70ccbc6e
...
...
@@ -298,15 +298,17 @@ public interface HttpDataSource extends DataSource {
/**
* The HTTP status message.
*/
public
final
@Nullable
String
responseMessage
;
@Nullable
public
final
String
responseMessage
;
/**
* An unmodifiable map of the response header fields and values.
*/
public
final
Map
<
String
,
List
<
String
>>
headerFields
;
public
InvalidResponseCodeException
(
int
responseCode
,
@Nullable
String
responseMessage
,
Map
<
String
,
List
<
String
>>
headerFields
,
public
InvalidResponseCodeException
(
int
responseCode
,
@Nullable
String
responseMessage
,
Map
<
String
,
List
<
String
>>
headerFields
,
DataSpec
dataSpec
)
{
super
(
"Response code: "
+
responseCode
,
dataSpec
,
TYPE_OPEN
);
this
.
responseCode
=
responseCode
;
...
...
library/core/src/test/java/com/google/android/exoplayer2/upstream/DefaultLoadErrorHandlingPolicyTest.java
View file @
70ccbc6e
...
...
@@ -50,7 +50,8 @@ public final class DefaultLoadErrorHandlingPolicyTest {
@Test
public
void
getBlacklistDurationMsFor_dontBlacklistUnexpectedHttpCodes
()
{
InvalidResponseCodeException
exception
=
new
InvalidResponseCodeException
(
500
,
"Internal Server Error"
,
Collections
.
emptyMap
(),
new
DataSpec
(
Uri
.
EMPTY
));
new
InvalidResponseCodeException
(
500
,
"Internal Server Error"
,
Collections
.
emptyMap
(),
new
DataSpec
(
Uri
.
EMPTY
));
assertThat
(
getDefaultPolicyBlacklistOutputFor
(
exception
)).
isEqualTo
(
C
.
TIME_UNSET
);
}
...
...
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