aboutsummaryrefslogtreecommitdiff
path: root/okhttp
diff options
context:
space:
mode:
authorTobias Thierer <tobiast@google.com>2017-08-17 18:28:00 +0100
committerTobias Thierer <tobiast@google.com>2017-08-30 11:52:15 +0100
commit7950c964e992fa94c18a60b0f69077a017a74334 (patch)
tree0a9281889ad0e98d095189b7818ada215261e0f7 /okhttp
parentf3436b166e01056d7b66abaad5b2e553338e0e3b (diff)
downloadokhttp-7950c964e992fa94c18a60b0f69077a017a74334.tar.gz
OkHttp: Drop leak warning message that may not be the app's fault.
When a HttpURLConnection is disconnect()ed but its response body isn't closed, OkHttp logs a warning because it delays garbage collection of associated state. One way this can happen is if an app only accesses the response header fields; this is not an app problem so we shouldn't warn about it. Bug: 64789755 Test: Treehugger Change-Id: If809b498d5567b68968eee6bf1be5e759eca677c
Diffstat (limited to 'okhttp')
-rw-r--r--okhttp/src/main/java/com/squareup/okhttp/ConnectionPool.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/okhttp/src/main/java/com/squareup/okhttp/ConnectionPool.java b/okhttp/src/main/java/com/squareup/okhttp/ConnectionPool.java
index 6f8efc4..4819ba6 100644
--- a/okhttp/src/main/java/com/squareup/okhttp/ConnectionPool.java
+++ b/okhttp/src/main/java/com/squareup/okhttp/ConnectionPool.java
@@ -301,9 +301,13 @@ public final class ConnectionPool {
continue;
}
- // We've discovered a leaked allocation. This is an application bug.
- Internal.logger.warning("A connection to " + connection.getRoute().getAddress().url()
- + " was leaked. Did you forget to close a response body?");
+ // Android-removed: Drop warning about a leak that may not be the app's fault.
+ // We can't tell here whether the app accessed the response body (InputStream) or
+ // only the header fields; at least in the latter case, the app has done nothing
+ // wrong so we shouldn't warn. http://b/64789755
+ // // We've discovered a leaked allocation. This is an application bug.
+ // Internal.logger.warning("A connection to " + connection.getRoute().getAddress().url()
+ // + " was leaked. Did you forget to close a response body?");
references.remove(i);
connection.noNewStreams = true;