From 2f8bd42b0e7cb81b46d65fdac21642b87558be21 Mon Sep 17 00:00:00 2001 From: olly Date: Wed, 19 Jun 2019 20:19:54 +0100 Subject: [PATCH] Remove Utils.equals() check for object equality that is fragile. PiperOrigin-RevId: 254046126 --- .../android/exoplayer2/ext/cronet/CronetDataSource.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/cronet/src/main/java/com/google/android/exoplayer2/ext/cronet/CronetDataSource.java b/extensions/cronet/src/main/java/com/google/android/exoplayer2/ext/cronet/CronetDataSource.java index 2cd40c8d70..b1f907cc37 100644 --- a/extensions/cronet/src/main/java/com/google/android/exoplayer2/ext/cronet/CronetDataSource.java +++ b/extensions/cronet/src/main/java/com/google/android/exoplayer2/ext/cronet/CronetDataSource.java @@ -32,7 +32,6 @@ import com.google.android.exoplayer2.util.Clock; import com.google.android.exoplayer2.util.ConditionVariable; import com.google.android.exoplayer2.util.Log; import com.google.android.exoplayer2.util.Predicate; -import com.google.android.exoplayer2.util.Util; import java.io.IOException; import java.net.SocketTimeoutException; import java.net.UnknownHostException; @@ -750,6 +749,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { * @param buffer The ByteBuffer into which the read data is stored. Must be a direct ByteBuffer. * @throws HttpDataSourceException If an error occurs reading from the source. */ + @SuppressWarnings("ReferenceEquality") private void readInternal(ByteBuffer buffer) throws HttpDataSourceException { castNonNull(currentUrlRequest).read(buffer); try { @@ -759,7 +759,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { } catch (InterruptedException e) { // The operation is ongoing so replace buffer to avoid it being written to by this // operation during a subsequent request. - if (Util.areEqual(buffer, readBuffer)) { + if (buffer == readBuffer) { readBuffer = null; } Thread.currentThread().interrupt(); @@ -770,7 +770,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { } catch (SocketTimeoutException e) { // The operation is ongoing so replace buffer to avoid it being written to by this // operation during a subsequent request. - if (Util.areEqual(buffer, readBuffer)) { + if (buffer == readBuffer) { readBuffer = null; } throw new HttpDataSourceException(