aboutsummaryrefslogtreecommitdiffstats
path: root/okhttp-android-support/src/main
diff options
context:
space:
mode:
authorNeil Fuller <nfuller@google.com>2015-04-13 13:06:22 +0100
committerNeil Fuller <nfuller@google.com>2015-04-16 11:44:31 +0100
commita2cab72aa5ff730ba2ae987b45398faafffeb505 (patch)
tree283de306182e8f1faff93d4e6515298539d8c21d /okhttp-android-support/src/main
parent9fa0698523b8a573b8862c0e62c533be8bd53bda (diff)
downloadplatform_external_okhttp-a2cab72aa5ff730ba2ae987b45398faafffeb505.tar.gz
platform_external_okhttp-a2cab72aa5ff730ba2ae987b45398faafffeb505.tar.bz2
platform_external_okhttp-a2cab72aa5ff730ba2ae987b45398faafffeb505.zip
Roll-up of upstream OkHttp and Okio changes
OkHttp: From b609edd07864d7191dcda8ba1f6c833c9fe170ad to b40f99a950cb407eff52537a97420bd253a64f63 Okio: From 654ddf5e8f6311fda77e429c22d5e0e15f713b8d to b5811711b141b230e4e58f577c79cfbf4c2d4028 Both "to" are head as of 20150413. Patches applied cleanly without conflicts. This submission will break some CTS tests due to https://github.com/square/okhttp/issues/1552 Solutions will be made upstream and patched in. The CTS tests broken are related to SPDY/HTTP2 which are not used by Android's embedded OkHttp. Change-Id: I84d55b6f5c8dbc05148e86bd9421a2c393b563d4
Diffstat (limited to 'okhttp-android-support/src/main')
-rw-r--r--okhttp-android-support/src/main/java/com/squareup/okhttp/internal/huc/JavaApiConverter.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/okhttp-android-support/src/main/java/com/squareup/okhttp/internal/huc/JavaApiConverter.java b/okhttp-android-support/src/main/java/com/squareup/okhttp/internal/huc/JavaApiConverter.java
index 3494e1a..2c5f738 100644
--- a/okhttp-android-support/src/main/java/com/squareup/okhttp/internal/huc/JavaApiConverter.java
+++ b/okhttp-android-support/src/main/java/com/squareup/okhttp/internal/huc/JavaApiConverter.java
@@ -338,8 +338,8 @@ public final class JavaApiConverter {
/**
* Extracts the status line from the supplied Java API {@link java.net.CacheResponse}.
- * As per the spec, the status line is held as the header with the null key. Returns {@code null}
- * if there is no status line.
+ * As per the spec, the status line is held as the header with the null key. Throws a
+ * {@link ProtocolException} if there is no status line.
*/
private static String extractStatusLine(CacheResponse javaResponse) throws IOException {
Map<String, List<String>> javaResponseHeaders = javaResponse.getHeaders();
@@ -347,10 +347,14 @@ public final class JavaApiConverter {
}
// VisibleForTesting
- static String extractStatusLine(Map<String, List<String>> javaResponseHeaders) {
+ static String extractStatusLine(Map<String, List<String>> javaResponseHeaders)
+ throws ProtocolException {
List<String> values = javaResponseHeaders.get(null);
if (values == null || values.size() == 0) {
- return null;
+ // The status line is missing. This suggests a badly behaving cache.
+ throw new ProtocolException(
+ "CacheResponse is missing a \'null\' header containing the status line. Headers="
+ + javaResponseHeaders);
}
return values.get(0);
}