Skip to content

Commit

Permalink
Address Spotbugs issues in dependency update
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwiseman committed Nov 8, 2019
1 parent 6034688 commit 7164524
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,16 @@ static long contentLength(Headers headers) {
}

static String responseSourceHeader(Response response) {
if (response.networkResponse() == null) {
Response networkResponse = response.networkResponse();
if (networkResponse == null) {
return response.cacheResponse() == null
? "NONE"
: "CACHE " + response.code();
} else {
return response.cacheResponse() == null
? "NETWORK " + response.code()
: "CONDITIONAL_CACHE " + networkResponse.code();
}
return response.cacheResponse() == null
? "NETWORK " + response.code()
: "CONDITIONAL_CACHE " + response.networkResponse().code();
}

static String statusLineToString(Response response) {
Expand Down Expand Up @@ -351,6 +353,8 @@ static final class OkHttpURLConnection extends HttpURLConnection implements Call
call.cancel();
}

@SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
justification = "hasBody checks for this")
@Override public InputStream getErrorStream() {
try {
Response response = getResponse(true);
Expand Down Expand Up @@ -422,6 +426,8 @@ Headers getHeaders() throws IOException {
return toMultimap(requestHeaders.build(), null);
}

@SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
justification = "Good request will have body")
@Override public InputStream getInputStream() throws IOException {
if (!doInput) {
throw new ProtocolException("This protocol does not support input");
Expand Down Expand Up @@ -450,6 +456,8 @@ Headers getHeaders() throws IOException {
return requestBody.outputStream;
}

@SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
justification = "usingProxy() handles this")
@Override public Permission getPermission() {
URL url = getURL();
String hostname = url.getHost();
Expand Down Expand Up @@ -714,6 +722,8 @@ public void proceed() {
}
}

@SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
justification = "If we get here there is a connection and request.body() is checked")
@Override public Response intercept(Chain chain) throws IOException {
Request request = chain.request();

Expand Down

0 comments on commit 7164524

Please sign in to comment.