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

Merge pull request #4936 from TangHuaiZhe/dev2

Fix #4915 nullPointerException caused by realConnection is null
This commit is contained in:
Jesse Wilson
2019-04-13 09:24:46 -04:00
committed by GitHub

View File

@@ -229,8 +229,12 @@ public final class Http1ExchangeCodec implements ExchangeCodec {
return responseBuilder;
} catch (EOFException e) {
// Provide more context if the server ends the stream before sending a response.
String address = "unknown";
if (realConnection != null) {
address = realConnection.route().address().url().redact();
}
throw new IOException("unexpected end of stream on "
+ realConnection.route().address().url().redact(), e);
+ address, e);
}
}