diff options
Diffstat (limited to 'src/main/java/com/android/volley/NetworkResponse.java')
-rw-r--r-- | src/main/java/com/android/volley/NetworkResponse.java | 26 |
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; } |