Update OkHttpDataSource.java

set responseBody to Util.EMPTY_BYTE_ARRAY when an IOException occurs trying to get his value from inputStream
This commit is contained in:
Emanuele Tidó 2021-01-06 00:12:55 +00:00 committed by GitHub
parent 654890846a
commit 91a09ea320
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -309,8 +309,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
try { try {
errorResponseBody = Util.toByteArray(Assertions.checkNotNull(responseByteStream)); errorResponseBody = Util.toByteArray(Assertions.checkNotNull(responseByteStream));
} catch (IOException e) { } catch (IOException e) {
throw new InvalidResponseCodeException( errorResponseBody = Util.EMPTY_BYTE_ARRAY;
responseCode, response.message(), headers, dataSpec, null);
} }
closeConnectionQuietly(); closeConnectionQuietly();
InvalidResponseCodeException exception = InvalidResponseCodeException exception =