Skip to content

Commit 8625f8f

Browse files
committed
Applying PR review suggestions
1 parent 84d17d8 commit 8625f8f

File tree

1 file changed

+4
-5
lines changed
  • opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/connectivity/http

1 file changed

+4
-5
lines changed

opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/connectivity/http/OkHttpSender.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import okhttp3.MediaType;
1616
import okhttp3.OkHttpClient;
1717
import okhttp3.RequestBody;
18-
import okhttp3.Response;
1918
import okio.BufferedSink;
2019
import org.jetbrains.annotations.NotNull;
2120
import org.jetbrains.annotations.Nullable;
@@ -78,6 +77,9 @@ private static class OkHttpResponse implements Response {
7877
private final okhttp3.Response response;
7978

8079
private OkHttpResponse(okhttp3.Response response) {
80+
if (response.body() == null) {
81+
throw new IllegalStateException();
82+
}
8183
this.response = response;
8284
}
8385

@@ -93,10 +95,7 @@ public String statusMessage() {
9395

9496
@Override
9597
public InputStream bodyInputStream() {
96-
if (response.body() != null) {
97-
return response.body().byteStream();
98-
}
99-
throw new NullPointerException();
98+
return response.body().byteStream();
10099
}
101100

102101
@Override

0 commit comments

Comments
 (0)