Skip to content

Commit 976c348

Browse files
committed
Fix Spotbugs
1 parent f9a0686 commit 976c348

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/main/java/com/imsweb/seerapi/client/ErrorInterceptor.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
package com.imsweb.seerapi.client;
55

66
import java.io.IOException;
7+
import java.util.Objects;
8+
9+
import org.jetbrains.annotations.NotNull;
710

811
import com.fasterxml.jackson.databind.ObjectMapper;
912

@@ -15,6 +18,7 @@
1518
*/
1619
public class ErrorInterceptor implements Interceptor {
1720

21+
@NotNull
1822
@Override
1923
public Response intercept(Chain chain) throws IOException {
2024
Response response = chain.proceed(chain.request());
@@ -24,7 +28,7 @@ public Response intercept(Chain chain) throws IOException {
2428
ErrorResponse error = null;
2529
if (response.body() != null) {
2630
try {
27-
error = new ObjectMapper().readValue(response.body().byteStream(), ErrorResponse.class);
31+
error = new ObjectMapper().readValue(Objects.requireNonNull(response.body()).byteStream(), ErrorResponse.class);
2832
}
2933
catch (IOException e) {
3034
// sometimes the error message is not right format (like for 404 errors)

0 commit comments

Comments
 (0)