aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/android/volley/NetworkResponse.java
diff options
context:
space:
mode:
authorAnonymous <no-reply@google.com>2020-04-30 10:56:07 -0700
committerJeff Davidson <jpd@google.com>2020-04-30 11:32:32 -0700
commitec9c6e0d0e8e5e947017e24c270ca9f13487f937 (patch)
tree27e047f7667354b69c19637d9cb728f70cbf1892 /src/main/java/com/android/volley/NetworkResponse.java
parent582bbb822930556f855cad998a393edf7b64e1d4 (diff)
downloadvolley-ec9c6e0d0e8e5e947017e24c270ca9f13487f937.tar.gz
Import of Volley from GitHub to AOSP.
- c9b2623cb524d2ec29a5a7f012528115f45b24cd Tolerate null header maps in HttpHeaderParser. (#334) by Jeff Davidson <jpd@google.com> - 455a16125ae9d01176d68a2ea7d4747130e55801 Allow creation of custom input/output streams in HurlStac... by Nicolas <ndagnas@live.fr> - addc11dbd37bd3a5d8136557076af0e8d0a995a4 Annotate more nullable methods and fields (#333) by Julien Biral <jbir789@users.noreply.github.com> - d41f34a43520cd1d30fe71ada3271161adb0e9c0 Add @Nullable annotations to Response (#325) by justin-morey <justin.morey@gmail.com> - 8a3a7baa07dda3fb4c5d561664470311c13d215b Send request to network when cache entry parsing fails (#... by Ulrike Hager <uhager42@gmail.com> - 514eac8c33492f69f62799dcd3669c877474626c Re-initialize the cache if the directory was deleted. (#2... by Ulrike Hager <uhager42@gmail.com> - b95b0159a14f053590cb18fd1cf3a1b159e478a1 Fix timezone formatting for RFC1123 on some Android devic... by Jeff Davidson <jpd@google.com> - 96c88101bcb6139fc9dd2ded4ef7c0008085d4b1 httpheaderparser: log invalid date headers only verbosely... by Florens <Floens@gmail.com> - 8e7a6dbf4dfbea56da48814ecf6e7270dcec9b0f Allow Volley.newRequestQueue() to be called on main threa... by Yuhan Zhao <poligun@gmail.com> GitOrigin-RevId: c9b2623cb524d2ec29a5a7f012528115f45b24cd Change-Id: I8e677f68212e6ba0812f398744895a1a12b6ed70
Diffstat (limited to 'src/main/java/com/android/volley/NetworkResponse.java')
-rw-r--r--src/main/java/com/android/volley/NetworkResponse.java26
1 files changed, 16 insertions, 10 deletions
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<String, String> headers,
+ @Nullable Map<String, String> 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<Header> allHeaders) {
+ @Nullable List<Header> allHeaders) {
this(statusCode, data, toHeaderMap(allHeaders), allHeaders, notModified, networkTimeMs);
}
@@ -79,7 +80,10 @@ public class NetworkResponse {
*/
@Deprecated
public NetworkResponse(
- int statusCode, byte[] data, Map<String, String> headers, boolean notModified) {
+ int statusCode,
+ byte[] data,
+ @Nullable Map<String, String> 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<String, String> headers) {
+ public NetworkResponse(byte[] data, @Nullable Map<String, String> headers) {
this(
HttpURLConnection.HTTP_OK,
data,
@@ -119,8 +123,8 @@ public class NetworkResponse {
private NetworkResponse(
int statusCode,
byte[] data,
- Map<String, String> headers,
- List<Header> allHeaders,
+ @Nullable Map<String, String> headers,
+ @Nullable List<Header> 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<String, String> headers;
+ @Nullable public final Map<String, String> headers;
/** All response headers. Must not be mutated directly. */
- public final List<Header> allHeaders;
+ @Nullable public final List<Header> 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<String, String> toHeaderMap(List<Header> allHeaders) {
+ @Nullable
+ private static Map<String, String> toHeaderMap(@Nullable List<Header> allHeaders) {
if (allHeaders == null) {
return null;
}
@@ -176,7 +181,8 @@ public class NetworkResponse {
return headers;
}
- private static List<Header> toAllHeaderList(Map<String, String> headers) {
+ @Nullable
+ private static List<Header> toAllHeaderList(@Nullable Map<String, String> headers) {
if (headers == null) {
return null;
}