From ec9c6e0d0e8e5e947017e24c270ca9f13487f937 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Thu, 30 Apr 2020 10:56:07 -0700 Subject: Import of Volley from GitHub to AOSP. - c9b2623cb524d2ec29a5a7f012528115f45b24cd Tolerate null header maps in HttpHeaderParser. (#334) by Jeff Davidson - 455a16125ae9d01176d68a2ea7d4747130e55801 Allow creation of custom input/output streams in HurlStac... by Nicolas - addc11dbd37bd3a5d8136557076af0e8d0a995a4 Annotate more nullable methods and fields (#333) by Julien Biral - d41f34a43520cd1d30fe71ada3271161adb0e9c0 Add @Nullable annotations to Response (#325) by justin-morey - 8a3a7baa07dda3fb4c5d561664470311c13d215b Send request to network when cache entry parsing fails (#... by Ulrike Hager - 514eac8c33492f69f62799dcd3669c877474626c Re-initialize the cache if the directory was deleted. (#2... by Ulrike Hager - b95b0159a14f053590cb18fd1cf3a1b159e478a1 Fix timezone formatting for RFC1123 on some Android devic... by Jeff Davidson - 96c88101bcb6139fc9dd2ded4ef7c0008085d4b1 httpheaderparser: log invalid date headers only verbosely... by Florens - 8e7a6dbf4dfbea56da48814ecf6e7270dcec9b0f Allow Volley.newRequestQueue() to be called on main threa... by Yuhan Zhao GitOrigin-RevId: c9b2623cb524d2ec29a5a7f012528115f45b24cd Change-Id: I8e677f68212e6ba0812f398744895a1a12b6ed70 --- .../java/com/android/volley/NetworkResponse.java | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/main/java/com/android/volley/NetworkResponse.java') diff --git a/src/main/java/com/android/volley/NetworkResponse.java b/src/main/java/com/android/volley/NetworkResponse.java index 01f48c6..cfbc371 100644 --- a/src/main/java/com/android/volley/NetworkResponse.java +++ b/src/main/java/com/android/volley/NetworkResponse.java @@ -16,6 +16,7 @@ package com.android.volley; +import androidx.annotation.Nullable; import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.Collections; @@ -42,7 +43,7 @@ public class NetworkResponse { public NetworkResponse( int statusCode, byte[] data, - Map headers, + @Nullable Map headers, boolean notModified, long networkTimeMs) { this(statusCode, data, headers, toAllHeaderList(headers), notModified, networkTimeMs); @@ -62,7 +63,7 @@ public class NetworkResponse { byte[] data, boolean notModified, long networkTimeMs, - List
allHeaders) { + @Nullable List
allHeaders) { this(statusCode, data, toHeaderMap(allHeaders), allHeaders, notModified, networkTimeMs); } @@ -79,7 +80,10 @@ public class NetworkResponse { */ @Deprecated public NetworkResponse( - int statusCode, byte[] data, Map headers, boolean notModified) { + int statusCode, + byte[] data, + @Nullable Map headers, + boolean notModified) { this(statusCode, data, headers, notModified, /* networkTimeMs= */ 0); } @@ -107,7 +111,7 @@ public class NetworkResponse { * constructor may be removed in a future release of Volley. */ @Deprecated - public NetworkResponse(byte[] data, Map headers) { + public NetworkResponse(byte[] data, @Nullable Map headers) { this( HttpURLConnection.HTTP_OK, data, @@ -119,8 +123,8 @@ public class NetworkResponse { private NetworkResponse( int statusCode, byte[] data, - Map headers, - List
allHeaders, + @Nullable Map headers, + @Nullable List
allHeaders, boolean notModified, long networkTimeMs) { this.statusCode = statusCode; @@ -150,10 +154,10 @@ public class NetworkResponse { * map will only contain the last one. Use {@link #allHeaders} to inspect all headers returned * by the server. */ - public final Map headers; + @Nullable public final Map headers; /** All response headers. Must not be mutated directly. */ - public final List
allHeaders; + @Nullable public final List
allHeaders; /** True if the server returned a 304 (Not Modified). */ public final boolean notModified; @@ -161,7 +165,8 @@ public class NetworkResponse { /** Network roundtrip time in milliseconds. */ public final long networkTimeMs; - private static Map toHeaderMap(List
allHeaders) { + @Nullable + private static Map toHeaderMap(@Nullable List
allHeaders) { if (allHeaders == null) { return null; } @@ -176,7 +181,8 @@ public class NetworkResponse { return headers; } - private static List
toAllHeaderList(Map headers) { + @Nullable + private static List
toAllHeaderList(@Nullable Map headers) { if (headers == null) { return null; } -- cgit v1.2.3