diff --git a/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/bytes/GzipSource.java b/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/bytes/GzipSource.java index 46fec497f..ffe1b55ef 100644 --- a/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/bytes/GzipSource.java +++ b/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/bytes/GzipSource.java @@ -90,7 +90,7 @@ public final class GzipSource implements Source { // source returns -1. Here we attempt to force the underlying stream to // return -1 which may trigger it to release its resources. If it doesn't // return -1, then our Gzip data finished prematurely! - if (!source.exhausted(deadline)) { + if (!source.exhausted()) { throw new IOException("gzip finished without exhausting source"); } } diff --git a/okhttp-protocols/src/test/java/com/squareup/okhttp/internal/bytes/GzipSourceTest.java b/okhttp-protocols/src/test/java/com/squareup/okhttp/internal/bytes/GzipSourceTest.java index c2fdbdcc5..e640bfb8a 100644 --- a/okhttp-protocols/src/test/java/com/squareup/okhttp/internal/bytes/GzipSourceTest.java +++ b/okhttp-protocols/src/test/java/com/squareup/okhttp/internal/bytes/GzipSourceTest.java @@ -168,7 +168,7 @@ public class GzipSourceTest { assertEquals('b', gunzippedSource.readByte()); assertEquals('c', gunzippedSource.readByte()); assertFalse(exhaustableSource.exhausted); - assertEquals(-1, gunzippedSource.read(new OkBuffer(), 1, Deadline.NONE)); + assertEquals(-1, gunzippedSource.read(new OkBuffer(), 1)); assertTrue(exhaustableSource.exhausted); } @@ -236,15 +236,19 @@ public class GzipSourceTest { this.source = source; } - @Override public long read(OkBuffer sink, long byteCount, Deadline deadline) - throws IOException { - long result = source.read(sink, byteCount, deadline); + @Override public long read(OkBuffer sink, long byteCount) throws IOException { + long result = source.read(sink, byteCount); if (result == -1) exhausted = true; return result; } - @Override public void close(Deadline deadline) throws IOException { - source.close(deadline); + @Override public Source deadline(Deadline deadline) { + source.deadline(deadline); + return this; + } + + @Override public void close() throws IOException { + source.close(); } } }