1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-22 15:42:00 +03:00

Fix the build wrt deadline.

This commit is contained in:
Adrian Cole
2014-02-22 08:58:54 -08:00
parent 9dfeda588a
commit 5ce9623515
2 changed files with 11 additions and 7 deletions

View File

@@ -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");
}
}

View File

@@ -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();
}
}
}